Oct 11, 2007

Free Chinese Fonts for Win9x/NT/2000/XP

Free Chinese Fonts for Win9x/NT/2000/XP

compiled by olr
Instructions:

Please make sure that in the Start --> Settings --> Control Panel --> Regional Options the default language ("Set default") is "Chinese (VR China)".

1. Please close all word-processing programs.
2. Click on the font you wish to download.
3. Choose a saving location, either "C:/WINNT/fonts" (NT/2000) or "C:/WINDOWS/fonts" (9x/Me/XP).
      OR: save the fonts to a new folder, then open "Fonts" from the "Control Panel";
      select "File" -> "Install New Font";
      open the drive and folder where you saved the new font files,
      the fonts will appear in the "list of fonts";
      select the files you want to install or choose "Select All"; click "OK".
4. Restart your word-processing programs.

   
name: 鼎繁 古印 - HDZB_5.TTF
size: 3.168 kB

download this font
download this font
   
   
name: 鼎繁海报 - HDZB_6.TTF
size: 2.991 kB

download this font
download this font
   
   
name: 鼎繁舒 - HDZB_10.TTF
size: 2.177 kB

download this font
download this font
   
   
name: 鼎繁印篆  - HDZB_25.TTF
size: 4.663 kB

download this font
download this font
   
   
name: 鼎繁 中變 - HDZB_27.TTF
size: 3.256 kB

download this font
download this font
   
   
name: 鼎繁 顏體 - HDZB_24.TTF
size: 3.501 kB

download this font
download this font
   
   
name: 汉鼎简黑变 - HDZB_35.TTF
size: 1.512 kB

download this font
download this font
   
   
name: 汉鼎简楷体 - HDZB_36.TTF
size: 4.573 kB

download this font
download this font
   
   
name: 汉鼎简录变 - HDZB_37.TTF
size: 3.950 kB

download this font
download this font
   
   
name: 汉鼎简舒体 - HDZB_39.TTF
size: 2.622 kB

download this font
download this font
   
   
name: 鼎繁 綠變 - HDZB_7.TTF
size: 4.866 kB

download this font
download this font
   
   
name: 汉鼎特粗黑 - HDZB_70.TTF
size: 1.683 kB

download this font
download this font
   
   
name: 鼎繁 中楷 - HDZB_74.TTF
size: 6.152 kB

download this font
download this font
   
   
name: 汉鼎简中楷 - HDZB_75.TTF
size: 5.528 kB

download this font
download this font
   
   
name: 鼎繁琥珀  - HDZB_86.TTF
size: 5.027 kB

download this font
download this font
   
   
name: 鼎繁勘亭 - HDZB_9.TTF
size: 2.931 kB

download this font
download this font
   
   
name: 鼎繁特 - HDZB_96.TTF
size: 2.923 kB

download this font
download this font
 
 
Even more fonts at http://www.sj00.com/ (be aware that not all fonts are real True Types).

original source: http://www.sino.uni-heidelberg.de/edv/sinopc/chinese_fonts.htm

WinForm : Using the World Transformation

Windows Forms Programming 
Using the World Transformation

Dim rect As New Rectangle(0, 0, 50, 50)
Dim pen As New Pen(Color.FromArgb(128, 200, 0, 200), 2)
e.Graphics.DrawRectangle(pen, rect)

e.Graphics.ScaleTransform(1.75F, 0.5F)
e.Graphics.DrawRectangle(pen, rect)

e.Graphics.ResetTransform()
e.Graphics.RotateTransform(28) ' 28 degrees
e.Graphics.DrawRectangle (pen, rect)

e.Graphics.ResetTransform()
e.Graphics.TranslateTransform(150, 150)
e.Graphics.DrawRectangle(pen, rect)



Oct 10, 2007

Mouse Event

Handling Mouse Events in Forms

We can handle mouse events such as mouse pointer movements in Forms. The mouse events supported by VB .NET are as follows:

