投稿日 | : 2003/09/02(Tue) 01:08 |
投稿者 | : 花ちゃん |
Eメール | : |
URL | : |
タイトル | : Re^3: 画像の保存及び簡単な印刷 |
後は色々工夫して見て下さい。
Private Sub Command1_Click()
Dim MyFileName As String
Dim x As Long, y As Long, c As Long
With Picture1
.AutoRedraw = True
.AutoSize = True
.ScaleMode = vbPixels
'クリップボード内にビットマップ形式のデータがあるか調べる
If Clipboard.GetFormat(vbCFBitmap) Then
Set .Picture = Clipboard.GetData()
'色を変更
For x = 0 To .ScaleWidth
For y = 0 To .ScaleHeight
'図のカラー情報の読み取り
c = .Point(x, y)
'読み取ったカラー情報を色を変更して描画
If c = vbBlack Then
Picture1.PSet (x, y), vbWhite
End If
Next y
Next x
'ファイル名を自動生成
MyFileName = App.Path & "\" & Format$(Now, "yymmddhhmmss") & ".BMP"
'表示データーをビットマップ形式のデーターで保存
SavePicture Picture1.Image, MyFileName
Printer.PaintPicture .Image, 10, 10, .Width, .Height
Printer.EndDoc
End If
End With
End Sub