我用的是C#写的,写在paint事件中,运行不到那里
我就改到构造函数中去绘制同样也没有显示出来
public ucDrawLine()
{
InitializeComponent();
Graphics g=this.CreateGraphics();
g.DrawLine(new Pen(Color.Green), 0, 0, 100, 50);
}
请高手帮忙,如何对一个控件或者窗体进行重新绘制
另外问下,如何将控件相对于父容器的位置,转换为相对于屏幕的绝对位置
控件的重绘其虚拟函数是固定的,不能随意放在其它地方,你可以查一下其虚拟函数是哪一个
private void SoundSetForm_Paint(object sender, PaintEventArgs e)
{
loadBaseImage();
}
public void loadBaseImage()
{
g = this.CreateGraphics();
photoManager.DrawImageHelper.DrawSrcImage(offBitmap, photoManager.SoundSet.SoundSetBitMapImage.BgImage, photoManager.SoundSet.SoundSetPoint.BgPoint);
if (isLaOpen)
{
photoManager.DrawImageHelper.DrawImage(photoManager.SoundSet.SoundSetBitMapImage.OpenSoundImage, photoManager.SoundSet.SoundSetPoint.LbPoint, "");
}
else
{
photoManager.DrawImageHelper.DrawImage(photoManager.SoundSet.SoundSetBitMapImage.HidenSoudImage, photoManager.SoundSet.SoundSetPoint.LbPoint, "");
}
drawPreSoundImage();
photoManager.DrawImageHelper.DrawImage(photoManager.SoundSet.SoundSetBitMapImage.SoundPreImage, photoManager.SoundSet.SoundSetPoint.PrePoint, "");
photoManager.DrawImageHelper.DrawImage(photoManager.SoundSet.SoundSetBitMapImage.SoundNextImage, photoManager.SoundSet.SoundSetPoint.NextPoint, "");
photoManager.DrawImageHelper.DrawImage(photoManager.SoundSet.SoundSetBitMapImage.EnterImage, photoManager.SoundSet.SoundSetPoint.EnterPoint, "");
photoManager.DrawImageHelper.DrawImage(photoManager.SoundSet.SoundSetBitMapImage.BackImage, photoManager.SoundSet.SoundSetPoint.BackPoint, "");
g.DrawImage(offBitmap, 0, 0);
g.Dispose();
}
本人不知道什么叫重绘,但是可以直接调用一个最基本的方法重新绘制