MouseDown: This event happens when the mouse pointer is over the form/control and is pressed
MouseEnter: This event happens when the mouse pointer enters the form/control
MouseUp: This event happens when the mouse pointer is over the form/control and the mouse button is released
MouseLeave: This event happens when the mouse pointer leaves the form/control
MouseMove: This event happens when the mouse pointer is moved over the form/control
MouseWheel: This event happens when the mouse wheel moves while the form/control has focus
MouseHover: This event happens when the mouse pointer hovers over the form/control

The properties of the MouseEventArgs objects that can be passed to the mouse event handler are as follows:

Button: Specifies that the mouse button was pressed
Clicks: Specifies number of times the mouse button is pressed and released
X: The X-coordinate of the mouse click
Y: The Y-coordinate of the mouse click
Delta: Specifies a count of the number of detents (rotation of mouse wheel) the mouse wheel has rotated

Working with an Example

We will work with an example to check the mouse events in a form. We will be working with MouseDown, MouseEnter and MouseLeave events in this example. Drag three TextBoxes (TextBox1, TextBox2, TextBox3) onto the form. The idea here is to display the results of these events in the TextBoxes.

Code 

Public Class Form1 Inherits System.Windows.Forms.Form
'Windows Form Designer Generated Code
Private Sub Form1_Mousedown(ByVal sender As System.Object, ByVal e As _
System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
If e.Button = MouseButtons.Left Then
TextBox1.Text = "Mouse down at" + CStr(e.X) + " :" + CStr(e.Y)
'displaying the coordinates in TextBox1 when the mouse is pressed on the form
End If
End Sub

Private Sub Form1_MouseEnter(ByVal sender As System.Object, ByVal e_
As System.EventArgs) Handles MyBase.MouseEnter
TextBox2.Text = "Mouse Entered"
'displaying "mouse entered" in TextBox2 when the mouse pointer enters the form
End Sub

Private Sub Form1_MouseLeave(ByVal sender As System.Object, ByVal e_
As System.EventArgs) Handles MyBase.MouseLeave
TextBox3.Text = "Mouse Exited"
'displaying "mouse exited" in Textbox3 when the mouse pointer leaves the form
End Sub

End Class

The image below displays the output.

Beep Function

The Beep Function in VB.NET can be used to make the computer emit a beep. To see how this works, drag a Button onto the form and place the following code in it's click event:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e_
As System.EventArgs) Handles Button1.Click
Beep()
End Sub

When you run the code and click the button your computer emits a beep.

Set BMP file to Transparent


Set BMP file to Transparent


Imports System
Imports System.Collections
Imports System.ComponentModel
Imports System.Windows.Forms
Imports System.Data
Imports System.Configuration
Imports System.Resources
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Drawing.Imaging

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

