Results 1 to 11 of 11

Thread: [RESOLVED] [2005] titlebar buttons

  1. #1

    Thread Starter
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,422

    Resolved [RESOLVED] [2005] titlebar buttons

    how can i put a button in my forms titlebars (similar to context help buttons)?

  2. #2
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628

    Re: [2005] titlebar buttons

    impossible. You have to cheat and make a 2nd form the size of a button and keep it in place with a timer.

    OR i suppose you could paint over it a fake button the way aol used to and detect via subclassing where on the title bar it was clicked and if it is clicked on your fake button it runs your code
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

  3. #3
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

  4. #4

    Thread Starter
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,422

    Re: [2005] titlebar buttons

    thanks. i'd already found that 1
    i was hoping there might be an easier way to do it

  5. #5
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [2005] titlebar buttons

    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  6. #6

    Thread Starter
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,422

    Re: [2005] titlebar buttons

    isn't there a way to do it using ModifyStyleEx API

  7. #7
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] titlebar buttons

    Quote Originally Posted by .paul.
    isn't there a way to do it using ModifyStyleEx API
    No there isn't. ModifyStyleEx lets you specify that a help button should be displayed but that's because that is standard Windows behaviour. As such you can display that button using managed code. If you just want your own button for your own purpose then there's hardly going to be a Windows constant declared for your button specifically like there is for a help button. What you're asking for is possible but very non-standard. As such the code to achieve it is more than a few lines.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  8. #8
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] titlebar buttons

    Also, ModifyStyleEx is not a standard Windows API function as far as I can tell. It's a member of various MFC classes so if you're not building an MFC app then you have no access to the function.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  9. #9

    Thread Starter
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,422

    Re: [2005] titlebar buttons

    i've just finished converting someones c# example for this.
    i'll try to work it out later.
    thanks

  10. #10
    PowerPoster sparrow1's Avatar
    Join Date
    May 2005
    Location
    Globetrotter
    Posts
    2,820

    Re: [2005] titlebar buttons

    Hi,

    Why not just draw your own titlebar and buttons:

    Code:
    Public Class Form1
    
    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    
    Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None
    
    End Sub
    
    Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
    
    Dim g As Graphics = e.Graphics
    
    Dim rect As New Rectangle(0, 0, Me.Width, 25)
    
    Dim backbrush As New Drawing.Drawing2D.LinearGradientBrush(rect, Color.Blue, Color.White, Drawing2D.LinearGradientMode.Vertical)
    
    g.DrawRectangle(Pens.Blue, rect)
    
    g.FillRectangle(backbrush, rect)
    
    End Sub
    
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    
    Me.Close()
    
    End Sub
    
    End Class
    Wkr,

    sparrow1
    Wkr,
    sparrow1

    If I helped you, don't forget to Rate my post. Thank you

    I'm using Visual Studio.Net 2003 and
    2005
    How to learn VB.Net Create setup with VB 2005 Drawing for beginners VB.Net Tutorials GDI+ Tutorials
    Video's for beginners

  11. #11

    Thread Starter
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,422

    Re: [2005] titlebar buttons

    no thanks sparrow.
    i'll use the API method

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