如何更改标签的字体大小 [英] How Do I Change The Font Size Of A Label

查看:224
本文介绍了如何更改标签的字体大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Helllo





我想改变标签的字体大小,它应该增加3倍,之后减少3倍而后台工作人员正在运行。

但它被绞死了我试图这样做。我尝试了许多其他的方法,但它没有完成。

谢谢你
这是我的代码





 公开  frmTest 
Dim i 作为 整数
Dim j 作为 整数 = 10
私有 Sub bgwTest_DoWork( ByVal sender 作为 System。对象 ByVal e As System.ComponentModel.DoWorkEventArgs)句柄 bgwTest.DoWork
对于 i = 0 100
' < span class =code-comment>执行耗时的操作并报告进度。

bgwTest.ReportProgress(i)

System.Threading.Thread。睡眠( 10

下一步

< span class =code-keyword>结束 Sub
私有 Sub btnStart_Click( ByVal sender As System。对象, ByVal e As System.EventArgs)句柄 btnStart.Click
Timer1.Interval = 100
Timer1.Start()
bgwTest.RunWorkerAsync()
结束 Sub
私人 Sub btnStop_Click( ByVal sender 作为系统。对象 ByVal e 正如 System.EventArgs)句柄 btnStop.Click
bgwTest.Dispose()
bgwTest.CancelAsync()
< span class =code-keyword> End Sub

Private Sub bgwTest_ProgressChanged( ByVal sender As 对象 ByVal e As System.ComponentModel.ProgressChangedEventArgs)< span class =code-keyword>句柄 bgwTest.ProgressChanged

pgbPrgrs.Value = e.ProgressPercentage
结束 Sub

私有 Sub bgwTest_RunWorkerCompleted( ByVal sender As Object ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs)句柄 bgwTest.RunWorkerCompleted
MsgBox( 完成
结束 Sub

私有 Sub frmTest_Load ( ByVal sender As System。 Object ByVal e As System.EventArgs)句柄 MyBase .Load
Control.CheckForIllegalCrossThreadCalls = False
lblTest.Text = progress

解决方案

尝试这些主题 -

http://www.daniweb.com/ software-development / vbnet / threads / 342586 / dinamically-change-font-size ...- on-runtine [ ^ ]

http://www.dreamincode.net/forums/topic/235308-changing-font-size/ [ ^ ]

Helllo


I want to change the font size of label like it should increase 3 times and after that decrease 3 times while the background worker is running.
But its getting hanged While I try to do this.I tried many other ways also but its not getting done.
Thank You
This is my code


Public Class frmTest
    Dim i As Integer
    Dim j As Integer = 10
    Private Sub bgwTest_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles bgwTest.DoWork
        For i = 0 To 100
            ' Perform a time consuming operation and report progress.

            bgwTest.ReportProgress(i)

            System.Threading.Thread.Sleep(10)

        Next

    End Sub
    Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click
        Timer1.Interval = 100
        Timer1.Start()
        bgwTest.RunWorkerAsync()
    End Sub
    Private Sub btnStop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStop.Click
        bgwTest.Dispose()
        bgwTest.CancelAsync()
    End Sub

    Private Sub bgwTest_ProgressChanged(ByVal sender As Object, ByVal e As System.ComponentModel.ProgressChangedEventArgs) Handles bgwTest.ProgressChanged

        pgbPrgrs.Value = e.ProgressPercentage
    End Sub

    Private Sub bgwTest_RunWorkerCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles bgwTest.RunWorkerCompleted
        MsgBox("Done")
    End Sub

    Private Sub frmTest_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Control.CheckForIllegalCrossThreadCalls = False
        lblTest.Text = "progress"

解决方案

Try these threads -
http://www.daniweb.com/software-development/vbnet/threads/342586/dinamically-change-font-size...-on-runtine[^]
http://www.dreamincode.net/forums/topic/235308-changing-font-size/[^]


这篇关于如何更改标签的字体大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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