Home > Net >  Of new turn to the great god, maximize winform procedure, the page is not complete, as shown in figu
Of new turn to the great god, maximize winform procedure, the page is not complete, as shown in figu

Time:12-03

The great god, look at the normal display interface

And then click the maximize, you become like this, (normal on Windows 7, the problems on win10)

Finally cause the code, but this code can't take out, I want to use, this code can solve the problem of page switch flicker,

If you remove the code, full display window can indeed, but flashing is too serious,
The great god what's the solution? Thank you thank you

CodePudding user response:

WM_NCCALCSIZE refresh,

CodePudding user response:

reference 1st floor icoolno1 response:
WM_NCCALCSIZE refresh,
thank god first, then I searched a circle, as if can't find what practical things, a great god can help to guide how to refresh again? What articles or have links, to share, thank you thank

CodePudding user response:

 using System; 
Using System. Collections. Generic;
Using System.Com ponentModel;
using System.Data;
Using System. Drawing;
Using System. The Runtime. InteropServices;
Using System. The Text;
Using System. Windows. Forms;

The namespace TimingMonitor. Windows
{
Public partial class FormBase: Form
{
Const int HTLEFT=10;
Const int HTRIGHT=11;
Const int HTTOP=12;
Const int HTTOPLEFT=13;
Const int HTTOPRIGHT=14;
Const int HTBOTTOM=15;
Const int HTBOTTOMLEFT=0 x10;
Const int HTBOTTOMRIGHT=17;
Public FormBase ()
{
InitializeComponent();
}

Public bool ManualResize
{
The get
{
Return this. FormBorderStyle==System. Windows. Forms. FormBorderStyle. None
& & Enclosing WindowState==FormWindowState. Normal;
}
}

Protected override void WndProc (ref Message m)
{
The switch (m.M sg)
{
Case 0 x0084:
Base. WndProc (ref m);
If (ManualResize)
{
Point vPoint=new Point ((int) m.L Param & amp; 0 XFFFF,
(int) m.L Param & gt;> 16 & amp; 0 XFFFF);
VPoint=PointToClient (vPoint);
If (vPoint. X & lt;
=5)If (vPoint. Y & lt;
=5)M.R esult=(IntPtr) HTTOPLEFT;
Else if (vPoint. Y & gt;=ClientSize. Height - 5)
M.R esult=(IntPtr) HTBOTTOMLEFT;
The else m.R esult=(IntPtr) HTLEFT;
Else if (vPoint. X & gt;=ClientSize. Width - 5)
If (vPoint. Y & lt;
=5)M.R esult=(IntPtr) HTTOPRIGHT;
Else if (vPoint. Y & gt;=ClientSize. Height - 5)
M.R esult=(IntPtr) HTBOTTOMRIGHT;
The else m.R esult=(IntPtr) HTRIGHT;
Else if (vPoint. Y & lt;
=5)HTTOP m.R esult=(IntPtr);
Else if (vPoint. Y & gt;=ClientSize. Height - 5)
HTBOTTOM m.R esult=(IntPtr);
}
break;
Case 0 x0201://the left mouse button pressed message
If (ManualResize)
{
M.M sg=0 x00a1;//change the message to the client area by pressing the mouse
M.L Param=IntPtr. Zero;//the default value is
M. Param=new IntPtr (2);//the mouse over the title bar in
}
Base. WndProc (ref m);
break;
Default:
Try
{
Base. WndProc (ref m);
}
The catch (Exception) {}
break;
}
}

[DllImport (" user32. DLL)]
Public static extern bool ReleaseCapture ();
[DllImport (" user32. DLL)]
Public static extern bool SendMessage (IntPtr HWND, int wMsg, int wParam, int lParam);
Public const int WM_SYSCOMMAND=0 x0112;
Public const int SC_MOVE=0 xf010;
Public const int HTCAPTION=0 x0002;
}
}

CodePudding user response:

reference 1st floor icoolno1 response:
WM_NCCALCSIZE refresh,
great god code you look at the third floor, my main window, it inherited the FormBase

CodePudding user response:

reference 4th floor, this also not busy running no reply:
Quote: refer to 1st floor icoolno1 response:
WM_NCCALCSIZE refresh,
great god code you look at the third floor, my main window, inherited the FormBase


WndProc add try a judgment:

 
Case WM_NCCALCSIZE: {//0 x83
The Refresh ();
}
break;
  • Related