drawing a caption close button

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

i need to draw a close button within my tabbed MDI application. (i'm using c# with windows forms app)

i tried using ControlPaint.DrawCaptionButton(), this lead to 2 problems. 1) i couldnt get the button to paint using windows xp styles so it would be red etc. 2) ButtonState.* doesnt seem to support a hover state, which i use in all my other buttons.

so, my question is, how do i make my own button which emulates the caption close button using windows xp styles?

tyia
 
You have to use the UXTheme.dll functions. In this case you must use the DrawThemeBackground function and use the themed control BUTTON and choose the correct part state. You must handle yourself all the hover, pressed, etc states and do the redrawing...

Look on MSDN after the DrawThemeBackground function and you will find some details on how to use it there...
 
* "=?Utf-8?B?SXVsaWFuIElvbmVzY3U=?= said:
You have to use the UXTheme.dll functions. In this case you must use the DrawThemeBackground function and use the themed control BUTTON and choose the correct part state. You must handle yourself all the hover, pressed, etc states and do the redrawing...

Look on MSDN after the DrawThemeBackground function and you will find some details on how to use it there...

An interesting sample (VB Classic, but still useful):

<http://vbaccelerator.com/article.asp?id=4091>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top