你可以在窗体上放一个lable控件,取名叫lable1,
十年的东宁网站建设经验,针对设计、前端、开发、售后、文案、推广等六对一服务,响应快,48小时及时工作处理。成都营销网站建设的优势是能够根据用户设备显示端的尺寸不同,自动调整东宁建站的显示方式,使网站能够适用不同显示终端,在浏览器中调整网站的宽度,无论在任何一种浏览器上浏览网站,都能展现优雅布局与设计,从而大程度地提升浏览体验。创新互联从事“东宁网站设计”,“东宁网站推广”以来,每个客户项目都认真落实执行。
那么实现方式就是:
private
sub
form_load()
lable1.text="今天天气很好";
end
sub
你可以试试
也容易,如果是黑白三个颜色加上相同的渐变量,彩色的是起始颜色的三个分量与终止颜色的对应三个分量的差值,再除于相同的份数,就得出三原色各自的步进量。
窗体上放个图片框试试下面代码:
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的Timer控件,程序员可以轻松的在窗体上实现闪烁文字的效果。本文将演示如何为Label控件加上闪烁效果,这种方法同样适用于其它多种控件。以下代码可以完成检验ForeColor属性的任务: Private Sub Timer1_Timer() If Label1.ForeColor = Label1.BackColor Then Label1.ForeColor = vbBlack Else Label1.ForeColor = Label1.BackColor End If End Sub 另外,你也可以让文字采用不同的颜色,比如交替采用红色和绿色: Private Sub Timer1_Timer() If Label1.ForeColor = vbRed Then Label1.ForeColor = vbGreen Else Label1.ForeColor = vbRed End If End Sub 当你停止文字闪烁时,还要确定文字的状态是可见的并且采用了合适的色彩。