MultiLine Text Automatically Layout Demo : Text Layout « 2D « VB.Net

Home
VB.Net
1.2D
2.Application
3.Class
4.Data Structure
5.Data Types
6.Database ADO.net
7.Date Time
8.Development
9.Event
10.File Directory
11.Generics
12.GUI
13.Internationalization I18N
14.Language Basics
15.LINQ
16.Network Remote
17.Reflection
18.Security
19.Thread
20.Windows Presentation Foundation
21.Windows System
22.XML
23.XML LINQ
VB.Net Tutorial
VB.Net by API
VB.Net » 2D » Text LayoutScreenshots 
MultiLine Text Automatically Layout Demo
MultiLine Text Automatically Layout Demo

Imports System
Imports System.ComponentModel
Imports System.Windows.Forms
Imports System.Data
Imports System.Configuration
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Drawing.Text
Imports System.Globalization
Imports System.Text
Imports System.Collections

Public Class MainClass
    Shared Sub Main()
        Dim myform As Form = New MultiLineTextForm()
        Application.Run(myform)
    End Sub
End Class

Public Class MultiLineTextForm
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is NothingThen
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents groupBox1 As System.Windows.Forms.GroupBox
    Friend WithEvents automaticPanel As System.Windows.Forms.Panel
    <System.Diagnostics.DebuggerStepThrough()Private Sub InitializeComponent()
        Me.groupBox1 = New System.Windows.Forms.GroupBox()
        Me.automaticPanel = New System.Windows.Forms.Panel()
        Me.groupBox1.SuspendLayout()
        Me.SuspendLayout()

        Me.groupBox1.Controls.AddRange(New System.Windows.Forms.Control() {Me.automaticPanel})
        Me.groupBox1.Dock = System.Windows.Forms.DockStyle.Left
        Me.groupBox1.Font = New System.Drawing.Font("Microsoft Sans Serif"12.0!)
        Me.groupBox1.Name = "groupBox1"
        Me.groupBox1.Size = New System.Drawing.Size(152266)
        Me.groupBox1.TabIndex = 3
        Me.groupBox1.TabStop = False
        Me.groupBox1.Text = "Automatic"
        '
        'automaticPanel
        '
        Me.automaticPanel.BackColor = System.Drawing.Color.White
        Me.automaticPanel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me.automaticPanel.Dock = System.Windows.Forms.DockStyle.Fill
        Me.automaticPanel.Font = New System.Drawing.Font("Microsoft Sans Serif"12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.automaticPanel.Location = New System.Drawing.Point(331)
        Me.automaticPanel.Name = "automaticPanel"
        Me.automaticPanel.Size = New System.Drawing.Size(146232)
        Me.automaticPanel.TabIndex = 0
        '
        'MultiLineTextForm
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(513)
        Me.ClientSize = New System.Drawing.Size(162266)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.groupBox1})
        Me.Name = "MultiLineTextForm"
        Me.Text = "MultiLineTextForm"
        Me.groupBox1.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub

#End Region


    Dim As String = "Line 1" & vbCrLf & "Line 2" & vbCrLf & "Line 3" & vbCrLf & "Line 4" & vbCrLf & "Line 5" & vbCrLf & "Line 6"


    Private Sub automaticPanel_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgsHandles automaticPanel.Paint
        Dim As Graphics = e.Graphics
        Dim layoutRect As RectangleF = RectangleF.op_Implicit(automaticPanel.ClientRectangle)
        g.DrawString(s, Me.Font, Brushes.Black, layoutRect)
        Dim size As SizeF = g.MeasureString(s, Me.Font, layoutRect.Size)
        g.DrawRectangle(Pens.Black, 00, size.Width, size.Height)
    End Sub

    Private Sub manualPanel_Layout(ByVal sender As Object, ByVal e As System.Windows.Forms.LayoutEventArgsHandles automaticPanel.Layout
        Me.automaticPanel.Refresh()
    End Sub
End Class

           
       
Related examples in the same category
1.MultiLine Text Manual LayoutMultiLine Text Manual Layout
w_w__w.___j___a_v__a2__s___.___c_o__m__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.