using System.ComponentModel; using System.Drawing; using System.Windows.Forms; namespace SmartCoalApplication.SystemLayer { public class ScrollPanel : Panel { private bool ignoreSetFocus = false; public bool IgnoreSetFocus { get { return ignoreSetFocus; } set { ignoreSetFocus = value; } } [Browsable(false)] public Point ScrollPosition { get { return new Point(-AutoScrollPosition.X, -AutoScrollPosition.Y); } set { AutoScrollPosition = value; } } protected override void WndProc(ref Message m) { switch (m.Msg) { case NativeConstants.WM_SETFOCUS: if (IgnoreSetFocus) { return; } else { goto default; } default: base.WndProc(ref m); break; } } } }