Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Windows.Forms
public class Font3D
public Shared Sub Main
Application.Run(New Form1)
End Sub
End class
Public Class Form1
Inherits System.Windows.Forms.Form
Public Sub New()
MyBase.New()
InitializeComponent()
End Sub
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
Private components As System.ComponentModel.IContainer
Friend WithEvents TrackBar1 As System.Windows.Forms.TrackBar
Friend WithEvents Panel1 As System.Windows.Forms.Panel
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button3 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents Button4 As System.Windows.Forms.Button
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents Button5 As System.Windows.Forms.Button
Friend WithEvents ColorDialog1 As System.Windows.Forms.ColorDialog
Friend WithEvents FontDialog1 As System.Windows.Forms.FontDialog
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.TrackBar1 = New System.Windows.Forms.TrackBar
Me.Panel1 = New System.Windows.Forms.Panel
Me.Button1 = New System.Windows.Forms.Button
Me.Button3 = New System.Windows.Forms.Button
Me.Button2 = New System.Windows.Forms.Button
Me.Button4 = New System.Windows.Forms.Button
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.Button5 = New System.Windows.Forms.Button
Me.ColorDialog1 = New System.Windows.Forms.ColorDialog
Me.FontDialog1 = New System.Windows.Forms.FontDialog
CType(Me.TrackBar1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'TrackBar1
'
Me.TrackBar1.Location = New System.Drawing.Point(48, 208)
Me.TrackBar1.Maximum = 20
Me.TrackBar1.Name = "TrackBar1"
Me.TrackBar1.Size = New System.Drawing.Size(216, 45)
Me.TrackBar1.TabIndex = 1
'
'Panel1
'
Me.Panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me.Panel1.Location = New System.Drawing.Point(16, 16)
Me.Panel1.Name = "Panel1"
Me.Panel1.Size = New System.Drawing.Size(256, 112)
Me.Panel1.TabIndex = 2
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(392, 266)
Me.Controls.Add(Me.Panel1)
Me.Controls.Add(Me.TrackBar1)
CType(Me.TrackBar1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
Private Sub TrackBar1_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar1.Scroll
Dim color1, color2 As Color
Dim TrackbarPos1, TrackbarPos2
color1 = Color.Green
color2 = Color.Black
TrackbarPos1 = 0
Dim a As Graphics = Panel1.CreateGraphics
Dim b As New SolidBrush(color1)
Dim c As New SolidBrush(color2)
Dim d As New SolidBrush(Me.BackColor)
Dim k As Integer
a.FillRectangle(d, ClientRectangle)
For k = TrackBar1.Value To 1 Step -1
a.DrawString("3D Font", FontDialog1.Font, c, 20 + k, 20 - k)
Next
a.DrawString("3D Font", FontDialog1.Font, b, 20, 20)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
|