PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
Maximise or show a window without giving it focus
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
Maximise or show a window without giving it focus
![]() |
Maximise or show a window without giving it focus |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Hi,
Is there a way of maximising a form without having it grab the window focus? Thanks |
|
|
|
#2 |
|
Guest
Posts: n/a
|
You have to use interop. Import the ShowWindow method from user32 and call
the method with the SW_SHOWNOAVTIVATE constant. [DllImport("User32.dll")] public extern static int ShowWindow( System.IntPtr hWnd, short cmdShow); [Flags()] public enum ShowWindow { SW_HIDE = 0, SW_SHOWNORMAL = 1, SW_NORMAL = 1, SW_SHOWMINIMIZED = 2, SW_SHOWMAXIMIZED = 3, SW_MAXIMIZE = 3, SW_SHOWNOACTIVATE = 4, SW_SHOW = 5, SW_MINIMIZE = 6, SW_SHOWMINNOACTIVE = 7, SW_SHOWNA = 8, SW_RESTORE = 9, SW_SHOWDEFAULT = 10, SW_FORCEMINIMIZE = 11, SW_MAX = 11 } The call below does the job ShowWindow(myWindow.Handle,(short)ShowWindow.SW_SHOWNOACTIVATE); -- Bob Powell [MVP] C#, System.Drawing Check out the GDI+ FAQ http://www.bobpowell.net/gdiplus_faq.htm Buy quality Windows Forms tools http://www.bobpowell.net/xray_tools.htm New Tips and Tricks include creating transparent controls and how to do double buffering. "PaulR" <robinsonpr@aol.com> wrote in message news:0a4c01c35680$c9317490$a401280a@phx.gbl... > Hi, > > Is there a way of maximising a form without having it > grab the window focus? > > Thanks |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

