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 Const Ratio = 1 / 2 Private Sub Picture2_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single) Picture2.Cls Call StretchBlt(Picture2.hdc, x, y, Picture1.ScaleWidth, Picture1.ScaleHeight, Picture1.hdc, 0, 0, Picture1.ScaleWidth * Ratio, Picture1.ScaleHeight * Ratio, vbSrcCopy) Picture2.Refresh DoEvents End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionDim Ratio As Double Private Sub Form_Load() aff.ScaleMode = 6 tmp.ScaleMode = 6 tmp.AutoRedraw = True aff.AutoRedraw = True tmp.BorderStyle = 0 aff.BorderStyle = 0 tmp.AutoSize = True aff.Width = 2400 'Soit 2 fois 12cm taille d'une boite cd aff.Height = 2400 'affiche dans aff sans deformation Ratio = tmp.ScaleWidth / aff.ScaleWidth aff.PaintPicture tmp, 0, 0, aff.ScaleWidth, aff.ScaleHeight, 0, 0, tmp.ScaleWidth, aff.ScaleHeight * Ratio End Sub Private Sub aff_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 1 Then aff.Cls aff.PaintPicture tmp, 0, Y, aff.ScaleWidth, aff.ScaleHeight, 0, -Y, tmp.ScaleWidth, aff.ScaleHeight * Ratio End If End Sub