|
-
Jun 10th, 2007, 11:56 PM
#1
[RESOLVED] [2005] titlebar buttons
how can i put a button in my forms titlebars (similar to context help buttons)?
-
Jun 11th, 2007, 12:45 AM
#2
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
-
Jun 11th, 2007, 12:50 AM
#3
Re: [2005] titlebar buttons
-
Jun 11th, 2007, 12:57 AM
#4
Re: [2005] titlebar buttons
thanks. i'd already found that 1
i was hoping there might be an easier way to do it
-
Jun 11th, 2007, 01:25 AM
#5
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 Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API 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 
-
Jun 11th, 2007, 01:39 AM
#6
Re: [2005] titlebar buttons
isn't there a way to do it using ModifyStyleEx API
-
Jun 11th, 2007, 02:05 AM
#7
Re: [2005] titlebar buttons
 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.
-
Jun 11th, 2007, 02:08 AM
#8
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.
-
Jun 11th, 2007, 02:16 AM
#9
Re: [2005] titlebar buttons
i've just finished converting someones c# example for this.
i'll try to work it out later.
thanks
-
Jun 11th, 2007, 02:51 AM
#10
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
-
Jun 11th, 2007, 03:43 AM
#11
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|