* 减少窗体闪烁

This commit is contained in:
Sunny 2021-04-12 22:55:00 +08:00
parent 2682357470
commit 45d9bb7648
9 changed files with 31 additions and 9 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -48,6 +48,14 @@ namespace Sunny.UI
{
InitializeComponent();
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
SetStyle(ControlStyles.DoubleBuffer, true);
SetStyle(ControlStyles.Selectable, true);
SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
base.DoubleBuffered = true;
UpdateStyles();
edit.Font = UIFontColor.Font;
edit.Left = 3;
edit.Top = 3;

View File

@ -39,6 +39,14 @@ namespace Sunny.UI
{
InitializeComponent();
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
SetStyle(ControlStyles.DoubleBuffer, true);
SetStyle(ControlStyles.Selectable, true);
SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
DoubleBuffered = true;
UpdateStyles();
box.SelectedIndexChanged += Box_SelectedIndexChanged;
box.DataSourceChanged += Box_DataSourceChanged;
box.DisplayMemberChanged += Box_DisplayMemberChanged;

View File

@ -39,7 +39,12 @@ namespace Sunny.UI
public UITabControl()
{
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.DoubleBuffer, true);
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
SetStyle(ControlStyles.DoubleBuffer, true);
SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
DoubleBuffered = true;
UpdateStyles();
ItemSize = new Size(150, 40);
DrawMode = TabDrawMode.OwnerDrawFixed;
@ -79,13 +84,6 @@ namespace Sunny.UI
DrawedIndex = SelectedIndex;
}
protected override void OnSelected(TabControlEventArgs e)
{
base.OnSelected(e);
}
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (ForbidCtrlTab)

View File

@ -1417,7 +1417,15 @@ namespace Sunny.UI
protected override void WndProc(ref Message m)
{
base.WndProc(ref m);
switch (m.Msg)
{
case Win32.User.WM_ERASEBKGND:
m.Result = IntPtr.Zero;
break;
default:
base.WndProc(ref m);
break;
}
if (m.Msg == Win32.User.WM_NCHITTEST && ShowDragStretch && WindowState == FormWindowState.Normal)
{