home *** CD-ROM | disk | FTP | other *** search
Wrap
VERSION 2.00 Begin Form Form1 Caption = "FLabel Sample" ClientHeight = 3255 ClientLeft = 1665 ClientTop = 2400 ClientWidth = 6630 Height = 3660 Left = 1605 LinkTopic = "Form1" ScaleHeight = 3255 ScaleWidth = 6630 Top = 2055 Width = 6750 Begin CommandButton Command2 Caption = "Exit" Height = 375 Left = 3480 TabIndex = 3 Top = 2640 Width = 1575 End Begin CommandButton Command1 Caption = "Print" Height = 375 Left = 1680 TabIndex = 2 Top = 2640 Width = 1575 End Begin TextBox Text1 Height = 2175 Left = 3480 MultiLine = -1 'True TabIndex = 0 Text = "Text1" Top = 240 Width = 2895 End Begin FLabel FLabel1 AutoSize = 0 'False BackStyle = 0 'Transparent Caption = "FLabel1" Delimiter = "" Height = 2175 Left = 240 ParaBefore = 0 ParaFirst = 0 ParaLeft = 0 ParaRight = 0 TabIndex = 1 Top = 240 Width = 3015 WordWrap = 0 'False End Option Explicit Sub Command1_Click () ' draw box Printer.Line (1320, 1320)-Step(6000, 1680), , B ' set up printer FLabel1.PrinterScaleMode = Printer.ScaleMode ' print at left = 1", top = 1" ' height = 1", width = 4" FLabel1.PrinterTop = 1440 FLabel1.PrinterLeft = 1440 FLabel1.PrinterHeight = 1440 FLabel1.PrinterWidth = 4 * 1440 ' print FLabel1.PrinterHDC = Printer.hDC ' make sure printer object knows something has ' happened Printer.Print "" ' end job Printer.EndDoc End Sub Sub Command2_Click () ' get out End End Sub Sub Form_Load () FLabel1.ParaBefore = 240 FLabel1.ParaFirst = 480 FLabel1.WordWrap = True Text1.Text = "This is a test of |color:blue|FLabel VBX|color:black|. Play with this text to change the formatting. Then, try printing it. You should see your text inside a box.|cr|It's fun ..." End Sub Sub Form_Resize () FLabel1.Top = 240 FLabel1.Left = 240 FLabel1.Width = (Form1.ScaleWidth / 2) - 360 FLabel1.Height = Form1.ScaleHeight - 1080 Text1.Top = 240 Text1.Left = (Form1.ScaleWidth / 2) + 120 Text1.Width = (Form1.ScaleWidth / 2) - 360 Text1.Height = Form1.ScaleHeight - 1080 Command1.Top = Form1.ScaleHeight - 600 Command1.Left = (Form1.ScaleWidth / 2) - Command1.Width - 120 Command2.Top = Form1.ScaleHeight - 600 Command2.Left = (Form1.ScaleWidth / 2) + 120 End Sub Sub Text1_Change () Dim Offset As Integer Dim Temp As String Temp = Text1.Text Do While InStr(Temp, Chr(13) & Chr(10)) Offset = InStr(Temp, Chr(13) & Chr(10)) Temp = Left(Temp, Offset - 1) & "|CR|" & Mid(Temp, Offset + 2) Loop Text1.Text = Temp FLabel1.Caption = Temp End Sub