using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Test
{
public partial class Form1 : Form
{
int x1, x2, wid = 100;
public Form1()
{
InitializeComponent();
x1 = this.Width/2 ;
x2 = this.Height/2 ;
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void Form1_Paint(object sender, PaintEventArgs e)
{
e.Graphics.DrawEllipse(Pens.Red, x1,x2, wid, wid);
}
}
}
我想画的形式,中间的简单的圆形,然后后来我想提请从圆心出来线。我该怎么做 ?我如何绘制一个表格中间的圆圈,如何找到圆心?
*('x1','x2')*应该是圆心。 – oldrinb
这似乎是一个家庭作业问题。你有没有试图解决这个问题,如果是的话,你的具体问题是什么? –
@oldrinb,你错了:如果你使用(X1,X2),那么你将每次偏离中心!而是应该构建一个矩形,使用从这里(http://www.codeproject.com/Tips/403031/Extension-methods-for-finding-centers-of-a-rectang)的扩展方法来获得的中心点矩形,然后使用矩形构建椭圆。 – devinbost