Public Class TransparencyForm
    Inherits  System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub  New()
        MyBase.New()

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

        'Ad d any initialization after the InitializeComponent() call
        Me.SetStyle(ControlStyles.ResizeRedraw , True)
        Me.SetStyle(ControlStyles.DoubleBuffer , True)
        Me.SetStyle(ControlStyles.AllPaintingInWmPaint , True)
    End Sub

    'Fo rm overrides dispose to clean up the component list.
    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

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

    'NO TE: 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 splitter2  As System.Windows.Forms.Splitter
    Friend WithEvents splitter1  As System.Windows.Forms.Splitter
    Friend WithEvents groupBox1  As System.Windows.Forms.GroupBox
    Friend WithEvents panel1  As System.Windows.Forms.Panel
    Friend WithEvents groupBox3  As System.Windows.Forms.GroupBox
    Friend WithEvents panel3  As System.Windows.Forms.Panel
    Friend WithEvents groupBox2  As System.Windows.Forms.GroupBox
    Friend WithEvents panel2  As System.Windows.Forms.Panel
    <System.Diagnostics.DebuggerStepThrough ()> Private Sub InitializeComponent()
        Me.splitter2 = New System.Windows.Forms.Splitter ()
        Me.splitter1 = New System.Windows.Forms.Splitter ()
        Me.groupBox1 = New System.Windows.Forms.GroupBox ()
        Me.panel1 = New System.Windows.Forms.Panel ()
        Me.groupBox3 = New System.Windows.Forms.GroupBox ()
        Me.panel3 = New System.Windows.Forms.Panel ()
        Me.groupBox2 = New System.Windows.Forms.GroupBox ()
        Me.panel2 = New System.Windows.Forms.Panel ()
        Me.groupBox1.SuspendLayout()
        Me.groupBox3.SuspendLayout()
        Me.groupBox2.SuspendLayout()
        Me.SuspendLayout()
        '
        'sp litter2
        '
        Me.splitter2.Location = New System.Drawing.Point (232 0)
         Me.splitter2.Name = "splitter2"
        Me.splitter2.Size = New System.Drawing.Size (3 102)
        Me.splitter2.TabIndex =  9
        Me.splitter2.TabStop = False
        '
        'sp litter1
        '
        Me.splitter1.Location = New System.Drawing.Point (229 0)
         Me.splitter1.Name = "splitter1"
        Me.splitter1.Size = New System.Drawing.Size (3 102)
        Me.splitter1.TabIndex =  6
        Me.splitter1.TabStop = False
        '
        'gr oupBox1
        '
        Me.groupBox1.Controls.AddRange (New System.Windows.Forms.Control() {Me.panel1})
        Me.groupBox1.Dock = System.Windows.Forms.DockStyle.Left
        Me.groupBox1.Location = New System.Drawing.Point (117 0)
         Me.groupBox1.Name = "groupBox1"
        Me.groupBox1.Size = New System.Drawing.Size (112 102)
        Me.groupBox1.TabIndex =  5
        Me.groupBox1.TabStop = False
        Me.groupBox1.Text =  "Original Colors"
        '
        'pa nel1
        '
        Me.panel1.BackColor = System.Drawing.Color.White
        Me.panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me.panel1.Dock = System.Windows.Forms.DockStyle.Fill
        Me.panel1.Location = New System.Drawing.Point (3 16)
         Me.panel1.Name = "panel1"
        Me.panel1.Size = New System.Drawing.Size (106 83)
        Me.panel1.TabIndex =  0
        '
        'gr oupBox3
        '
        Me.groupBox3.Controls.AddRange (New System.Windows.Forms.Control() {Me.panel3})
        Me.groupBox3.Dock = System.Windows.Forms.DockStyle.Fill
        Me.groupBox3.Location = New System.Drawing.Point (117 0)
         Me.groupBox3.Name = "groupBox3"
        Me.groupBox3.Size = New System.Drawing.Size (235 102)
        Me.groupBox3.TabIndex =  8
        Me.groupBox3.TabStop = False
        Me.groupBox3.Text =  "Made Transparent"
        '
        'pa nel3
        '
        Me.panel3.BackColor = System.Drawing.Color.White
        Me.panel3.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me.panel3.Dock = System.Windows.Forms.DockStyle.Fill
        Me.panel3.Location = New System.Drawing.Point (3 16)
         Me.panel3.Name = "panel3"
        Me.panel3.Size = New System.Drawing.Size (229 83)
        Me.panel3.TabIndex =  0
        '
        'gr oupBox2
        '
        Me.groupBox2.Controls.AddRange (New System.Windows.Forms.Control() {Me.panel2})
        Me.groupBox2.Dock = System.Windows.Forms.DockStyle.Left
         Me.groupBox2.Name = "groupBox2"
        Me.groupBox2.Size = New System.Drawing.Size (117 102)
        Me.groupBox2.TabIndex =  7
        Me.groupBox2.TabStop = False
        Me.groupBox2.Text =  "White Background"
        '
        'pa nel2
        '
        Me.panel2.BackColor = System.Drawing.Color.White
        Me.panel2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me.panel2.Dock = System.Windows.Forms.DockStyle.Fill
        Me.panel2.Location = New System.Drawing.Point (3 16)
         Me.panel2.Name = "panel2"
        Me.panel2.Size = New System.Drawing.Size (111 83)
        Me.panel2.TabIndex =  0
        '
        'Tr ansparencyForm
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size (5 13)
        Me.ClientSize = New System.Drawing.Size (352 102)
        Me.Controls.AddRange(New System.Windows.Forms.Control () {Me.splitter2, Me.splitter1, Me.groupBox1, Me.groupBox3, Me.groupBox2})
        Me.Name =  "TransparencyForm"
        Me.Text =  "TransparencyForm"
        Me.groupBox1.ResumeLayout(False)
        Me.groupBox3.ResumeLayout(False)
        Me.groupBox2.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub

