Send me a PM and i send a Link !
Could you please send me a link. I would like to test out your buttons and maybe for the future use in one of my applications :].
A very good job done btw ! Thanks in advance for the share.
Id like this thanks :)
Message to short
Looks really good :) i wouldn't mind testing these on just a play-around project @OP!
i create a .gif for the demonstration of buttons "input" .
Jul 27, 2012 07:18 AM
(This post was last modified: Jul 27, 2012 07:19 AM by sh@rp.)
This control already exists in the "VistaControls" Library ( http://windowsformsaero.codeplex.com/). It's called "CommandLink Button" :
[img]http://imabox.fr/u19/1227071617WcAHv921.png[/img]
Code Imports System.ComponentModel
Imports System.Runtime.InteropServices
<ToolboxBitmap(GetType(Button))> _
Public Class CommandLink
Inherits Button
Public Sub New()
MyBase.FlatStyle = FlatStyle.System
End Sub
Private _icon As Icon
Private _image As Bitmap
Private _note As String = String.Empty
Private _showshield As Boolean
Private _useicon As Boolean = True
<DllImport("user32.dll", CharSet:=CharSet.Auto)> _
Private Shared Function SendMessage(ByVal hWnd As IntPtr, ByVal msg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As IntPtr
End Function
<Description("Refreshes the image displayed on the button.")> _
Public Sub SetImage()
Dim zero As IntPtr = IntPtr.Zero
If Not Me._useicon Then
If (Not Me._image Is Nothing) Then
zero = Me._image.GetHicon
End If
ElseIf (Not Me._icon Is Nothing) Then
zero = Me.Icon.Handle
End If
CommandLink.SendMessage(MyBase.Handle, NativeMethods.BM_SETIMAGE, 1, CInt(zero))
End Sub
<Description("Sets the note displayed on the button.")> _
Private Sub SetNote(ByVal NoteText As String)
NativeMethods.SendMessage(MyBase.Handle, NativeMethods.BCM_SETNOTE, IntPtr.Zero, NoteText)
End Sub
Public Sub SetShield(ByVal Value As Boolean)
NativeMethods.SendMessage(MyBase.Handle, NativeMethods.BCM_SETSHIELD, IntPtr.Zero, New IntPtr(If(Me._showshield, 1, 0)))
End Sub
Protected Overrides ReadOnly Property CreateParams As CreateParams
Get
Dim createParam As CreateParams = MyBase.CreateParams
createParam.Style = (createParam.Style Or 14)
Return createParam
End Get
End Property
<Category("Appearance"), Description("Gets or sets the icon that is displayed on a button control."), DefaultValue(CStr(Nothing))> _
Public Property Icon As Icon
Get
Return Me._icon
End Get
Set(ByVal value As Icon)
Me._icon = value
If (Not Me._icon Is Nothing) Then
Me._useicon = True
End If
Me.SetShield(False)
Me.SetImage()
End Set
End Property
<Category("Appearance"), Description("Gets or sets the image that is displayed on a button control."), DefaultValue(CStr(Nothing))> _
Public Overloads Property Image As Bitmap
Get
Return Me._image
End Get
Set(ByVal value As Bitmap)
Me._image = value
If (Not value Is Nothing) Then
Me._useicon = False
Me.Icon = Nothing
End If
Me.SetShield(False)
Me.SetImage()
End Set
End Property
<Description("Gets or sets the note that is displayed on a button control."), Category("Appearance"), DefaultValue("")> _
Public Property Note As String
Get
Return Me._note
End Get
Set(ByVal value As String)
Me._note = value
Me.SetNote(Me._note)
End Set
End Property
<Description("Gets or sets whether if the control should use an elevated shield icon."), DefaultValue(False), Category("Appearance")> _
Public Property ShowShield As Boolean
Get
Return Me._showshield
End Get
Set(ByVal value As Boolean)
Me._showshield = value
Me.SetShield(value)
If Not value Then
Me.SetImage()
End If
End Set
End Property
End Class
Friend Class NativeMethods
<DllImport("user32.dll", CharSet:=CharSet.Unicode)> _
Public Shared Function SendMessage(ByVal hWnd As IntPtr, ByVal Msg As UInt32, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
End Function
Public Const BCM_SETNOTE As Integer = 5641
Public Const BCM_SETSHIELD As Integer = 5644
Public Const BM_SETIMAGE As Integer = 247
End Class
A+
Ah merci ekinox :)
Merci beaucoup
Cordialement
Paradisiac
They looks cool, i don't really understand the PM feature, but can you send me this? Buttons looks better than the "command link" of "Vista Controls". Thank you.
Jul 28, 2012 12:37 AM
(This post was last modified: Jul 28, 2012 12:41 AM by sh@rp.)
(Jul 27, 2012 03:44 PM)P4R4DiSi4C Wrote: Ah merci ekinox :)
Merci beaucoup
Cordialement
Paradisiac
This is not a french board ! Please write your answers in English according of the rules.
Cordially.
(Jul 27, 2012 03:59 PM)Gr0wlit Wrote: They looks cool, i don't really understand the PM feature, but can you send me this? Buttons looks better than the "command link" of "Vista Controls". Thank you.
The Vista commandLink button has an image property that you can modify and add your own. Not reallly hard to set.😉
Hey Ekin0x can you send me its soource.
(Jul 28, 2012 12:37 AM)sh@rp Wrote: The Vista commandLink button has an image property that you can modify and add your own. Not reallly hard to set.😉
But with Ekin0x his buttons this is also possible if you even had a look into it you would see?
(Jul 28, 2012 05:00 AM)Jeff. Wrote: But with Ekin0x his buttons this is also possible if you even had a look into it you would see?
No need to look I know that he has the same property ... That's why it's unnecessary to provide the same control. What's really the difference ?
He has the choice beetween different Icon in the property grid ?
NO ! Ok it's the same. This is not a creation but a copy/paste from..
Hey, this looks rly nice, may i get it? :d
looks nice, may i have it please? :D
Would love to get this, thanks! Good job!
|