win 형태 C#에서 Venn 다이어그램을 만들어야합니다. 나는 Graphics.DrawEllipse와 FillElipse를 사용하여 그것을하려고 노력해왔다. 그러나 공통 부분을 어떻게 채울 수 있을지 확신하지 못합니다. 여기 C# win에서 Venn 다이어그램 만들기 양식
이 내 코드입니다내가 이것을 달성하고자,
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);
}
나는 두 개의 타원 그리기와 다른 색상을 가질 필요가 있어요 공통 부분. 라이브러리를 사용할 수 없습니다. 도와주세요.
사이드 참고 : 모든 브러시와 펜을 처분하거나 다시 사용하는 대신 지역 변수의 필드로를 설정하십시오. –