精華區beta Visual_Basic 關於我們 聯絡資訊
※ 引述《patting (咖啡~香)》之銘言: : 請問 若想做兩個check box : 讓人點選 以更改label上的字型 : 可是必須保留之前label上原先的字型 : 例如 原先的字是 12點 red 細明體 : 想利用check box加上粗體 或斜體 或者兩者都選為粗斜體 : 該怎麼寫呢??? : 謝謝 你可以用一個 Sub 來控制:(VB.NET) ps. 請記得每一個checkbox都要宣告成Friend WithEvents ------------------------------------------------------------------- Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged, _ CheckBox2.CheckedChanged Dim str As String = CStr(CheckBox1.CheckState) + CStr(CheckBox2.CheckState) Dim FontStyle As New System.Drawing.FontStyle Select Case str Case "00" : FontStyle = FontStyle.Regular Case "01" : FontStyle = FontStyle.Italic Case "10" : FontStyle = FontStyle.Bold Case "11" : FontStyle = FontStyle.Bold Or FontStyle.Italic End Select With Label1 .Font = New System.Drawing.Font("細明體", 12.0!, FontStyle, _ System.Drawing.GraphicsUnit.Point, CType(136, Byte)) End With End Sub -- ﹏﹏﹏﹏﹏ ▁▆▅▄▆█▂ ︴︴︴︴︴ ◎▁▁█▁▁◎ ﹌ ﹌ \ / ╭ ╮ ︵ ︵ ∩ ∩ ︶ ︶ ︿ ╭ˍˍ╮ ╰╯ ╲╱ 喜 怒 哀 樂 collegeman. -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.59.31.47 ※ 編輯: collegeman 來自: 61.59.31.47 (05/30 19:08) ※ 編輯: collegeman 來自: 61.59.31.47 (05/30 19:09) ※ 編輯: collegeman 來自: 61.59.31.47 (05/30 19:11)