读书人

怎么禁止窗体的重绘?

发布时间: 2012-03-20 14:01:11 作者: rapoo

如何禁止窗体的重绘???

下面是C++代码,但是不知道如何在c#下使用。。。

禁止窗体重绘:
SendMessage(hWnd, WM_SETREDRAW, FALSE, 0L);
允许窗体重绘:
SendMessage(hWnd, WM_SETREDRAW, TRUE, 0L);


[解决办法]
一样的。

C#申明下API函数。然后就可以用了。
[解决办法]
[DllImport( "USER32.DLL ", CharSet=CharSet.Auto, SetLastError=true)]
public static extern bool SendMessage(
IntPtr hWnd, // handle to destination window
int Msg, // message
int wParam, // first message parameter
[MarshalAs(UnmanagedType.LPTStr)]StringBuilder lParam // second message parameter
);
const int WM_GETTEXT =0x000B;
const int FALSE = 0x0000;
const int TRUE = 0x0001;
SendMessage((IntPtr)this.Handle,WM_SETREDRAW,FALSE,0);

[解决办法]

C# code
[DllImport( "USER32.DLL ", CharSet=CharSet.Auto, SetLastError=true)]  public static extern bool SendMessage(  IntPtr hWnd, // handle to destination window  int Msg, // message  int wParam // first message parameter  );  const int WM_GETTEXT =0x000B; const int FALSE = 0x0000;const int TRUE = 0x0001;SendMessage((IntPtr)this.Handle,WM_SETREDRAW,FALSE,0);
[解决办法]
C# code
[DllImport( "USER32.DLL ", CharSet=CharSet.Auto, SetLastError=true)]  public static extern bool SendMessage(  IntPtr hWnd, // handle to destination window  int Msg, // message  int wParam, // first message parameter  int lParam);  const int WM_GETTEXT =0x000B; const int FALSE = 0x0000;const int TRUE = 0x0001;SendMessage((IntPtr)this.Handle,WM_SETREDRAW,FALSE,0);
[解决办法]
学习 学习
[解决办法]
牛人啊

读书人网 >C#

热点推荐