Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / February 2008

Tip: Looking for answers? Try searching our database.

forcing parent window's title bar to remain active

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
rory.groves@gmail.com - 10 Feb 2008 18:33 GMT
I would like to force the parent window's title bar to paint as Active
when a tool window is active.

Here is my code:

       public const int WM_NCACTIVATE = 0x086;

       protected override void WndProc(ref
System.Windows.Forms.Message m)
       {
           if (m.Msg == WM_NCACTIVATE)
           {
               if (m.WParam == IntPtr.Zero)
               {
                   InteropUtility.SendMessageW(this.Handle,
WM_NCACTIVATE,
                       new IntPtr(1), IntPtr.Zero);

                   return;
               }
           }
           base.WndProc(ref m);
       }

So far, i have only been able to achieve the following results:

a) parent window stays active (though painting in W2K style with no XP
theme) but child window _never becomes active_ and therefore is
unusable

b) child window can be made active but parent window always reverts to
Inactive
Marc Gravell - 10 Feb 2008 22:47 GMT
> I would like to force the parent window's title bar to paint as Active
> when a tool window is active.

You're fighting the OS; if the tool window is active, then the parent
*isn't* active.

What is it you actually want to do here? For instance, it sounds like
you might want "parent.AddOwnedWindow(child);" or similar; this allows
the two forms to show non-modally (i.e. both can be used), but the OS
treats them as a single entity with regards to focus, minimise, etc
(typical for "find" dialogs, etc).

Marc
rory.groves@gmail.com - 11 Feb 2008 03:59 GMT
Thanks for the response.

Take a look at any graphics editors (PhotoShop, Paint.Net). They allow
both tool windows and parent windows to appear "activated".

Paint.Net is entirely written in c#, so i know its possible.

Alreading using the "Owner" property, but it still deactivates the
parent window.

> > I would like to force the parent window's title bar to paint as Active
> > when a tool window is active.
[quoted text clipped - 9 lines]
>
> Marc

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.