110,539
社区成员
发帖
与我相关
我的任务
分享
private void button1_Click(object sender, EventArgs e)
{
Bitmap bm = new Bitmap(200, 200);
Graphics g = Graphics.FromImage(bm);
g.Clear(Color.Black);
g.DrawString("asdwqeqr", new Font("宋体", 14), new SolidBrush(Color.Blue), 20, 10);
}
if ((0 != m_stConfig.rectScreenShow2.Width) || (0 != m_stConfig.rectScreenShow2.Height))
{
Bitmap bmpBack2 = bmpBack.Clone(m_stConfig.rectScreenShow2, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
m_LabelShow2.BackgroundImage = bmpBack2;
}
这是那些代码 m_LabelShow2是绘制 它找不到Graphics.DrawImage这个方法啊[/quote]
Graphics要从某控件创建,比如当前窗体就可以这样this.CreateGraphics().DrawImage(...);
Control.CreateGraphics();
if ((0 != m_stConfig.rectScreenShow2.Width) || (0 != m_stConfig.rectScreenShow2.Height))
{
Bitmap bmpBack2 = bmpBack.Clone(m_stConfig.rectScreenShow2, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
m_LabelShow2.BackgroundImage = bmpBack2;
}
这是那些代码 m_LabelShow2是绘制 它找不到Graphics.DrawImage这个方法啊