我需要以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