vb.net渐变画笔 winform渐变色
VB.net或C#.net 做按钮动态渐变
我是新手,仅谈谈我的理解,按钮的MouseEnter与MouseLeave事件就可以解决,需要这么复杂吗?
为磴口等地区用户提供了全套网页设计制作服务,及磴口网站建设行业解决方案。主营业务为成都网站制作、成都做网站、外贸营销网站建设、磴口网站设计,以传统方式定制建设网站,并提供域名空间备案等一条龙服务,秉承以专业、用心的态度为用户提供真诚的服务。我们深信只要达到每一位用户的要求,就会得到认可,从而选择与我们长期合作。这样,我们也可以走得更远!
比如当鼠标移入按钮(Button1)时,按钮的字体变色(假如变为红色)可以写为(MouseEnter事件):
Button1.Forecolor=color.red;
当鼠标移出,字体颜色变回去(假如本来是黄色)(MouseLeave事件):
Button1.Forecolor=color.yellow;
如要做高级的动态变化,估计添加timer进来,写Timer的Tick事件,比如Tmier每Tick一次,按钮的红色就加5,同时设置按钮的Tick间距。
VB.NET 下给Listbox 添加图片或者渐变背景。
在普通window应用程序中的背景是不能有ALPHA通道的
既然是.net,试试用WPF窗体吧:
Listbox1.Background=New SolidBrush(Color.FromARGB(200,0,0,0))
当然你要是了解.net的笔刷类,绘制复杂的背景也不成问题
VB.NET怎么在屏幕上画一个逐渐变大的空心圈?
在窗体上拉一个Timer控件,enabled设为true,Interval设为20。完整代码如下: Dim myPen As New System.Drawing.Pen(System.Drawing.Color.Red)
Dim formGraphics As System.Drawing.Graphics
Dim num As Integer = 1
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Me.Refresh() '清屏
formGraphics = Me.CreateGraphics()
formGraphics.DrawEllipse(myPen, New Rectangle(100, 100, num, num)) '在坐标(100,100)的位置画圆
If num 200 Then '如果大于200则停止画圆
myPen.Dispose()
formGraphics.Dispose()
Timer1.Enabled = False
Else
num = num + 1
End If
End Sub
vb.net 如何使文字能渐变颜色,就是颜色慢慢变淡然后在慢慢恢复?
也容易,如果是黑白三个颜色加上相同的渐变量,彩色的是起始颜色的三个分量与终止颜色的对应三个分量的差值,再除于相同的份数,就得出三原色各自的步进量。
窗体上放个图片框试试下面代码:
Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint
Dim startColor As Color = Color.Red
Dim endColor As Color = Color.Green
Dim s As String = "vb.net 如何使文字能渐变颜色,就是颜色慢慢变淡然后在慢慢恢复?"
Dim Steps As Integer = s.Length \ 2
Dim StepR As Integer = (CInt(endColor.R) - startColor.R) \ Steps
Dim StepG As Integer = (CInt(endColor.G) - startColor.G) \ Steps
Dim StepB As Integer = (CInt(endColor.B) - startColor.B) \ Steps
Dim R As Integer = startColor.R
Dim G As Integer = startColor.G
Dim B As Integer = startColor.B
Dim drawFont As New System.Drawing.Font("Arial", 16)
Dim X As Integer = 50
For i As Integer = 1 To Steps
Dim drawBrush As New SolidBrush(Color.FromArgb(R, G, B))
e.Graphics.DrawString(s.Substring(i - 1, 1), drawFont, drawBrush, X, 50.0)
X += 18
R += StepR
G += StepG
B += StepB
Next
For i As Integer = 1 To Steps
Dim drawBrush As New SolidBrush(Color.FromArgb(R, G, B))
e.Graphics.DrawString(s.Substring(i + Steps - 1, 1), drawFont, drawBrush, X, 50.0)
X += 18
R -= StepR
G -= StepG
B -= StepB
Next
End Sub
本文题目:vb.net渐变画笔 winform渐变色
链接地址:http://myzitong.com/article/dogsggo.html