タイトル | : Re^5: クリップボードに自動保存 |
記事No | : 3395 |
投稿日 | : 2006/03/22(Wed) 13:00 |
投稿者 | : YAS |
それならフォームを最小化して,タスクバーからも消して,それからキャプチャすればよいでしょう。 自分自身以外のアプリケーションをタスクバーから消すのは難儀なので,自分で閉じてください。
Option Strict On Public Class Form1
Private Sub Form1_KeyDown(ByVal sender As Object, _ ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown If e.Control = True And e.KeyCode = Keys.C Then Dim WndState As FormWindowState = Me.WindowState Me.WindowState = FormWindowState.Minimized Me.ShowInTaskbar = False Using Image As Image = New Bitmap(Screen.PrimaryScreen.Bounds.Width, _ Screen.PrimaryScreen.Bounds.Height) Using Graph As Graphics = Graphics.FromImage(Image) Graph.CopyFromScreen(New Point(0, 0), New Point(0, 0), _ Screen.PrimaryScreen.Bounds.Size) End Using Clipboard.SetImage(Image) Me.WindowState = WndState Me.ShowInTaskbar = True Me.BackgroundImage = New Bitmap(Me.ClientSize.Width, Me.ClientSize.Height) Using Graph As Graphics = Graphics.FromImage(Me.BackgroundImage) Graph.InterpolationMode = _ Drawing2D.InterpolationMode.HighQualityBicubic Graph.DrawImage(Image, New Rectangle(New Point(0, 0), _ Me.BackgroundImage.Size)) End Using End Using End If End Sub
Private Sub Form1_Load(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles MyBase.Load Me.KeyPreview = True End Sub
End Class
|