投稿日 | : 2007/04/10(Tue) 18:36 |
投稿者 | : なな |
Eメール | : |
URL | : |
タイトル | : Re^11: PictureBox上のLineを回転させる方法 |
BT様
早々のご回答ありがとうございます。
> 左右回転って何?
> 線対称の反転ってことですか?
はい。そうです。線対称の反転のことです。
> 的外れなら、ごめんなさい。。。
いえいえ。的外れではないです。
以下のようなソースを書いたのですが。線対称反転の場合、画像がおかしく(前回の画像の残像が残る)なります。
画像側の処理がおかしいのでしょうか??
Dim countNum As Long
Dim sngWidth As Single '絵の幅(ピクセル)
Dim sngHeight As Single '絵の高さ(ピクセル)
Private Sub Command1_Click()
If countNum Mod 2 <> 0 Then
Picture2.Picture = Picture1.Picture
With Picture2
sngWidth = .ScaleX(.ScaleWidth, .ScaleMode, vbPixels)
sngHeight = .ScaleY(.ScaleHeight, .ScaleMode, vbPixels)
End With
Else
With Picture2
.Parent.ScaleMode = vbPixels
.ScaleMode = vbPixels
'サイズ調整、枠有り無しどちらでもOK
.Move .Left, .Top, sngWidth + (.Width - .ScaleWidth), _
sngHeight + (.Height - .ScaleHeight)
.Refresh '(AutoRedraw=False)用
'左右の鏡像の場合
.PaintPicture Picture1.Picture, sngWidth - 1, 0, -sngWidth
End With
End If
countNum = countNum + 1
Line1.X1 = Picture2.ScaleWidth - Line1.X1
Line1.X2 = Picture2.ScaleWidth - Line1.X2
End Sub
Private Sub Form_Load()
Picture1.Visible = False
Picture1.Picture = LoadPicture("C:\sample.bmp")
With Picture2
sngWidth = .ScaleX(.ScaleWidth, .ScaleMode, vbPixels)
sngHeight = .ScaleY(.ScaleHeight, .ScaleMode, vbPixels)
End With
countNum = 1
End Sub