1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
| Option Explicit
Const LF_FACESIZE = 32
Private Type LOGFONT
lfHeight As Long
lfWidth As Long
lfEscapement As Long
lfOrientation As Long
lfWeight As Long
lfItalic As Byte
lfUnderline As Byte
lfStrikeOut As Byte
lfCharSet As Byte
lfOutPrecision As Byte
lfClipPrecision As Byte
lfQuality As Byte
lfPitchAndFamily As Byte
lfFaceName(1 To LF_FACESIZE) As Byte
End Type
Private Declare Function CreateFontIndirect Lib "gdi32" Alias "CreateFontIndirectA" (lpLogFont As LOGFONT) As Long
Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private aa As String, taille As String, echappement As Integer, orientation As Integer
Public Sub PrintText(ByRef pic As PictureBox, ByVal x As Long, ByVal y As Long, ByVal strText As String, ByVal lEscapment As Long, ByVal lOrient As Long, ByVal lSize As Long)
On Error Resume Next
Dim font As LOGFONT
Dim prevFont As Long
Dim hFont As Long
Dim ret As Long
font.lfEscapement = lEscapment
font.lfOrientation = 300
font.lfItalic = 0
font.lfHeight = (lSize * -20) / Screen.TwipsPerPixelY
font.lfItalic = 0
font.lfUnderline = 0
hFont = CreateFontIndirect(font)
prevFont = SelectObject(pic.hdc, hFont)
pic.CurrentX = x
pic.CurrentY = y
pic.Print strText
ret = SelectObject(pic.hdc, prevFont)
ret = DeleteObject(hFont)
End Sub
Private Sub Command1_Click()
If Timer1.Enabled = True Then Timer1.Enabled = False Else Timer1.Enabled = True
End Sub
Private Sub Form_Activate()
With Picture1
.BackColor = &HFF0000
.DrawMode = 6
.DrawStyle = 0
.DrawWidth = 1
.Left = 1080
End With
Picture1.Move 1080, 840, 8775, 5655
Me.ScaleMode = 1
Me.Move 0, 0, 10845, 8115
Text1.Move 1080, 6960, 1080, 495
Text1.Text = ""
Text2.Move 6360, 6960, 615, 495
Text2.Text = "20"
Text3.Move 7800, 7080, 1815, 375
Text3.Text = ""
Label1.Move 1080, 6600, 1815, 375
Label1.Caption = "orientation"
Label2.Move 6360, 6480, 495, 375
Label2.Caption = "taille"
Label3.Move 7920, 6600, 1935, 375
Label3.Caption = "echappement"
Command1.Move 4440, 7200, 1575, 375
Command1.Caption = "stopper"
End Sub
Private Sub Text1_LostFocus()
If Not IsNumeric(Text1.Text) Or Val(Text1.Text) = 0 Then Exit Sub
Timer1.Enabled = False
Picture1.Cls
aa = "essai"
taille = Text2.Text
echappement = Val(Text3.Text)
orientation = Val(Text1.Text)
PrintText Picture1, 200 - (0 / 100), 200 - (0 / 100), LCase$(aa), orientation, echappement, taille
End Sub
Private Sub Timer1_Timer()
Picture1.Cls
aa = "liquidnitrogen"
taille = Text2.Text
echappement = Val(Text3.Text)
orientation = Val(Text1.Text)
PrintText Picture1, 200 - (0 / 100), 200 - (0 / 100), LCase$(aa), orientation, echappement, taille
Text1.Text = Str(orientation - 100)
If Text1.Text = "-3600" Then Text1.Text = "0"
End Sub |
Partager