Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to model an IC in WPF?
    primarykey
    data
    text
    <p>I'm building a user control using WPF to resemble a breadboard that will be used in an electronic circuits simulation software.</p> <p>The user will be able to add ICs onto that breadboard.</p> <p>I've finished building the breadboard right now, it consists mainly of a grid that has a number of cells equal to the number on nodes on a real breadboard..</p> <p>And right now I made users add ICs to that grid by specifying the <code>Grid.Row</code> and <code>Grid.Column</code> and determining its size by specifying <code>Grid.RowSpan</code> and <code>Grid.ColumnSpan</code>:</p> <p><img src="https://i.stack.imgur.com/e4jrR.png" alt="Like this photo.."></p> <p>Here is the C# code:</p> <pre><code>private int usedVerticalPins = 0; void AddICs(int pinNum) { var rect = new Rectangle() { Fill = new SolidColorBrush(Colors.Black),Stroke = new SolidColorBrush(Colors.White)}; rect.SetValue(Grid.RowProperty, usedVerticalPins); rect.SetValue(Grid.ColumnProperty, 7); rect.SetValue(Grid.RowSpanProperty, (pinNum / 2)); rect.SetValue(Grid.ColumnSpanProperty, 3); BreadboardControl.BreadboardGrid.Children.Add(rect); usedVerticalPins += (pinNum / 2); } </code></pre> <p>But as you can see, it looks like plain rectangles not as ICs, so I thought of inheriting the class Rectangle and edit the way it looks by I found that it is a sealed class..</p> <p>I want the ICs to look like <img src="https://i.stack.imgur.com/8TLvr.jpg" alt="this one"> with all pins and stuff..</p> <p>So can you please suggest a way to do it..!?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload