Solved

Add button to title bar using VB.NET

Posted on 2003-11-27
11
1,215 Views
Last Modified: 2010-05-18
I'm programming using VB.NET and I want to add a minimize button to the title bar of my toolbox styled window. Ideas anyone?
0
Comment
Question by:HappyParrot
11 Comments
 
LVL 18

Accepted Solution

by:
testn earned 125 total points
ID: 9831360
0
 
LVL 2

Author Comment

by:HappyParrot
ID: 9831935
tnx, but thas is good for drawing up there... what I need is to place a window control and bind it to onClick event (well the binding part I can manage with the Addhandler, but the placing part is much more problematic for me)
0
 
LVL 2

Author Comment

by:HappyParrot
ID: 9832344
I've found a way to draw the button it self up there in the title bar using the API function DrawFrameControl, the problem with function is that I lose all the window theming like rounded borders and colored buttons, the good thing is that I can set the function to draw any system button I want (minimize, close ets...) May be there is a newer version of that function? Please ,somebody, give me a hint here...
0
 
LVL 2

Author Comment

by:HappyParrot
ID: 9832348
I've incresed the value of the question to 250 pts.
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 9833640
i know its ugly but in my app i just made a label on the upper right corner of the form (under the toolbar) and did WindowState = VBMinimimized by the click event
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 2

Author Comment

by:HappyParrot
ID: 9834011
I thought of it already and also about placing a bitmap and changing it in response to mouseover, mouseout, ets... I'll have problem here if user uses a different theme for his window that the standard blue one - it will look really agly :/
0
 
LVL 1

Expert Comment

by:nhuanvn
ID: 9837307
So why don't you put a label with a background color depending on window's theme ?
0
 
LVL 2

Author Comment

by:HappyParrot
ID: 9837335
I could simply draw a white rectangle with rounded corners using the drawregion method and then draw the small line, but then I will need to apply masks to show the mouseover state and mousedown state, but I want it to look like a XP button... so it won't work... Have you seen Photoshop toolbox windows? This is the effect I'm looking for.
0
 
LVL 2

Author Comment

by:HappyParrot
ID: 9843187
Ok, I ended up creating my own class for that minimize button, handlling all it's draw events and using overloaded version of WndProc to respond to all the possible user input on that button (mouseover, mousedown ets)... At least I have now a class I can reuse and basicaly create any button I want in XP style.
All the drawing done in GDI+ with no bitmaps, for speed.
0
 
LVL 2

Author Comment

by:HappyParrot
ID: 9843202
I'll award [b]testn[/b] with the original 125 pts. for the partial answer
Thank you.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

912 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now