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

Dim instance As Bitmap Dim x As Integer Dim y As Integer Dim color As Color instance.SetPixel(x, y, color)
戻り値
このメソッドは値を返しません。


次の例は、Windows フォームでの使用を意図してデザインされており、Paint イベント ハンドラのパラメータである PaintEventArgs の e が必要です。このコードは次のアクションを実行します。
Public Sub SetPixel_Example(ByVal e As PaintEventArgs) ' Create a Bitmap object from a file. Dim myBitmap As New Bitmap("Grapes.jpg") ' Draw myBitmap to the screen. e.Graphics.DrawImage(myBitmap, 0, 0, myBitmap.Width, _ myBitmap.Height) ' Set each pixel in myBitmap to black. Dim Xcount As Integer For Xcount = 0 To myBitmap.Width - 1 Dim Ycount As Integer For Ycount = 0 To myBitmap.Height - 1 myBitmap.SetPixel(Xcount, Ycount, Color.Black) Next Ycount Next Xcount ' Draw myBitmap to the screen again. e.Graphics.DrawImage(myBitmap, myBitmap.Width, 0, myBitmap.Width, _ myBitmap.Height) End Sub
public void SetPixel_Example(PaintEventArgs e) { // Create a Bitmap object from a file. Bitmap myBitmap = new Bitmap("Grapes.jpg"); // Draw myBitmap to the screen. e.Graphics.DrawImage(myBitmap, 0, 0, myBitmap.Width, myBitmap.Height); // Set each pixel in myBitmap to black. for (int Xcount = 0; Xcount < myBitmap.Width; Xcount++) { for (int Ycount = 0; Ycount < myBitmap.Height; Ycount++) { myBitmap.SetPixel(Xcount, Ycount, Color.Black); } } // Draw myBitmap to the screen again. e.Graphics.DrawImage(myBitmap, myBitmap.Width, 0, myBitmap.Width, myBitmap.Height); }
public: void SetPixel_Example( PaintEventArgs^ e ) { // Create a Bitmap object from a file. Bitmap^ myBitmap = gcnew Bitmap( "Grapes.jpg" ); // Draw myBitmap to the screen. e->Graphics->DrawImage( myBitmap, 0, 0, myBitmap->Width, myBitmap->Height ); // Set each pixel in myBitmap to black. for ( int Xcount = 0; Xcount < myBitmap->Width; Xcount++ ) { for ( int Ycount = 0; Ycount < myBitmap->Height; Ycount++ ) { myBitmap->SetPixel( Xcount, Ycount, Color::Black ); } } // Draw myBitmap to the screen again. e->Graphics->DrawImage( myBitmap, myBitmap->Width, 0, myBitmap->Width, myBitmap->Height ); }

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に収録されているすべての辞書からBitmap.SetPixel メソッドを検索する場合は、下記のリンクをクリックしてください。

- Bitmap.SetPixel メソッドのページへのリンク