home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form frmFontWindow
- AutoRedraw = -1 'True
- BorderStyle = 3 'Fixed Dialog
- Caption = "Font Window Example"
- ClientHeight = 1980
- ClientLeft = 48
- ClientTop = 336
- ClientWidth = 2784
- Icon = "FontWndo.frx":0000
- LinkTopic = "Form1"
- LockControls = -1 'True
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 1980
- ScaleWidth = 2784
- ShowInTaskbar = 0 'False
- StartUpPosition = 2 'CenterScreen
- Begin VB.CommandButton cmdChangeFont
- Caption = "Change Font"
- Height = 435
- Left = 900
- TabIndex = 4
- Top = 30
- Width = 1035
- End
- Begin VB.CommandButton cmdRedraw
- Caption = "Redraw"
- Height = 285
- Left = 1710
- TabIndex = 2
- Top = 750
- Width = 1065
- End
- Begin VB.TextBox txtPrevText
- Appearance = 0 'Flat
- Height = 285
- Left = 60
- TabIndex = 1
- TabStop = 0 'False
- Text = "Preview Text"
- Top = 750
- Width = 1635
- End
- Begin VB.PictureBox pPrev
- Appearance = 0 'Flat
- AutoRedraw = -1 'True
- BackColor = &H00000080&
- ForeColor = &H80000008&
- Height = 885
- Left = 30
- ScaleHeight = 864
- ScaleWidth = 2724
- TabIndex = 0
- TabStop = 0 'False
- Top = 1050
- Width = 2745
- End
- Begin VB.Label lblTxt2Draw
- Caption = "Text To Print:"
- Height = 195
- Left = 120
- TabIndex = 3
- Top = 510
- Width = 960
- End
- Attribute VB_Name = "frmFontWindow"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- Private Sub cmdChangeFont_Click()
- Set pPrev.Font = ShowFontWindow(pPrev.Font, pPrev.ForeColor, pPrev.ForeColor)
- RedrawPrev
- End Sub
- Private Sub RedrawPrev()
- pPrev.Cls
- pPrev.ForeColor = vbGrayText
- pPrev.CurrentX = pPrev.Width / 2 - pPrev.TextWidth(txtPrevText) / 2 + 45
- pPrev.CurrentY = pPrev.Height / 2 - pPrev.TextHeight(txtPrevText) / 2 + 45
- pPrev.Print txtPrevText
- pPrev.ForeColor = vbWhite
- pPrev.CurrentX = pPrev.Width / 2 - pPrev.TextWidth(txtPrevText) / 2
- pPrev.CurrentY = pPrev.Height / 2 - pPrev.TextHeight(txtPrevText) / 2
- pPrev.Print txtPrevText
- End Sub
- Private Sub cmdRedraw_Click()
- RedrawPrev
- End Sub
- Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
- If UnloadMode = 1 Then Exit Sub
- Cancel = True
- End Sub
-