'============================================================
'CopyGraphic 色々な描画コピーをする
'------引数--------------------------------------------------
'SPic コピー先のピクチャボックス
'TPic コピー元のビットマップが入ったピクチャボックス
'CopyType コピーの種類
'============================================================
Public Sub CopyGraphic(SPic As Object, TPic As Object, _
CopyType As Integer)
Dim sx As Long, sy As Long 'コピー先開始座標
Dim spw As Long, sph As Long 'コピー元の画像の幅,高さ
Dim tpw As Long, tph As Long 'コピー先の画像の幅,高さ
spw = SPic.Width
sph = SPic.Height
'引数に従いコピーの種類を区別する
Select Case CopyType
Case 2 '鏡像(Y軸対称)
sx = TPic.Width - 1&
sy = 0&
tpw = -TPic.Width
tph = TPic.Height
Case 3 '鏡像(X軸対称)
sx = 0&
sy = TPic.Height - 1&
tpw = TPic.Width
tph = -TPic.Height
Case 5 '180度回転
sx = TPic.Width - 1&
sy = TPic.Height - 1&
tpw = -TPic.Width
tph = -TPic.Height
Case Else 'そのほか
sx = 0&
sy = 0&
tpw = TPic.Width
tph = TPic.Height
End Select
TPic.PaintPicture SPic.Picture, sx, sy, tpw, _
tph, 0&, 0&, spw, sph, vbSrcCopy
End Sub
|