📄 sample16.cs
字号:
private void panel1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
Bitmap testB = new Bitmap("C:\\w2k.jpg");
RectangleF cloneRect = new RectangleF(0, 0, 500,500);
System.Drawing.Imaging.PixelFormat format = testB.PixelFormat;
Bitmap testC=testB.Clone(cloneRect, format);
//使用Clone方法获取该Bitmap的副本
e.Graphics.DrawImage(testC, 0, 0);
for (int x = 0; x < testB.Width; x++)
{
for (int y = 0; y < testB.Height; y++)
{
testB.SetPixel(x,y, Color.Yellow);
//使用SetPixel方法更改Bitmap 对象中指定像素的颜色
}
} e.Graphics.DrawImage(testB, 0, 0);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -