all.
I'm working on a personal project to learn more about C#. This project consists of a logic diagram editor and I'm using a TreeView component to show to the user all the possible objects that can be created on a panel to draw the logic diagram.
I've been able to instantiate new objects inside the panel every time one of the options is clicked in the TreeView, but I still have to work on each logic gate drawing. Until now I have used the GraphicsPath class to define the AND and the NAND gates and everything went fine. However, I'm facing some troubles to draw the OR gate.
I'm trying to follow the IEEE standard to draw all the logic gates with the correct proportion and based on this standard, the OR gate should be drawn like below:
However, what I was able to get is the following:
My shameful attempt to draw an OR gate
The code I wrote to get this result is (this code is part of a custom control I created):
Pen pen = new Pen(Color.Black, 2);
GraphicsPath pathOR = new GraphicsPath();
pathOR.AddArc(7 - 2 * iHeight, 0 - iHeight / 2, 2 * iHeight, 2 * iHeight, 330, 60);
pathOR.AddLine(1, 1, 16, 1);
pathOR.AddArc(17 - iHeight, 1, 2 * iHeight, 2 * iHeight, 270, 56);
pathOR.AddArc(17 - iHeight, 0 - iHeight - 4, 2 * iHeight, 2 * iHeight, 33, 56);
pathOR.AddLine(16, iHeight - 3, 1, iHeight - 3);
e.Graphics.DrawPath(pen, pathOR);
iHeight
contains the object's height.The tricky part is the leftmost arc, but I've already tried many variations and nothing solved the problem. What am I doing wrong?
Thank you for any support!