VB6.0用掲示板の過去のログ(No.2)−VBレスキュー(花ちゃん)
[記事リスト] [新規投稿] [新着記事] [ワード検索] [管理用]

投稿日: 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


- 関連一覧ツリー (★ をクリックするとツリー全体を一括表示します)

- 返信フォーム (この記事に返信する場合は下記フォームから投稿して下さい)

- VBレスキュー(花ちゃん) - - Web Forum -