daetips
Messages postés
142
Date d'inscription
jeudi 10 juillet 2003
Statut
Membre
Dernière intervention
10 novembre 2007
3 juin 2007 à 01:43
Tous les deux codes sont avec une form maximisée..ca doit etre possible de dessiner sur l'écran directement
Pour inverser les couleurs:
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Private Declare Function InvertRect Lib "user32" (ByVal hdc As Long, ByRef lpRect As RECT) As Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function StretchBlt Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Sub Command1_Click()
Dim r As RECT
Me.ScaleMode = vbPixels
r.Left = 0
r.Top = 0
r.Right = Me.Width
r.Bottom = Me.Height
InvertRect Me.hdc, r
End Sub
Private Sub Form_Initialize()
Dim W, H
W = Screen.Width / 15
H = Screen.Height / 15
StretchBlt hdc, 0, 0, W, H, GetDC(0&), 0, 0, W, H, vbSrcCopy
Command1_Click
End Sub
Private Sub Form_Load()
Me.Left = Me.Left - 2 * RCScale
Me.Top = Me.Top - 0 * RCScale
Me.Left = Me.Left + 2 * RCScale
Me.Top = Me.Top + 0 * RCScale
End Sub
Pour retourner l'écran
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Const HWND_TOPMOST = -1
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOSIZE = &H1
Const RCScale = 200
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function StretchBlt Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long
Private Declare Function GetWindowDC Lib "user32" (ByVal hwnd As Long) As Long
Dim GetDesktopWindow As Long
Private Sub Form_Initialize()
Dim W, H, C
C = GetWindowDC(GetDesktopWindow)
W = Screen.Width / Screen.TwipsPerPixelX
H = Screen.Height / Screen.TwipsPerPixelY
'StretchBlt hdc, 0, 0, W, H, GetDC(0&), 0, 0, W, H, vbSrcCopy 'normal
StretchBlt C, 0, H, W, -H, GetDC(0&), 0, 0, W, H, vbSrcCopy 'inversion x
'StretchBlt hdc, W, 0, -W, H, GetDC(0&), 0, 0, W, H, vbSrcCopy 'inversion y
'StretchBlt hdc, W, H, -W, -H, GetDC(0&), 0, 0, W, H, vbSrcCopy 'inversion x et y
End Sub
Private Sub Form_Load()
Me.Left = Me.Left - 2 * RCScale
Me.Top = Me.Top - 0 * RCScale
Me.Left = Me.Left + 2 * RCScale
Me.Top = Me.Top + 0 * RCScale
SetWindowPos Me.hwnd, -1, 0, 0, 0, 0, 33
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
End
End Sub
Daetips