c#,点击鼠标,在点击位置(坐标点)绘制绘制圆?
在panel上有PICBOX控件,点击任何位置都能得到一个坐标。请教点击位置怎么画个圆,或者在点击位置加个点标记出来。谢谢。急!!!!!namespaceWindowsF...
在panel上有PICBOX控件,点击任何位置都能得到一个坐标。请教点击位置怎么画个圆,或者在点击位置加个点标记出来。谢谢。急!!!!!
namespace WindowsForms
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
int x;
int y;
private void Form1_Load(object sender, EventArgs e) // 窗体加载时执行
{
}
private void panel1_MouseClick(object sender, MouseEventArgs e)
{
Point p = e.Location;
x = e.X;
y = e.Y;
displaycoord();
}
private void pictureBox1_MouseClick(object sender, MouseEventArgs e)
{
Point p = e.Location;
x = e.X+186; //此处为BOX的坐标,点击BOX显示相对panel的坐标值
y = e.Y+65;
displaycoord();
}
public void displaycoord()
{
MessageBox.Show("x坐标:" + x + " y坐标:" + y);
} 展开
namespace WindowsForms
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
int x;
int y;
private void Form1_Load(object sender, EventArgs e) // 窗体加载时执行
{
}
private void panel1_MouseClick(object sender, MouseEventArgs e)
{
Point p = e.Location;
x = e.X;
y = e.Y;
displaycoord();
}
private void pictureBox1_MouseClick(object sender, MouseEventArgs e)
{
Point p = e.Location;
x = e.X+186; //此处为BOX的坐标,点击BOX显示相对panel的坐标值
y = e.Y+65;
displaycoord();
}
public void displaycoord()
{
MessageBox.Show("x坐标:" + x + " y坐标:" + y);
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询