/// <summary> /// User has clicked on a render pin menu item /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void renderPinMenuItem_Click(object sender, EventArgs e) { int hr = 0; // get the DaggerPin DSOutputPin pin = (sender as ToolStripMenuItem).Tag as DSOutputPin; // get the Parent UIGraph DSDaggerUIGraph parentui = this.Parent as DSDaggerUIGraph; // get the FilterGraph IGraphBuilder graph = parentui._Graph as IGraphBuilder; // atempt to render the pin try { hr = graph.Render(pin._pin); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error rendering pin"); } Point dropstart = parentui.PointToClient(this.PointToScreen((pin.PinUIElements as PinUI).PinLocation)); parentui._dropLocation = new Point(dropstart.X + 25, dropstart.Y); // Sync the graphs parentui.SyncGraphs(null); if (hr != 0) { MessageBox.Show(DsError.GetErrorText(hr)); } }
/// <summary> /// User has clicked the close filter button /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void _closeButton_Click(object sender, EventArgs e) { DSDaggerUIGraph parentGraph = Parent as DSDaggerUIGraph; parentGraph.Graph.DeleteNode(this._dsfilternode); parentGraph.RefreshGraph(); }
protected override void OnPaintBackground(PaintEventArgs e) { using (Brush br = new LinearGradientBrush(ClientRectangle, IsFocused ? CaptionColor : this.CaptionColorUnfocused, BackColor, LinearGradientMode.Vertical)) { e.Graphics.FillRectangle(br, ClientRectangle); } if ((Parent as DSDaggerUIGraph).ShowPinNames && !_expandPropertiesButton.State) { // measure and draw the names of it's pins foreach (DSInputPin pin in Node.InputPins) { SizeF fs = e.Graphics.MeasureString(pin.Name, Font); Point actualLocation = (pin.PinUIElements as PinUI).PinLocation; actualLocation.X = InternalControl.Left; RectangleF rect = new RectangleF(new PointF(actualLocation.X, actualLocation.Y), fs); DSDaggerUIGraph.DrawPinName(Font, e.Graphics, (pin.PinUIElements as PinUI).NoodleColor, pin.Name, rect); } foreach (DSOutputPin pin in Node.OutputPins) { SizeF fs = e.Graphics.MeasureString(pin.Name, Font); Point actualLocation = (pin.PinUIElements as PinUI).PinLocation; actualLocation.X = InternalControl.Right - (int)fs.Width; RectangleF rect = new RectangleF(new PointF(actualLocation.X, actualLocation.Y), fs); DSDaggerUIGraph.DrawPinName(Font, e.Graphics, (pin.PinUIElements as PinUI).NoodleColor, pin.Name, rect); } } }