日期:2014-05-18  浏览次数:20824 次

请高手指教:如果用鼠标在WINFORM程序上画图?(panel中填充了播放器)
1:我想在播放器上用鼠标拖个椭圆出来,单纯在panel上我可以做到,但是填充了播放器后,就看不到拖出的椭圆。我该怎么做?
2:如何得到坐标,相对于panel的坐标,不是form的坐标。

------解决方案--------------------
调试看效果吧,不明白的地方就自己查资料
C# code
private void button1_Click(object sender, EventArgs e)
{
    panel1.BorderStyle = BorderStyle.None;
    panel1.BackColor = Color.Blue;
    GraphicsPath vGraphicsPath = new GraphicsPath();
    vGraphicsPath.AddEllipse(new Rectangle(0, 0, panel1.Width, panel1.Height));
    vGraphicsPath.AddEllipse(new Rectangle(10, 10, 
        panel1.Width - 20, panel1.Height - 20));
    panel1.Region = new Region(vGraphicsPath);
}