Results 1 to 5 of 5

Thread: System Tray

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2001
    Location
    Kolkata, India
    Posts
    2

    System Tray

    How can I add system tray button in Titlebar?

  2. #2

    Thread Starter
    New Member
    Join Date
    May 2001
    Location
    Kolkata, India
    Posts
    2
    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.

  3. #3
    Frenzied Member MerrionComputin's Avatar
    Join Date
    Apr 2001
    Location
    Dublin, Ireland
    Posts
    1,616
    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
    ----8<---------------------------------------
    NEW - The .NET printer queue monitor component
    ----8<---------------------------------------
    Now with Examples of use

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    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.

  5. #5
    Frenzied Member MerrionComputin's Avatar
    Join Date
    Apr 2001
    Location
    Dublin, Ireland
    Posts
    1,616
    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
    ----8<---------------------------------------
    NEW - The .NET printer queue monitor component
    ----8<---------------------------------------
    Now with Examples of use

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width