如何使按钮保持与单击时相同的方式 [英] how to make a button stay the same way like when you click it

查看:83
本文介绍了如何使按钮保持与单击时相同的方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在用编程语言Visual Basic构建按钮类
我只需要编码方面的帮助
到目前为止,我有一些看起来像这样的东西

hey
am building a button class in the programming language visual basic
i just need some help with the coding
so far i have something that looks like this

Imports System.Drawing
Public Class YOUR CLASS NAME
    Inherits Windows.Forms.Button
    Public Sub New()
        Me.Size = New Point(32, 32)
        Me.FlatStyle = Windows.Forms.FlatStyle.Flat
        Me.FlatAppearance.BorderSize = 0
        Me.FlatAppearance.BorderColor = System.Drawing.Color.Gray
        Me.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Transparent
        Me.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Transparent
        Me.BackColor = System.Drawing.Color.Transparent
        Me.BackgroundImage = My.Resources.YOUR NORMAL IMAGE
        Me.BackgroundImageLayout = Windows.Forms.ImageLayout.Stretch
        Me.Font = New System.Drawing.Font("Tahoma", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
    End Sub
Private Sub Backbutton_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
        Me.BackgroundImage  My.Resources = your mouse click the image
    End Sub
 Private Sub Backbutton_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.MouseEnter
        Me.BackgroundImage = My.Resources.YOUR MOUSE ON IMAGE
    End Sub
Private Sub Backbutton_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.MouseLeave
        Me.BackgroundImage = My.Resources.YOUR NORMAL IMAGE
    End Sub
Private Sub Backbutton_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp
        Me.BackgroundImage = My.Resources.YOUR MOUSE ON IMAGE
    End Sub
End Class



我希望它的按钮像Me.BackgroundImage My.Resources =鼠标单击图像,或者只是当您单击图像时才希望它保持这种方式

在此先感谢



and i want it the button to be like Me.BackgroundImage My.Resources = your mouse click the image or just simply when u click it just want it to stay this way

thanks in advance

推荐答案

您看过以下这些吗:
具有渐变色和额外图像的自定义按钮控件(VB.NET) [ ^ ]
自定义按钮-焦点边框,文本颜色等问题 [ ^ ]
具有颜色和形状的自定义按钮 [ DiamondControl-具有MouseOver效果的自定义按钮 [ ^ ]

顺便说一句:不要重新发布!
Have you seen these:
Custom Button Control with Gradient Colors and Extra Image (VB.NET)[^]
Custom Button - Issues with Focus Border, Text Color, etc.[^]
Custom Button with Color and Shape[^]
DiamondControl - A custom button with MouseOver effects[^]

By the way: do not repost!


这篇关于如何使按钮保持与单击时相同的方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