Region.MakeEmpty メソッド
アセンブリ: System.Drawing (system.drawing.dll 内)
構文
使用例Region コンストラクタと MakeEmpty メソッドの使用方法を示すコード例を次に示します。この例は、Windows フォームでの使用を意図してデザインされています。フォームを作成し、次のコードを貼り付けます。フォームの Paint イベント処理メソッドで FillEmptyRegion メソッドを呼び出し、e を PaintEventArgs として渡します。
Private Sub FillEmptyRegion(ByVal e As PaintEventArgs) ' Create a region from a rectangle. Dim originalRectangle As New Rectangle(40, 40, 40, 50) Dim smallRegion As New Region(originalRectangle) ' Call MakeEmpty. smallRegion.MakeEmpty() ' Fill the region in red and draw the original rectangle ' in black. Note there is nothing filled in. e.Graphics.FillRegion(Brushes.Red, smallRegion) e.Graphics.DrawRectangle(Pens.Black, originalRectangle) End Sub
private void FillEmptyRegion(PaintEventArgs e) { // Create a region from a rectangle. Rectangle originalRectangle = new Rectangle(40, 40, 40, 50); Region smallRegion = new Region(originalRectangle); // Call MakeEmpty. smallRegion.MakeEmpty(); // Fill the region in red and draw the original rectangle // in black. Note there is nothing filled in. e.Graphics.FillRegion(Brushes.Red, smallRegion); e.Graphics.DrawRectangle(Pens.Black, originalRectangle); }
private: void FillEmptyRegion( PaintEventArgs^ e ) { // Create a region from a rectangle. Rectangle originalRectangle = Rectangle(40,40,40,50); System::Drawing::Region^ smallRegion = gcnew System::Drawing::Region( originalRectangle ); // Call MakeEmpty. smallRegion->MakeEmpty(); // Fill the region in red and draw the original rectangle // in black. Note there is nothing filled in. e->Graphics->FillRegion( Brushes::Red, smallRegion ); e->Graphics->DrawRectangle( Pens::Black, originalRectangle ); }
private void FillEmptyRegion(PaintEventArgs e) { // Create a region from a rectangle. Rectangle originalRectangle = new Rectangle(40, 40, 40, 50); Region smallRegion = new Region(originalRectangle); // Call MakeEmpty. smallRegion.MakeEmpty(); // Fill the region in red and draw the original rectangle // in black. Note there is nothing filled in. e.get_Graphics().FillRegion(Brushes.get_Red(), smallRegion); e.get_Graphics().DrawRectangle(Pens.get_Black(), originalRectangle); } //FillEmptyRegion
プラットフォーム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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
バージョン情報
参照- Region.MakeEmpty メソッドのページへのリンク