|
-
Mar 5th, 2002, 10:17 AM
#1
Thread Starter
New Member
System Tray
How can I add system tray button in Titlebar?
-
Mar 6th, 2002, 02:20 AM
#2
Thread Starter
New Member
I want to add an extra button in titlebar other than min,max,close which will act as system tray button. Just like All API.Net window.
-
Mar 6th, 2002, 03:55 AM
#3
Frenzied Member
I think you'd need to subclass your form and intercept the WM_NCPAINT messages. Then draw all the buttons in their appropriate states...to draw the outline of the button use the DrawFrameRect API call.
HTH,
Duncan
-
Mar 6th, 2002, 07:01 AM
#4
You can do it without subclassing, but you would have to create your own titlebar using either a label or a picture box or something like that. In this case, you would have to set the ControlBox to False which means you would lose your Min, Max, and Close button.
-
Mar 6th, 2002, 04:19 PM
#5
Frenzied Member
If you are going to draw the caption bar yourself, you would be better to use the DrawFrameControl API call.
Code:
'\\ Declarations
Private Enum enDrawFrameControlTypes
DFC_CAPTION = 1
DFC_MENU = 2
DFC_SCROLL = 3
DFC_BUTTON = 4
DFC_POPUPMENU = 5
End Enum
Public Enum enDrawFrameCaption
DFCS_CAPTIONCLOSE = &H0
DFCS_CAPTIONMIN = &H1
DFCS_CAPTIONMAX = &H2
DFCS_CAPTIONRESTORE = &H3
DFCS_CAPTIONHELP = &H4
End Enum
Private Declare Function DrawFrameControlApi Lib "user32" Alias "DrawFrameControl" (ByVal hdc As Long, lpRect As RECT, ByVal un1 As Long, ByVal un2 As Long) As Long
Which is used thus:
Code:
Private Sub DrawFrameCaption(ByVal RectIn As Rect, ByVal CaptionStyle As enDrawFrameCaption)
Call DrawFrameControl(RectIn, DFC_CAPTION, CaptionStyle)
End Sub
HTH,
Duncan
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|