下面是C++代码,但是不知道如何在c#下使用禁止窗体重绘:
SendMessage(hWnd, WM_SETREDRAW, FALSE, 0L);
允许窗体重绘:
SendMessage(hWnd, WM_SETREDRAW, TRUE, 0L);

解决方案 »

  1.   

    一样的。C#申明下API函数。然后就可以用了。
      

  2.   

    [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);
      

  3.   


    [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);
      

  4.   


    [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);