FrmCsvViewer: Fix scrollbar issues

This commit is contained in:
2017-02-05 13:26:39 +01:00
parent aa5b588daf
commit baf07ce1f0
2 changed files with 163 additions and 113 deletions

241
FrmCsvViewer.Designer.cs generated
View File

@@ -30,106 +30,114 @@
{ {
this.txtPath = new System.Windows.Forms.TextBox(); this.txtPath = new System.Windows.Forms.TextBox();
this.btnLoad = new System.Windows.Forms.Button(); this.btnLoad = new System.Windows.Forms.Button();
this.btnFirstReg = new System.Windows.Forms.Button(); this.grpFile = new System.Windows.Forms.GroupBox();
this.pnlScrollData = new CsvView.DoubleBufferPanel();
this.pnlData = new CsvView.DoubleBufferPanel();
this.pnlReg = new CsvView.DoubleBufferPanel();
this.btnPrevReg = new System.Windows.Forms.Button(); this.btnPrevReg = new System.Windows.Forms.Button();
this.btnNextReg = new System.Windows.Forms.Button(); this.tblRegNumbers = new System.Windows.Forms.TableLayoutPanel();
this.btnLastReg = new System.Windows.Forms.Button();
this.txtCurrentReg = new System.Windows.Forms.TextBox(); this.txtCurrentReg = new System.Windows.Forms.TextBox();
this.txtTotalRegs = new System.Windows.Forms.TextBox(); this.txtTotalRegs = new System.Windows.Forms.TextBox();
this.tblRegNumbers = new System.Windows.Forms.TableLayoutPanel(); this.btnFirstReg = new System.Windows.Forms.Button();
this.pnlReg = new CsvView.DoubleBufferPanel(); this.btnLastReg = new System.Windows.Forms.Button();
this.pnlData = new CsvView.DoubleBufferPanel(); this.btnNextReg = new System.Windows.Forms.Button();
this.tblRegNumbers.SuspendLayout(); this.grpFile.SuspendLayout();
this.pnlScrollData.SuspendLayout();
this.pnlReg.SuspendLayout(); this.pnlReg.SuspendLayout();
this.tblRegNumbers.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// txtPath // txtPath
// //
this.txtPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.txtPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.txtPath.Location = new System.Drawing.Point(12, 14); this.txtPath.Location = new System.Drawing.Point(7, 27);
this.txtPath.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txtPath.Name = "txtPath"; this.txtPath.Name = "txtPath";
this.txtPath.Size = new System.Drawing.Size(457, 20); this.txtPath.Size = new System.Drawing.Size(676, 26);
this.txtPath.TabIndex = 0; this.txtPath.TabIndex = 0;
this.txtPath.DoubleClick += new System.EventHandler(this.txtPath_DoubleClick); this.txtPath.DoubleClick += new System.EventHandler(this.txtPath_DoubleClick);
// //
// btnLoad // btnLoad
// //
this.btnLoad.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.btnLoad.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnLoad.Location = new System.Drawing.Point(475, 11); this.btnLoad.Location = new System.Drawing.Point(691, 27);
this.btnLoad.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.btnLoad.Name = "btnLoad"; this.btnLoad.Name = "btnLoad";
this.btnLoad.Size = new System.Drawing.Size(45, 23); this.btnLoad.Size = new System.Drawing.Size(68, 26);
this.btnLoad.TabIndex = 3; this.btnLoad.TabIndex = 3;
this.btnLoad.Text = "Load"; this.btnLoad.Text = "Load";
this.btnLoad.UseVisualStyleBackColor = true; this.btnLoad.UseVisualStyleBackColor = true;
this.btnLoad.Click += new System.EventHandler(this.btnLoad_Click); this.btnLoad.Click += new System.EventHandler(this.btnLoad_Click);
// //
// btnFirstReg // grpFile
// //
this.btnFirstReg.Font = new System.Drawing.Font("Courier New", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.grpFile.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
this.btnFirstReg.Location = new System.Drawing.Point(0, 0); | System.Windows.Forms.AnchorStyles.Right)));
this.btnFirstReg.Name = "btnFirstReg"; this.grpFile.Controls.Add(this.btnLoad);
this.btnFirstReg.Size = new System.Drawing.Size(36, 30); this.grpFile.Controls.Add(this.txtPath);
this.btnFirstReg.TabIndex = 4; this.grpFile.Location = new System.Drawing.Point(20, 12);
this.btnFirstReg.Text = "|<"; this.grpFile.Name = "grpFile";
this.btnFirstReg.UseVisualStyleBackColor = true; this.grpFile.Size = new System.Drawing.Size(766, 67);
this.btnFirstReg.Click += new System.EventHandler(this.btnFirstReg_Click); this.grpFile.TabIndex = 12;
this.grpFile.TabStop = false;
this.grpFile.Text = "File";
//
// pnlScrollData
//
this.pnlScrollData.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.pnlScrollData.AutoScroll = true;
this.pnlScrollData.Controls.Add(this.pnlData);
this.pnlScrollData.DisableAutoScroll = true;
this.pnlScrollData.Location = new System.Drawing.Point(20, 126);
this.pnlScrollData.Name = "pnlScrollData";
this.pnlScrollData.Size = new System.Drawing.Size(766, 664);
this.pnlScrollData.TabIndex = 12;
//
// pnlData
//
this.pnlData.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.pnlData.BackColor = System.Drawing.SystemColors.Control;
this.pnlData.DisableAutoScroll = true;
this.pnlData.Location = new System.Drawing.Point(0, 0);
this.pnlData.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.pnlData.Name = "pnlData";
this.pnlData.Size = new System.Drawing.Size(766, 80);
this.pnlData.TabIndex = 11;
//
// pnlReg
//
this.pnlReg.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.pnlReg.BackColor = System.Drawing.SystemColors.Control;
this.pnlReg.Controls.Add(this.btnPrevReg);
this.pnlReg.Controls.Add(this.tblRegNumbers);
this.pnlReg.Controls.Add(this.btnFirstReg);
this.pnlReg.Controls.Add(this.btnLastReg);
this.pnlReg.Controls.Add(this.btnNextReg);
this.pnlReg.Enabled = false;
this.pnlReg.Location = new System.Drawing.Point(21, 87);
this.pnlReg.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.pnlReg.Name = "pnlReg";
this.pnlReg.Size = new System.Drawing.Size(765, 701);
this.pnlReg.TabIndex = 11;
// //
// btnPrevReg // btnPrevReg
// //
this.btnPrevReg.Font = new System.Drawing.Font("Courier New", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btnPrevReg.Font = new System.Drawing.Font("Courier New", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnPrevReg.Location = new System.Drawing.Point(42, 0); this.btnPrevReg.Location = new System.Drawing.Point(62, 0);
this.btnPrevReg.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.btnPrevReg.Name = "btnPrevReg"; this.btnPrevReg.Name = "btnPrevReg";
this.btnPrevReg.Size = new System.Drawing.Size(36, 30); this.btnPrevReg.Size = new System.Drawing.Size(54, 31);
this.btnPrevReg.TabIndex = 5; this.btnPrevReg.TabIndex = 5;
this.btnPrevReg.Text = "<"; this.btnPrevReg.Text = "<";
this.btnPrevReg.UseVisualStyleBackColor = true; this.btnPrevReg.UseVisualStyleBackColor = true;
this.btnPrevReg.Click += new System.EventHandler(this.btnPrevReg_Click); this.btnPrevReg.Click += new System.EventHandler(this.btnPrevReg_Click);
// //
// btnNextReg
//
this.btnNextReg.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnNextReg.Font = new System.Drawing.Font("Courier New", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnNextReg.Location = new System.Drawing.Point(430, 0);
this.btnNextReg.Name = "btnNextReg";
this.btnNextReg.Size = new System.Drawing.Size(36, 30);
this.btnNextReg.TabIndex = 6;
this.btnNextReg.Text = ">";
this.btnNextReg.UseVisualStyleBackColor = true;
this.btnNextReg.Click += new System.EventHandler(this.btnNextReg_Click);
//
// btnLastReg
//
this.btnLastReg.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnLastReg.Font = new System.Drawing.Font("Courier New", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnLastReg.Location = new System.Drawing.Point(472, 0);
this.btnLastReg.Name = "btnLastReg";
this.btnLastReg.Size = new System.Drawing.Size(36, 30);
this.btnLastReg.TabIndex = 7;
this.btnLastReg.Text = ">|";
this.btnLastReg.UseVisualStyleBackColor = true;
this.btnLastReg.Click += new System.EventHandler(this.btnLastReg_Click);
//
// txtCurrentReg
//
this.txtCurrentReg.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtCurrentReg.Location = new System.Drawing.Point(3, 3);
this.txtCurrentReg.Name = "txtCurrentReg";
this.txtCurrentReg.Size = new System.Drawing.Size(164, 20);
this.txtCurrentReg.TabIndex = 8;
this.txtCurrentReg.TextChanged += new System.EventHandler(this.txtCurrentReg_TextChanged);
//
// txtTotalRegs
//
this.txtTotalRegs.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtTotalRegs.Location = new System.Drawing.Point(173, 3);
this.txtTotalRegs.Name = "txtTotalRegs";
this.txtTotalRegs.ReadOnly = true;
this.txtTotalRegs.Size = new System.Drawing.Size(164, 20);
this.txtTotalRegs.TabIndex = 9;
//
// tblRegNumbers // tblRegNumbers
// //
this.tblRegNumbers.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.tblRegNumbers.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
@@ -137,59 +145,94 @@
this.tblRegNumbers.ColumnCount = 2; this.tblRegNumbers.ColumnCount = 2;
this.tblRegNumbers.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); this.tblRegNumbers.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tblRegNumbers.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); this.tblRegNumbers.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tblRegNumbers.Controls.Add(this.txtTotalRegs, 1, 0);
this.tblRegNumbers.Controls.Add(this.txtCurrentReg, 0, 0); this.tblRegNumbers.Controls.Add(this.txtCurrentReg, 0, 0);
this.tblRegNumbers.Location = new System.Drawing.Point(84, 0); this.tblRegNumbers.Controls.Add(this.txtTotalRegs, 1, 0);
this.tblRegNumbers.Location = new System.Drawing.Point(124, 0);
this.tblRegNumbers.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.tblRegNumbers.Name = "tblRegNumbers"; this.tblRegNumbers.Name = "tblRegNumbers";
this.tblRegNumbers.RowCount = 1; this.tblRegNumbers.RowCount = 1;
this.tblRegNumbers.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); this.tblRegNumbers.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tblRegNumbers.Size = new System.Drawing.Size(340, 30); this.tblRegNumbers.Size = new System.Drawing.Size(517, 31);
this.tblRegNumbers.TabIndex = 10; this.tblRegNumbers.TabIndex = 10;
// //
// pnlReg // txtCurrentReg
// //
this.pnlReg.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.txtCurrentReg.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.pnlReg.Controls.Add(this.pnlData); this.txtCurrentReg.Location = new System.Drawing.Point(4, 5);
this.pnlReg.Controls.Add(this.btnPrevReg); this.txtCurrentReg.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.pnlReg.Controls.Add(this.tblRegNumbers); this.txtCurrentReg.Name = "txtCurrentReg";
this.pnlReg.Controls.Add(this.btnFirstReg); this.txtCurrentReg.Size = new System.Drawing.Size(250, 26);
this.pnlReg.Controls.Add(this.btnLastReg); this.txtCurrentReg.TabIndex = 8;
this.pnlReg.Controls.Add(this.btnNextReg); this.txtCurrentReg.TextChanged += new System.EventHandler(this.txtCurrentReg_TextChanged);
this.pnlReg.Enabled = false;
this.pnlReg.Location = new System.Drawing.Point(12, 40);
this.pnlReg.Name = "pnlReg";
this.pnlReg.Size = new System.Drawing.Size(508, 469);
this.pnlReg.TabIndex = 11;
// //
// pnlData // txtTotalRegs
// //
this.pnlData.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.txtTotalRegs.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.pnlData.AutoScroll = true; this.txtTotalRegs.Location = new System.Drawing.Point(262, 5);
this.pnlData.Location = new System.Drawing.Point(0, 37); this.txtTotalRegs.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.pnlData.DisableAutoScroll = true; this.txtTotalRegs.Name = "txtTotalRegs";
this.pnlData.Name = "pnlData"; this.txtTotalRegs.ReadOnly = true;
this.pnlData.Size = new System.Drawing.Size(508, 432); this.txtTotalRegs.Size = new System.Drawing.Size(251, 26);
this.pnlData.TabIndex = 11; this.txtTotalRegs.TabIndex = 9;
//
// btnFirstReg
//
this.btnFirstReg.Font = new System.Drawing.Font("Courier New", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnFirstReg.Location = new System.Drawing.Point(0, 0);
this.btnFirstReg.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.btnFirstReg.Name = "btnFirstReg";
this.btnFirstReg.Size = new System.Drawing.Size(54, 31);
this.btnFirstReg.TabIndex = 4;
this.btnFirstReg.Text = "|<";
this.btnFirstReg.UseVisualStyleBackColor = true;
this.btnFirstReg.Click += new System.EventHandler(this.btnFirstReg_Click);
//
// btnLastReg
//
this.btnLastReg.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnLastReg.Font = new System.Drawing.Font("Courier New", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnLastReg.Location = new System.Drawing.Point(711, 0);
this.btnLastReg.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.btnLastReg.Name = "btnLastReg";
this.btnLastReg.Size = new System.Drawing.Size(54, 31);
this.btnLastReg.TabIndex = 7;
this.btnLastReg.Text = ">|";
this.btnLastReg.UseVisualStyleBackColor = true;
this.btnLastReg.Click += new System.EventHandler(this.btnLastReg_Click);
//
// btnNextReg
//
this.btnNextReg.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnNextReg.Font = new System.Drawing.Font("Courier New", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnNextReg.Location = new System.Drawing.Point(649, 0);
this.btnNextReg.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.btnNextReg.Name = "btnNextReg";
this.btnNextReg.Size = new System.Drawing.Size(54, 31);
this.btnNextReg.TabIndex = 6;
this.btnNextReg.Text = ">";
this.btnNextReg.UseVisualStyleBackColor = true;
this.btnNextReg.Click += new System.EventHandler(this.btnNextReg_Click);
// //
// FrmCsvViewer // FrmCsvViewer
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(532, 521); this.ClientSize = new System.Drawing.Size(798, 802);
this.Controls.Add(this.pnlScrollData);
this.Controls.Add(this.grpFile);
this.Controls.Add(this.pnlReg); this.Controls.Add(this.pnlReg);
this.Controls.Add(this.btnLoad); this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.Controls.Add(this.txtPath);
this.Name = "FrmCsvViewer"; this.Name = "FrmCsvViewer";
this.Text = "CsvViewer"; this.Text = "CsvViewer";
this.grpFile.ResumeLayout(false);
this.grpFile.PerformLayout();
this.pnlScrollData.ResumeLayout(false);
this.pnlReg.ResumeLayout(false);
this.tblRegNumbers.ResumeLayout(false); this.tblRegNumbers.ResumeLayout(false);
this.tblRegNumbers.PerformLayout(); this.tblRegNumbers.PerformLayout();
this.pnlReg.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout();
} }
@@ -206,6 +249,8 @@
private System.Windows.Forms.TableLayoutPanel tblRegNumbers; private System.Windows.Forms.TableLayoutPanel tblRegNumbers;
private CsvView.DoubleBufferPanel pnlReg; private CsvView.DoubleBufferPanel pnlReg;
private CsvView.DoubleBufferPanel pnlData; private CsvView.DoubleBufferPanel pnlData;
private System.Windows.Forms.GroupBox grpFile;
private DoubleBufferPanel pnlScrollData;
} }
} }

View File

@@ -147,9 +147,10 @@ namespace CsvView
last = true; last = true;
} }
pnlData.SuspendDrawing(); pnlScrollData.SuspendDrawing();
pnlScrollData.VerticalScroll.Value = 0;
pnlData.Height = 10;
pnlData.VerticalScroll.Value = 0;
pnlData.Controls.Clear(); pnlData.Controls.Clear();
_currentReg = currentReg; _currentReg = currentReg;
txtCurrentReg.Text = Convert.ToString(currentReg); txtCurrentReg.Text = Convert.ToString(currentReg);
@@ -164,30 +165,33 @@ namespace CsvView
int y = 0; int y = 0;
const int TexboxPadding = 5; const int TexboxPadding = 5;
const int Padding = 9; const int PaddingLeft = 0;
const int PaddingRight = 0;
const int PaddingBetween = 10;
const int LineHeight = 15; const int LineHeight = 15;
for (int i = 0; i < currentData.Count; i++) for (int i = 0; i < currentData.Count; i++)
{ {
TextBox txtValue = RenderValue(currentData[i], y, TexboxPadding, Padding, LineHeight); TextBox txtValue = RenderValue(currentData[i], y, TexboxPadding, PaddingLeft, PaddingRight, LineHeight);
pnlData.Controls.Add(txtValue); pnlData.Controls.Add(txtValue);
y += txtValue.Height + Padding; y += txtValue.Height + PaddingBetween;
} }
pnlData.Height = y;
pnlData.ResumeDrawing(); pnlScrollData.ResumeDrawing();
_rendering = false; _rendering = false;
} }
private TextBox RenderValue(string value, int y, int TexboxPadding, int Padding, int LineHeight) private TextBox RenderValue(string value, int y, int TexboxPadding, int PaddingLeft, int PaddingRight, int LineHeight)
{ {
string[] valueLines = value.Split('\n'); string[] valueLines = value.Split('\n');
CTextBox txtValue = new CTextBox() CTextBox txtValue = new CTextBox()
{ {
Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right), Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right),
Width = pnlData.Width - Padding, Width = pnlData.Width - (PaddingLeft + PaddingRight),
Height = (valueLines.Length * LineHeight) + TexboxPadding, Height = (valueLines.Length * LineHeight) + TexboxPadding,
Multiline = (valueLines.Length > 1), Multiline = (valueLines.Length > 1),
Top = y, Top = y,
Left = 0, Left = PaddingLeft,
ReadOnly = true, ReadOnly = true,
}; };
for (int j = 0; j < valueLines.Length; j++) for (int j = 0; j < valueLines.Length; j++)
@@ -206,15 +210,16 @@ namespace CsvView
if (_rendering) { return; } if (_rendering) { return; }
_rendering = true; _rendering = true;
pnlData.SuspendDrawing(); pnlScrollData.SuspendDrawing();
pnlScrollData.VerticalScroll.Value = 0;
pnlData.Height = 10;
pnlData.VerticalScroll.Value = 0;
pnlData.Controls.Clear(); pnlData.Controls.Clear();
pnlReg.Enabled = false; pnlReg.Enabled = false;
txtCurrentReg.Text = string.Empty; txtCurrentReg.Text = string.Empty;
txtTotalRegs.Text = string.Empty; txtTotalRegs.Text = string.Empty;
pnlData.ResumeDrawing(); pnlScrollData.ResumeDrawing();
_rendering = false; _rendering = false;
} }