Horizontßlnφ a vertikßlnφ otoΦenφ obrßzku

Postup:
Do deklaraΦnφ Φßsti formulß°e zapiÜte:


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 Const SRCCOPY = &HCC0020

Na formulß° p°idejte dva PictureBoxy, do Picture1 naΦt∞te obrßzek, a dv∞ tlaΦφtka. Prvnφ tlaΦφtko bude otßΦet obrßzek horizontßln∞, druhΘ vertikßln∞:
Private Sub Command1_Click()

    Picture2.Cls
    px% = Picture1.ScaleWidth
    py% = Picture1.ScaleHeight
    retval% = StretchBlt(Picture2.hdc, px%, 0, -px%, py%, _
       Picture1.hdc, 0, 0, px%, py%, SRCCOPY)

End Sub

Private Sub Command2_Click()

    Picture2.Cls
    px% = Picture1.ScaleWidth
    py% = Picture1.ScaleHeight
    retval% = StretchBlt(Picture2.hdc, 0, py%, px%, -py%, _
      Picture1.hdc, 0, 0, px%, py%, SRCCOPY)

End Sub

Zp∞t

Autor: The Bozena