當前位置: 首頁>>代碼示例>>VB.NET>>正文


VB.NET StringFormat.Trimming屬性代碼示例

本文整理匯總了VB.NET中System.Drawing.StringFormat.Trimming屬性的典型用法代碼示例。如果您正苦於以下問題:VB.NET StringFormat.Trimming屬性的具體用法?VB.NET StringFormat.Trimming怎麽用?VB.NET StringFormat.Trimming使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。


在下文中一共展示了StringFormat.Trimming屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。

示例1: ShowStringTrimming

Private Sub ShowStringTrimming(ByVal e As PaintEventArgs)

    Dim format1 As New StringFormat
    Dim quote As String = "Not everything that can be counted counts," & _
        " and not everything that counts can be counted."
    format1.Trimming = StringTrimming.EllipsisWord
    e.Graphics.DrawString(quote, Me.Font, Brushes.Black, _
        New RectangleF(10.0F, 10.0F, 90.0F, 50.0F), format1)
End Sub
開發者ID:VB.NET開發者,項目名稱:System.Drawing,代碼行數:9,代碼來源:StringFormat.Trimming

示例2: MainClass

' 導入命名空間
Imports System.Drawing.Drawing2D
Imports System
Imports System.Drawing.Text
Imports System.Drawing
Imports System.Windows.Forms
Imports System.Math

Public Class MainClass

   Shared Sub Main()
       Dim form1 As Form = New Form1()
       Application.Run(form1)
   End Sub 

End Class
 
Public Class Form1
    Inherits System.Windows.Forms.Form

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.ResizeRedraw = True
    End Sub

    Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
        Dim txt As String
        Dim the_font As New Font("Times New Roman", 30, FontStyle.Bold, GraphicsUnit.Pixel)
        Dim layout_rect As RectangleF
        e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit

        layout_rect = New RectangleF(100, 0, 180, 70)
        txt = "123456789012345678901234567890"

        Dim string_format As New StringFormat
        string_format.Trimming = StringTrimming.Character

        e.Graphics.DrawString(txt, the_font, Brushes.Black, layout_rect, string_format)
        e.Graphics.DrawRectangle(Pens.Black, Rectangle.Round(layout_rect))

    End Sub

End Class
開發者ID:VB程序員,項目名稱:System.Drawing,代碼行數:42,代碼來源:StringFormat.Trimming


注:本文中的System.Drawing.StringFormat.Trimming屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。