コード例 #1
0
        private void Port_MouseDown(object sender, MouseButtonEventArgs e)
        {
            var port = sender as ExternalPort;

            // use half of a column as margin before the line to get line centered
            double width  = Grid.ColumnDefinitions[0].ActualWidth;
            double height = Grid.RowDefinitions[0].ActualHeight;
            Point  point  = port.TranslatePoint(new Point(width / 2, height / 2), Grid);

            WireBuilder.AddPoint(point, port.IsInput);
        }
コード例 #2
0
        private void GatePortClicked(GateView gate, GatePortView port)
        {
            var point = port.TransformToAncestor(Grid).Transform(new Point(port.ActualWidth / 2, port.ActualHeight / 2));

            WireBuilder.AddPoint(point, !port.IsInput);
        }