我需要以C#格式创建维恩图表。我一直在尝试使用Graphics.DrawEllipse和FillElipse。但我不确定我如何填写常见部分。在C#win中创建维恩图表格
我要做到这一点,
这里是我的这段代码,
private void panelControlVennDiagram_Paint(object sender, PaintEventArgs e)
{
Brush brushLeft = new SolidBrush(Color.Blue);
Brush brushRight = new SolidBrush(Color.LightPink);
Brush brushCommon = new SolidBrush(Color.Purple);
Pen pen = new Pen(brushLeft, 10);
Rectangle leftVenn = new Rectangle(20, 50,100,100);
Rectangle rightVenn = new Rectangle(90, 50, 100, 100);
Rectangle commonVenn = new Rectangle(100, 120, 100, 100);
Font stringFont = new Font("Times New Roman", 9);
e.Graphics.DrawString("Left:" + leftValue, stringFont, brushLeft, 10,70);
e.Graphics.DrawString("Right:" + rightValue, stringFont, brushRight, 90,70);
e.Graphics.DrawString("Common:" + commonValue,stringFont, brushCommon, 100,70);
// Fill ellipse on screen.
e.Graphics.FillEllipse(brushLeft, leftVenn);
e.Graphics.FillEllipse(brushRight, rightVenn);
e.Graphics.DrawEllipse(Pens.White, leftVenn);
e.Graphics.DrawEllipse(Pens.White, rightVenn);
}
我绘制两个椭圆,需要有不同的颜色为通用部分。我无法使用任何图书馆。请帮忙。
边注:请处理所有的刷子和笔,或者把它们变成领域,而不是局部变量重新使用它们。 – 2014-08-28 06:31:40