#End  Region


    Dim  backgroundString As String =  "a\n b\n c\n d\n e\n f\n g\n H \n"


    Private Sub  panel1_Paint(ByVal sender As  Object, ByVal e As  PaintEventArgs) Handles panel1.Paint
        Dim As Graphics = e.Graphics
        Dim  bmp As Bitmap = New Bitmap( "figure2.BMP")
        g.DrawString(backgroundString,  Me.Font, Brushes.Black, Me.ClientRectangle.Left, Me.ClientRectangle.Top)
        Dim  rect As Rectangle = New Rectangle( 0 0, bmp.Width, bmp.Height)
        rect.Offset((Me.panel1.ClientRectangle.Width  - rect.Width) / 2, (Me.panel1.ClientRectangle.Height  - rect.Height) / 2)
        g.DrawImage(bmp, rect)
    End Sub

    Private Sub  panel2_Paint(ByVal sender As  Object, ByVal e As  PaintEventArgs) Handles panel2.Paint
        Dim As Graphics = e.Graphics
        Dim  bmp As Bitmap = New Bitmap( "figure2.BMP")
        g.DrawString(backgroundString,  Me.Font, Brushes.Black, Me.ClientRectangle.Left, Me.ClientRectangle.Top)

        Dim  colorMap As ColorMap() = New ColorMap() {New ColorMap()}
        colorMap( 0).OldColor = bmp.GetPixel(0 , bmp.Height - 1 )
        colorMap( 0).NewColor = Color.White
        Dim  attr As ImageAttributes = New ImageAttributes()
        attr.SetRemapTable(colorMap)

        Dim  rect As Rectangle = New Rectangle( 0 0, bmp.Width, bmp.Height)
        rect.Offset((Me.panel1.ClientRectangle.Width  - rect.Width) / 2, (Me.panel1.ClientRectangle.Height  - rect.Height) / 2)
        g.DrawImage(bmp, rect)
    End Sub

    Private Sub  panel3_Paint(ByVal sender As  Object, ByVal e As  PaintEventArgs) Handles panel3.Paint
        Dim As Graphics = e.Graphics
        Dim  bmp As Bitmap = New Bitmap( "figure2.BMP")
        g.DrawString(backgroundString,  Me.Font, Brushes.Black, Me.ClientRectangle.Left, Me.ClientRectangle.Top)

        bmp.MakeTransparent(bmp.GetPixel (0, bmp.Height -  1))
        Dim  rect As Rectangle = New Rectangle( 0 0, bmp.Width, bmp.Height)
        rect.Offset((Me.panel1.ClientRectangle.Width  - rect.Width) / 2, (Me.panel1.ClientRectangle.Height  - rect.Height) / 2)
        g.DrawImage(bmp, rect)
    End Sub

    Private Sub  TransparencyForm_Layout(ByVal sender  As Object, ByVal e As  LayoutEventArgs) Handles MyBase.Layout
        panel1.Refresh()
        panel2.Refresh()
        panel3.Refresh()
    End Sub
End Class