Custom Controlbox 
Author Message
 Custom Controlbox

I'm trying to add another button to the top of my forms along with the
"minimize, maximize, restore" buttons to have the form appear to roll up and
only show the title bar.  I can make the form borderless, not visible etc.
but can't figure out how to add the additional button to the top of the
form.  I know I probably have to draw a button myself or draw the entire
caption bar myself with a borderless form and then handle the move events
with the mouse etc.  I'm quite lost as to the draw methods though.
Does anyone have any sample code of anything similar or know where there
is a similar sample?  I have looked through all of TechNet and MSDN
(in what I thought were relevant categories) and found nothing.

Thanks...Gene



Fri, 19 Aug 2005 03:58:27 GMT  
 Custom Controlbox
Hi, well yes, you're right, you have to draw the button yourself, and hence
compensate for XP themes, system colours, etc. What you need to look into is
overriding the WndProc sub in your form, then responding to the WM_NCPAINT
message. A typical response being to draw your button. To respond to a
click, you'll have to respond to WM_NC?BUTTON???, where ? is the button (ie,
L for left, M for middle or R for right) and where ??? is UP, DOWN or
DBLCLK.

--
==============================================
Happy To Help,
Tom Spink

http://dotnetx.betasafe.com >> VB, VB.NET, C#, C++ Code

Please respond to the newsgroups, so all can benefit.

One day

Quote:
> I'm trying to add another button to the top of my forms along with the
> "minimize, maximize, restore" buttons to have the form appear to roll up
and
> only show the title bar.  I can make the form borderless, not visible etc.
> but can't figure out how to add the additional button to the top of the
> form.  I know I probably have to draw a button myself or draw the entire
> caption bar myself with a borderless form and then handle the move events
> with the mouse etc.  I'm quite lost as to the draw methods though.
> Does anyone have any sample code of anything similar or know where there
> is a similar sample?  I have looked through all of TechNet and MSDN
> (in what I thought were relevant categories) and found nothing.

> Thanks...Gene



Fri, 19 Aug 2005 04:02:31 GMT  
 Custom Controlbox
I'm trying to add another button to the top of my forms along with the
"minimize, maximize, restore" buttons to have the form appear to roll up and
only show the title bar.  I can make the form borderless, not visible etc.
but can't figure out how to add the additional button to the top of the
form.  I know I probably have to draw a button myself or draw the entire
caption bar myself with a borderless form and then handle the move events
with the mouse etc.  I'm quite lost as to the draw methods though.
Does anyone have any sample code of anything similar or know where there
is a similar sample?  I have looked through all of TechNet and MSDN
(in what I thought were relevant categories) and found nothing.

Thanks...Gene



Fri, 19 Aug 2005 04:16:26 GMT  
 Custom Controlbox
Hello Gene,


Quote:
> I'm trying to add another button to the top of my forms along with the
> "minimize, maximize, restore" buttons to have the form appear to roll
up and
> only show the title bar.  I can make the form borderless, not visible
etc.
> but can't figure out how to add the additional button to the top of
the
> form.  I know I probably have to draw a button myself or draw the
entire
> caption bar myself with a borderless form and then handle the move
events
> with the mouse etc.  I'm quite lost as to the draw methods though.
> Does anyone have any sample code of anything similar or know where
there
> is a similar sample?  I have looked through all of TechNet and MSDN
> (in what I thought were relevant categories) and found nothing.

Read the posting by Tom. For P/Invoke for drawing the buttons with
Visual Styles have a look at (VB6):

http://www.vbaccelerator.com/home/VB/Code/Libraries/XP_Visual_Styles/Dra
wing_with_XP_Visual_Styles/article.asp
(look for wrapping)

Regards,
Herfried K. Wagner



Fri, 19 Aug 2005 08:53:19 GMT  
 Custom Controlbox
thanks guys, I think this will help.



Quote:
> Hello Gene,


> > I'm trying to add another button to the top of my forms along with the
> > "minimize, maximize, restore" buttons to have the form appear to roll
> up and
> > only show the title bar.  I can make the form borderless, not visible
> etc.
> > but can't figure out how to add the additional button to the top of
> the
> > form.  I know I probably have to draw a button myself or draw the
> entire
> > caption bar myself with a borderless form and then handle the move
> events
> > with the mouse etc.  I'm quite lost as to the draw methods though.
> > Does anyone have any sample code of anything similar or know where
> there
> > is a similar sample?  I have looked through all of TechNet and MSDN
> > (in what I thought were relevant categories) and found nothing.

> Read the posting by Tom. For P/Invoke for drawing the buttons with
> Visual Styles have a look at (VB6):

> http://www.vbaccelerator.com/home/VB/Code/Libraries/XP_Visual_Styles/Dra
> wing_with_XP_Visual_Styles/article.asp
> (look for wrapping)

> Regards,
> Herfried K. Wagner



Fri, 19 Aug 2005 09:01:49 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. create custom icon,custom combobox in custom toolbar

2. create custom icon,custom combobox(to insert values)in custom toolbar

3. How to disable Word's controlbox?

4. How to disable Word's controlbox?

5. ControlBox Property

6. Disable the ControlBox (Window CloseButton)

7. What is the difference closing a form with Unload and ControlBox

8. Form ControlBox property

9. form controlbox ?

10. How to Attach Code to the Controlbox Commands

11. controlbox menu

12. ControlBox (Window CloseButton)

 

 
Powered by phpBB® Forum Software