本文整理汇总了VB.NET中System.Drawing.Font类的典型用法代码示例。如果您正苦于以下问题:VB.NET Font类的具体用法?VB.NET Font怎么用?VB.NET Font使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Font类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的VB.NET代码示例。
示例1: CType
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
' Cast the sender object back to a ComboBox.
Dim ComboBox1 As ComboBox = CType(sender, ComboBox)
' Retrieve the selected item.
Dim selectedString As String = CType(ComboBox1.SelectedItem, String)
' Convert it to lowercase.
selectedString = selectedString.ToLower()
' Declare the current size.
Dim currentSize As Single
' Switch on the selected item.
Select Case selectedString
' If Bigger is selected, get the current size from the
' Size property and increase it. Reset the font to the
' new size, using the current unit.
Case "bigger"
currentSize = Label1.Font.Size
currentSize += 2.0F
Label1.Font = New Font(Label1.Font.Name, currentSize, _
Label1.Font.Style, Label1.Font.Unit)
' If Smaller is selected, get the current size, in points,
' and decrease it by 1. Reset the font with the new size
' in points.
Case "smaller"
currentSize = Label1.Font.SizeInPoints
currentSize -= 1
Label1.Font = New Font(Label1.Font.Name, currentSize, _
Label1.Font.Style)
End Select
End Sub
开发者ID:VB.NET开发者,项目名称:System.Drawing,代码行数:37,代码来源:Font
示例2: New Font(String name, Int size,FontStyle textStyle)
' 导入命名空间
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Windows.Forms
public class FontStyleCreate
public Shared Sub Main
Application.Run(New Form1)
End Sub
End class
Public Class Form1
Inherits System.Windows.Forms.Form
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
Dim canvas As Graphics = e.Graphics
Dim mainFont As Font
Dim textStyle As New FontStyle
textStyle = FontStyle.Regular
mainFont = New Font("Arial", 40, textStyle)
Dim brush1 As New SolidBrush(Color.DarkBlue)
canvas.DrawString("www.java2s.com",mainFont, brush1, 120, 70)
canvas = Nothing
End Sub
End Class
开发者ID:VB程序员,项目名称:System.Drawing,代码行数:28,代码来源:Font
注:本文中的System.Drawing.Font类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论