如何在 pictureBox 角上绘制 filleeliipse?
How can I draw a filleeliipse on pictureBox corners?
我正在尝试在 0,0 处绘制一个椭圆并且它正在工作,但在另一侧 pictureBox1.Width 它没有绘制任何东西:
private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
e.Graphics.FillEllipse(Brushes.Purple, 0, 0, 5, 5);
e.Graphics.FillEllipse(Brushes.Purple, pictureBox1.Width, 0, 5, 5);
}
结果是在左侧 0,0 处填充了一个椭圆,但右侧什么也没有。
右边黄色的附近应该也有紫色的小点。
然后在 pictureBox1 的四个角上绘制实心椭圆。
The result is one ellipse filled on the left side at 0,0 but on the right side nothing. There should be small purple point also near the right yellow one.
这是因为它有点偏离屏幕,你需要调整X
坐标。
e.Graphics.FillEllipse(Brushes.Purple, pictureBox1.Width - 5, 0, 5, 5);
如果您想要所有四个角:
int circleSize = 5;
e.Graphics.FillEllipse(Brushes.Purple, 0, 0, circleSize, circleSize); //top left
e.Graphics.FillEllipse(Brushes.Purple, pictureBox1.Width - circleSize, 0, circleSize, circleSize); //top right
e.Graphics.FillEllipse(Brushes.Purple, pictureBox1.Width - circleSize, pictureBox1.Height - circleSize, circleSize, circleSize); //bottom right
e.Graphics.FillEllipse(Brushes.Purple, 0, pictureBox1.Height - circleSize, circleSize, circleSize); //bottom left
我正在尝试在 0,0 处绘制一个椭圆并且它正在工作,但在另一侧 pictureBox1.Width 它没有绘制任何东西:
private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
e.Graphics.FillEllipse(Brushes.Purple, 0, 0, 5, 5);
e.Graphics.FillEllipse(Brushes.Purple, pictureBox1.Width, 0, 5, 5);
}
结果是在左侧 0,0 处填充了一个椭圆,但右侧什么也没有。 右边黄色的附近应该也有紫色的小点。
然后在 pictureBox1 的四个角上绘制实心椭圆。
The result is one ellipse filled on the left side at 0,0 but on the right side nothing. There should be small purple point also near the right yellow one.
这是因为它有点偏离屏幕,你需要调整X
坐标。
e.Graphics.FillEllipse(Brushes.Purple, pictureBox1.Width - 5, 0, 5, 5);
如果您想要所有四个角:
int circleSize = 5;
e.Graphics.FillEllipse(Brushes.Purple, 0, 0, circleSize, circleSize); //top left
e.Graphics.FillEllipse(Brushes.Purple, pictureBox1.Width - circleSize, 0, circleSize, circleSize); //top right
e.Graphics.FillEllipse(Brushes.Purple, pictureBox1.Width - circleSize, pictureBox1.Height - circleSize, circleSize, circleSize); //bottom right
e.Graphics.FillEllipse(Brushes.Purple, 0, pictureBox1.Height - circleSize, circleSize, circleSize); //bottom left