Graphics.Dispose メソッド
アセンブリ: System.Drawing (system.drawing.dll 内)



次の例は、Windows フォームでの使用を意図してデザインされており、Paint イベント ハンドラのパラメータである PaintEventArgse が必要です。このコードは次のアクションを実行します。
-
グラフィックス ファイル SampImag.jpg からサンプルのディレクトリに Image を作成します。
Public Sub FromImageImage1(ByVal e As PaintEventArgs) ' Create image. Dim imageFile As Image = Image.FromFile("SampImag.jpg") ' Create graphics object for alteration. Dim newGraphics As Graphics = Graphics.FromImage(imageFile) ' Alter image. newGraphics.FillRectangle(New SolidBrush(Color.Black), 100, _ 50, 100, 100) ' Draw image to screen. e.Graphics.DrawImage(imageFile, New PointF(0.0F, 0.0F)) ' Dispose of graphics object. newGraphics.Dispose() End Sub
public void FromImageImage1(PaintEventArgs e) { // Create image. Image imageFile = Image.FromFile("SampImag.jpg"); // Create graphics object for alteration. Graphics newGraphics = Graphics.FromImage(imageFile); // Alter image. newGraphics.FillRectangle(new SolidBrush(Color.Black), 100, 50, 100, 100); // Draw image to screen. e.Graphics.DrawImage(imageFile, new PointF(0.0F, 0.0F)); // Release graphics object. newGraphics.Dispose(); }
public: void FromImageImage1( PaintEventArgs^ e ) { // Create image. Image^ imageFile = Image::FromFile( "SampImag.jpg" ); // Create graphics object for alteration. Graphics^ newGraphics = Graphics::FromImage( imageFile ); // Alter image. newGraphics->FillRectangle( gcnew SolidBrush( Color::Black ), 100, 50, 100, 100 ); // Draw image to screen. e->Graphics->DrawImage( imageFile, PointF(0.0F,0.0F) ); // Release graphics object. delete newGraphics; }

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からGraphics.Dispose メソッドを検索する場合は、下記のリンクをクリックしてください。

- Graphics.Dispose メソッドのページへのリンク