VB.NET, C#, PowerShellを使用しているエンジニアのためのサイト。
基本的な使用方法から開発で役立つTipsまで幅広く取り扱っています。
<< 前のTips 次のTips >>
Graphicsオブジェクトを作成するには、グラフィックス オブジェクトへの参照が必要です。一般に、グラフィックス オブジェクトへの参照は、フォームまたはコントロールの Paint イベントか、PrintDocument の PrintPage イベントで取得します。使用した後はDisposeメソッドでオブジェクトを解放します。
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) _ Handles Me.Paint 'Graphicsオブジェクトを作成します Dim g As Graphics = e.Graphics 'なにか描画する 'Graphicsオブジェクトの解放 g.Dispose() End Sub Private Sub Button1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) _ Handles Button1.Paint 'Graphicsオブジェクトを作成します Dim g As Graphics = e.Graphics 'なにか描画する 'Graphicsオブジェクトの解放 g.Dispose() End Sub
Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, _ ByVal e As System.Drawing.Printing.PrintPageEventArgs) _ Handles PrintDocument1.PrintPage 'Graphicsオブジェクトを作成します Dim g As Graphics = e.Graphics 'なにか描画する 'Graphicsオブジェクトの解放 g.Dispose() End Sub
<< 前のTips 次のTips >>