Обновляю в цикле Леибл - Текст - такои счетчик, показывающии номер итеррации цикла.
Так вот если леибл короткии - все идеально,
но если слишком широкии - то Текст в леибле мерцает.
Можно что-то сделать чтоб убрать это мерцание ?
Спасибо
Option Explicit
Private Declare Function DrawText Lib "user32" Alias "DrawTextA" (ByVal hdc As Long, ByVal lpStr As String, ByVal nCount As Long, lpRect As RECT, ByVal wFormat As Long) As Long
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Const DT_CENTER = &H1
Private Const DT_SINGLELINE = &H20
Private Const DT_VCENTER = &H4
Dim myRect As RECT
Private Sub Command1_Click()
Me.ScaleMode = vbPixels
myRect.Left = 0
myRect.Top = 0
myRect.Right = Me.ScaleWidth
myRect.Bottom = Me.ScaleHeight
DrawText Me.hdc, "Hello", Len("Hello"), myRect, DT_SINGLELINE Or DT_VCENTER Or DT_CENTER
End Sub
Private Sub Form_Load()
Me.ScaleMode = vbPixels
myRect.Left = 0
myRect.Top = 0
myRect.Right = Me.ScaleWidth
myRect.Bottom = Me.ScaleHeight
DrawText Me.hdc, "DrawText!", Len("DrawText!"), myRect, DT_SINGLELINE Or DT_VCENTER Or DT_CENTER
End Sub
Picture1.ScaleMode = vbPixels
myRect.Left = 0
myRect.Top = 0
myRect.Right = Picture1.ScaleWidth
myRect.Bottom = Picture1.ScaleHeight
Option Explicit
Private Declare Function DrawText Lib "user32" Alias "DrawTextA" (ByVal hdc As Long, ByVal lpStr As String, ByVal nCount As Long, lpRect As RECT, ByVal wFormat As Long) As Long
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Const DT_CENTER = &H1
Private Const DT_SINGLELINE = &H20
Private Const DT_VCENTER = &H4
Private Sub Command1_Click()
Dim myRect As RECT
Picture1.Cls
Picture1.ScaleMode = vbPixels
myRect.Left = 0
myRect.Top = 0
myRect.Right = Picture1.ScaleWidth
myRect.Bottom = Picture1.ScaleHeight
DrawText Picture1.hdc, "DrawText!", Len("DrawText!"), myRect, DT_SINGLELINE Or DT_VCENTER Or DT_CENTER
End Sub
Private Sub Command2_Click()
Dim myRect As RECT
Picture1.Cls
Picture1.ScaleMode = vbPixels
myRect.Left = 0
myRect.Top = 0
myRect.Right = Picture1.ScaleWidth
myRect.Bottom = Picture1.ScaleHeight
DrawText Picture1.hdc, "!", Len("!"), myRect, DT_SINGLELINE Or DT_VCENTER Or DT_CENTER
End Sub
Сейчас этот форум просматривают: Majestic-12 [Bot] и гости: 14