如果在"按钮列表"控件,如果2003中的Toolbar,里面有自带..
解决方案 »
- sqlserver2008 中的表值参数在ADO.NET中用IList如何传值
- 调出隐藏事件OnPaint的方法
- WPF中 ToggleButton的问题
- c#事件定义的问题(event关键字的功能)
- winform中关于GD+的问题!!
- 大家好,我问个菜鸟问题!
- 问一下关于软件中模块注册的问题
- 有关修改备注字段的问题,顶者有分
- 怎么把WINFORM上画的图像清除??
- 给你两个3和两个8,怎么算都可以,如何使结果为24?最先算出者得分!
- 怎么才能装我想装 Visual Studio .NET 2003来编C#呀?
- 急啊,请问如何统计网站的总访问量和今日访问量?高手们请帮忙,先谢了,在线等...
可这个图并不是
只是排列在一起
把我的源代码给你吧,这种按钮,随便绘制一下,效果就出来了。Imports System.ComponentModel
Imports System.Drawing.ColorTranslator
<System.ComponentModel.DefaultEvent("Click")> Public Class MyIMGButton
Enum State
[Default]
Down
MoveIn
End Enum Dim CurState As State
Dim BtnPic As Image = Nothing <Category("杂项"), Browsable(True), Description("背景图片")> Public Property Image() As Image
Get
Return BtnPic
End Get
Set(ByVal value As Image)
BtnPic = value
Invalidate()
End Set
End Property Private Sub MyIMGButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Click
CurState = State.Default
Invalidate()
End Sub Private Sub MyIMGButton_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LostFocus
CurState = State.Default
Invalidate()
End Sub Private Sub MyIMGButton_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
CurState = State.Down
Invalidate()
End Sub Private Sub MyIMGButton_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.MouseEnter
CurState = State.MoveIn
Invalidate()
End Sub Private Sub MyIMGButton_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.MouseLeave
CurState = State.Default
Invalidate()
End Sub Private Sub MyIMGButton_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
If Me.ClientRectangle.Contains(e.Location) = False Then
If Not CurState = State.Default Then
CurState = State.Default
Invalidate()
End If
Else
If Not e.Button = Windows.Forms.MouseButtons.None Then
If Not CurState = State.Down Then
CurState = State.Down
Invalidate()
End If
End If
End If
End Sub Private Sub MyIMGButton_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp
CurState = State.MoveIn
Invalidate()
End Sub Private Sub MyIMGButton_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
Dim MoveSize As Integer
If CurState = State.Down Then
MoveSize = 1
Else
MoveSize = 0
End If
If Not BtnPic Is Nothing Then
Dim Rect As System.Drawing.Rectangle
Rect.Location = New Point(CInt((Me.Width - BtnPic.Width) / 2 + MoveSize), CInt((Me.Height - BtnPic.Height) / 2 + MoveSize))
Rect.Size = New Size(BtnPic.Width, BtnPic.Height)
e.Graphics.DrawImage(BtnPic, Rect)
End If
Select Case CurState
Case State.Default
Case State.Down
e.Graphics.DrawLine(New Pen(FromHtml("#808080"), 1), New Point(0, 0), New Point(0, Me.Height - 1))
e.Graphics.DrawLine(New Pen(FromHtml("#808080"), 1), New Point(0, 0), New Point(Me.Width - 1, 0))
e.Graphics.DrawLine(New Pen(Color.White, 1), New Point(0, Me.Height - 1), New Point(Me.Width - 1, Me.Height - 1))
e.Graphics.DrawLine(New Pen(Color.White, 1), New Point(Me.Width - 1, 0), New Point(Me.Width - 1, Me.Height - 1))
Case State.MoveIn
e.Graphics.DrawLine(New Pen(Color.White, 1), New Point(0, 0), New Point(0, Me.Height - 1))
e.Graphics.DrawLine(New Pen(Color.White, 1), New Point(0, 0), New Point(Me.Width - 1, 0))
e.Graphics.DrawLine(New Pen(FromHtml("#808080"), 1), New Point(0, Me.Height - 1), New Point(Me.Width - 1, Me.Height - 1))
e.Graphics.DrawLine(New Pen(FromHtml("#808080"), 1), New Point(Me.Width - 1, 0), New Point(Me.Width - 1, Me.Height - 1))
End Select
End Sub
End Class============================================
技术交流不该有界限 资源共享不该有条件
http://blog.csdn.net/lovingkiss
http://download.csdn.net/user/lovingkiss
Email:loving-kiss@163.com
本人说明:<我的帖子我做主>
1、欢迎一切问题有关的交流——无论答案对错;
2、不欢迎 顶、Mark、支持之类口水混分的人;
我保留对非<散分贴>蹭分者的厌恶和鄙视...
============================================
技术交流不该有界限 资源共享不该有条件
http://blog.csdn.net/lovingkiss
http://download.csdn.net/user/lovingkiss
Email:loving-kiss@163.com
本人说明:<我的帖子我做主>
1、欢迎一切问题有关的交流——无论答案对错;
2、不欢迎 顶、Mark、支持之类口水混分的人;
我保留对非<散分贴>蹭分者的厌恶和鄙视...
============================================
单选radioButton的appearanc属性改为button就可以了
效果就是点一下陷下去
再点就突出来
具體哪個屬性你找一下就是了
{
if (this.button1.FlatStyle == FlatStyle.Popup)
{
this.button1.FlatStyle = FlatStyle.Standard;
}
else
{
this.button1.FlatStyle = FlatStyle.Popup;
}
}