110,571
社区成员
发帖
与我相关
我的任务
分享
namespace TestOnPaint
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.Paint += new PaintEventHandler(Form1_Paint);
}
void Form1_Paint(object sender, PaintEventArgs e)
{
e.Graphics.FillRectangle(Brushes.Chocolate, ClientRectangle);
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
}
}
}
private void Form1_Paint(object sender, PaintEventArgs e)
{
base.OnPaint(e);
Graphics g = e.Graphics;
g.DrawImage(m_Bitmap, new Rectangle(this.AutoScrollPosition.X, this.AutoScrollPosition.Y,(int)(m_Bitmap.Width), (int)(m_Bitmap.Height)));
}