DoubleBufferPanel: Fix scrolling inconsistencies

This commit is contained in:
2017-02-05 02:25:59 +01:00
parent 6bbfbc2fd4
commit 95c83aa736
3 changed files with 20 additions and 3 deletions

View File

@@ -1,4 +1,6 @@
using System; using System;
using System.ComponentModel;
using System.Drawing;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Windows.Forms; using System.Windows.Forms;
@@ -18,7 +20,6 @@ namespace CsvView
, true); , true);
} }
[DllImport("user32.dll", CharSet = CharSet.Auto)] [DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern int SendMessage(IntPtr hWnd, Int32 wMsg, bool wParam, Int32 lParam); public static extern int SendMessage(IntPtr hWnd, Int32 wMsg, bool wParam, Int32 lParam);
@@ -37,5 +38,19 @@ namespace CsvView
Refresh(); Refresh();
} }
[DefaultValue(false)]
[Localizable(false)]
[Category("CatLayout")]
[Description("DisableAutoScrollDescr")]
public bool DisableAutoScroll { get; set; }
protected override Point ScrollToControl(Control activeControl)
{
if (DisableAutoScroll)
{
return DisplayRectangle.Location;
}
return base.ScrollToControl(activeControl);
}
} }
} }

View File

@@ -170,6 +170,7 @@
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.pnlData.AutoScroll = true; this.pnlData.AutoScroll = true;
this.pnlData.Location = new System.Drawing.Point(0, 37); this.pnlData.Location = new System.Drawing.Point(0, 37);
this.pnlData.DisableAutoScroll = true;
this.pnlData.Name = "pnlData"; this.pnlData.Name = "pnlData";
this.pnlData.Size = new System.Drawing.Size(508, 432); this.pnlData.Size = new System.Drawing.Size(508, 432);
this.pnlData.TabIndex = 11; this.pnlData.TabIndex = 11;

View File

@@ -1,7 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Runtime.InteropServices;
using System.Windows.Forms; using System.Windows.Forms;
namespace CsvView namespace CsvView
@@ -150,6 +149,7 @@ namespace CsvView
pnlData.SuspendDrawing(); pnlData.SuspendDrawing();
pnlData.VerticalScroll.Value = 0;
pnlData.Controls.Clear(); pnlData.Controls.Clear();
_currentReg = currentReg; _currentReg = currentReg;
txtCurrentReg.Text = Convert.ToString(currentReg); txtCurrentReg.Text = Convert.ToString(currentReg);
@@ -208,6 +208,7 @@ namespace CsvView
pnlData.SuspendDrawing(); pnlData.SuspendDrawing();
pnlData.VerticalScroll.Value = 0;
pnlData.Controls.Clear(); pnlData.Controls.Clear();
pnlReg.Enabled = false; pnlReg.Enabled = false;
txtCurrentReg.Text = string.Empty; txtCurrentReg.Text = string.Empty;