We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

load custom symbol into palatte

Thread ID:

Created:

Updated:

Platform:

Replies:

19073 Sep 17,2004 12:51 AM UTC Sep 20,2004 03:57 PM UTC WinForms 8
loading
Tags: Diagram
ll
Asked On September 17, 2004 12:51 AM UTC

If creating a custom symbol, How can I load it to palatte, then it can be drag and drop into diagram? thanks,

Administrator [Syncfusion]
Replied On September 17, 2004 06:44 PM UTC

Hi Chris Here is a sample which demonstrates what you are looking for. Build and run the sample to see how you can add a Custom Symbol by clicking on the button or by dragging and dropping it from the PaletteGroupBar. Regards Arun

ll
Replied On September 17, 2004 07:44 PM UTC

Hi Arun, Thanks. It is amazing support!! 1, Can I right_click on the symbol, seems no MouseDown event in Model; 2, Symbol designer seems confusion with names. Symbol''s name, shape''s name? For example I use rect, circle...to make up a symbol, the names seems a little mess. anyway now I try to use single shape to present a symbol, seems ok. 3, Drag and drop symbol into diagram, ok now. However if I drop two same symbols, the second one has the same name as the first one. But in your code, the second one automatically become MySymbol1... Any ideas?? Thanks, Chris >If creating a custom symbol, How can I load it to palatte, then it can be drag and drop into diagram? > >thanks,

Administrator [Syncfusion]
Replied On September 18, 2004 03:14 PM UTC

Hi Chris Thanks for the compliments. With reference to your follow up questions: 1. We have an open QA incident on this issue. We will be implementing Left and Right Mouse Button click events that can be handled from within the Model instance similar to the current Model.Click events. Currently you can work around this by using the Diagram''s MouseUp event. Here is a code snippet you can paste into the sample posted earlier: private void diagram1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) { if(e.Button == MouseButtons.Right) { foreach (INode curNode in this.diagram1.Controller.NodesHit) { if (curNode.GetType() == typeof(MySymbol)) MessageBox.Show(String.Concat("Right Click on: ", curNode.Name)); } } } 2. When using the Symbol Designer the name of the Symbol is displayed in the tab and will be displayed in the Property Editor if you click outside the nodes (shapes) you are adding to create the Symbol. If you click withiin the Symbol, the property of the appropriate node will be displayed. For example if you are creating a symbol called MySymbol which consists of say a Circle in a Rectangle. When clicking on the Symbol the appropriate properties for either the Circle or Square will be displayed in the Property Editor and if you click outside, the Property Editor will display properties of MySymbol. 3. How are you adding the Symbols? Can you post a small sample so that we can take a look at this issue. Regards, Arun

ll
Replied On September 18, 2004 08:13 PM UTC

Arun, Thanks. a) Mouse right_click, I will try to use Mouse_Up, if it works, it is fine for me. b) I knew the names defined for symbol and shapes. I did set name of the symbol. However when I drag/drop symbol into diagram, using Tooltip to show the name of the symbol, it shows names are rect( when entering rect), ellipse (when enter ellipse area), then Mysymbol (when mouse close to center). But it works fine in your exmple, any tips? //code for tooltip private void Model_MouseEnter(object sender, Syncfusion.Windows.Forms.Diagram.NodeMouseEventArgs evtArgs) { this.toolTipSymbol.SetToolTip(this.diagram1, evtArgs.Node.Name.ToString()); this.toolTipSymbol.Active = true; } private void Model_MouseLeave(object sender, Syncfusion.Windows.Forms.Diagram.NodeMouseEventArgs evtArgs) { this.toolTipSymbol.Active = false; } c) I can load symbol into a pallete after simulating your example. However two problems, 1,I cannot drag/drop from paletter into diagram 2,how can I use palettegroupview in palette programably. And I would have several goups, (Instruments symbols, Components symbols...) how can I handle multi-palettegroupbar and multi-groupviews? And more the sybmbol looks like disabled in the palette, not like a push button with fixed 3D border, why? ///private void MainForm_Load(object sender, System.EventArgs e) { SymbolPalette InstrumentsPalette = new SymbolPalette(); InstrumentsPalette.Name = "InstrumentsSymbols"; SymbolModel InsSymbolModel = new SymbolModel(); InsSymbolModel = InstrumentsPalette.AddSymbol("Symbol_Powermeter"); InsSymbolModel.PlugInAssembly = "InstrumentsSymbols"; InsSymbolModel.PlugInClass = "InstrumentsSymbols.Symbol_Powermeter"; this.paletteGroupBar1.AddPalette(InstrumentsPalette); } public class Symbol_Powermeter : Syncfusion.Windows.Forms.Diagram.Symbol { private Syncfusion.Windows.Forms.Diagram.Rectangle outerRect = null; private Ellipse innerEllipse = null; private int curEllipseColor = 0; private Syncfusion.Windows.Forms.Diagram.Label lbl=null; static System.Drawing.Color[] ellipseColors = { Color.LightBlue, Color.Silver, Color.Yellow, Color.MidnightBlue }; public Symbol_Powermeter() { // Add an outer rectangle this.outerRect = new Syncfusion.Windows.Forms.Diagram.Rectangle(0, 0, 120, 80); this.outerRect.Name = "Rectangle"; this.outerRect.FillStyle.Color = Color.Khaki; this.AppendChild(outerRect); // Add an inner ellipse this.innerEllipse = new Ellipse(10, 10, 100, 60); this.innerEllipse.Name = "Ellipse"; this.AppendChild(innerEllipse); //Add Label Syncfusion.Windows.Forms.Diagram.Label lbl = this.AddLabel("Power meter", BoxPosition.Center); lbl.BackgroundStyle.Color = Color.Transparent; } protected override void OnMouseEnter(NodeMouseEventArgs evtArgs) { this.outerRect.FillStyle.Color = Color.Green; } protected override void OnMouseLeave(NodeMouseEventArgs evtArgs) { this.outerRect.FillStyle.Color = Color.Khaki; } protected override void OnClick(NodeMouseEventArgs evtArgs) { if (this.curEllipseColor == ellipseColors.Length-1) { this.curEllipseColor = 0; } else { this.curEllipseColor++; } this.innerEllipse.FillStyle.Color = ellipseColors[this.curEllipseColor]; } } 3, How can I add port into a symbol programmably? I didn''t find any examples in Forum and KB. I appreciate you help. Chris >Hi Chris > >Thanks for the compliments. With reference to your follow up questions: > >1. We have an open QA incident on this issue. We will be implementing Left and Right Mouse Button click events that can be handled from within the Model instance similar to the current Model.Click events. Currently you can work around this by using the Diagram''s MouseUp event. Here is a code snippet you can paste into the sample posted earlier: > >private void diagram1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) >{ > if(e.Button == MouseButtons.Right) > { > foreach (INode curNode in this.diagram1.Controller.NodesHit) > { > if (curNode.GetType() == typeof(MySymbol)) > MessageBox.Show(String.Concat("Right Click on: ", curNode.Name)); > } > > } >} > > >2. When using the Symbol Designer the name of the Symbol is displayed in the tab and will be displayed in the Property Editor if you click outside the nodes (shapes) you are adding to create the Symbol. If you click withiin the Symbol, the property of the appropriate node will be displayed. For example if you are creating a symbol called MySymbol which consists of say a Circle in a Rectangle. When clicking on the Symbol the appropriate properties for either the Circle or Square will be displayed in the Property Editor and if you click outside, the Property Editor will display properties of MySymbol. > >3. How are you adding the Symbols? Can you post a small sample so that we can take a look at this issue. > >Regards, >Arun

ll
Replied On September 19, 2004 06:51 PM UTC

Hi Arun, more tries over weekends. a) If making a class PowerMeter in your mycustomsymbol, which has the same as mysymbol class, I cannot drop symbols. b) If I copy the file in your example mysymbol.cs, and just change name to powermeter, then it works. OH, stuck!! c) I cannot drop symbol in my real application, where I use MDI. Even if I copy mysymbol.cs and rename...still not working in my MDI application. Thanks, Chris >Arun, >Thanks. > >a) Mouse right_click, I will try to use Mouse_Up, if it works, it is fine for me. > >b) I knew the names defined for symbol and shapes. I did set name of the symbol. However when I drag/drop symbol into diagram, using Tooltip to show the name of the symbol, it shows names are rect( when entering rect), ellipse (when enter ellipse area), then Mysymbol (when mouse close to center). But it works fine in your exmple, any tips? >//code for tooltip >private void Model_MouseEnter(object sender, Syncfusion.Windows.Forms.Diagram.NodeMouseEventArgs evtArgs) > { > this.toolTipSymbol.SetToolTip(this.diagram1, evtArgs.Node.Name.ToString()); > this.toolTipSymbol.Active = true; > > > } > > private void Model_MouseLeave(object sender, Syncfusion.Windows.Forms.Diagram.NodeMouseEventArgs evtArgs) > { > this.toolTipSymbol.Active = false; > > } > >c) I can load symbol into a pallete after simulating your example. However two problems, >1,I cannot drag/drop from paletter into diagram >2,how can I use palettegroupview in palette programably. And I would have several goups, (Instruments symbols, Components symbols...) how can I handle multi-palettegroupbar and multi-groupviews? And more the sybmbol looks like disabled in the palette, not like a push button with fixed 3D border, why? >///private void MainForm_Load(object sender, System.EventArgs e) > { > > SymbolPalette InstrumentsPalette = new SymbolPalette(); > InstrumentsPalette.Name = "InstrumentsSymbols"; > SymbolModel InsSymbolModel = new SymbolModel(); > InsSymbolModel = InstrumentsPalette.AddSymbol("Symbol_Powermeter"); > InsSymbolModel.PlugInAssembly = "InstrumentsSymbols"; > InsSymbolModel.PlugInClass = "InstrumentsSymbols.Symbol_Powermeter"; > this.paletteGroupBar1.AddPalette(InstrumentsPalette); >} > >public class Symbol_Powermeter : Syncfusion.Windows.Forms.Diagram.Symbol > { > private Syncfusion.Windows.Forms.Diagram.Rectangle > outerRect = null; > private Ellipse innerEllipse = null; > private int curEllipseColor = 0; > private Syncfusion.Windows.Forms.Diagram.Label lbl=null; > static System.Drawing.Color[] ellipseColors = > { > Color.LightBlue, > Color.Silver, > Color.Yellow, > Color.MidnightBlue > }; > > > > public Symbol_Powermeter() > { > // Add an outer rectangle > this.outerRect = new Syncfusion.Windows.Forms.Diagram.Rectangle(0, 0, 120, 80); > this.outerRect.Name = "Rectangle"; > this.outerRect.FillStyle.Color = Color.Khaki; > this.AppendChild(outerRect); > > // Add an inner ellipse > this.innerEllipse = new Ellipse(10, 10, 100, 60); > this.innerEllipse.Name = "Ellipse"; > this.AppendChild(innerEllipse); > > //Add Label > Syncfusion.Windows.Forms.Diagram.Label lbl = this.AddLabel("Power meter", BoxPosition.Center); > lbl.BackgroundStyle.Color = Color.Transparent; > > > } > > > protected override void OnMouseEnter(NodeMouseEventArgs evtArgs) > { > this.outerRect.FillStyle.Color = Color.Green; > } > > protected override void OnMouseLeave(NodeMouseEventArgs evtArgs) > { > this.outerRect.FillStyle.Color = Color.Khaki; > } > > protected override void OnClick(NodeMouseEventArgs evtArgs) > { > if (this.curEllipseColor == ellipseColors.Length-1) > { > this.curEllipseColor = 0; > } > else > { > this.curEllipseColor++; > } > this.innerEllipse.FillStyle.Color = > ellipseColors[this.curEllipseColor]; > } > > > > } >3, How can I add port into a symbol programmably? I didn''t find any examples in Forum and KB. > >I appreciate you help. > >Chris >>Hi Chris >> >>Thanks for the compliments. With reference to your follow up questions: >> >>1. We have an open QA incident on this issue. We will be implementing Left and Right Mouse Button click events that can be handled from within the Model instance similar to the current Model.Click events. Currently you can work around this by using the Diagram''s MouseUp event. Here is a code snippet you can paste into the sample posted earlier: >> >>private void diagram1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) >>{ >> if(e.Button == MouseButtons.Right) >> { >> foreach (INode curNode in this.diagram1.Controller.NodesHit) >> { >> if (curNode.GetType() == typeof(MySymbol)) >> MessageBox.Show(String.Concat("Right Click on: ", curNode.Name)); >> } >> >> } >>} >> >> >>2. When using the Symbol Designer the name of the Symbol is displayed in the tab and will be displayed in the Property Editor if you click outside the nodes (shapes) you are adding to create the Symbol. If you click withiin the Symbol, the property of the appropriate node will be displayed. For example if you are creating a symbol called MySymbol which consists of say a Circle in a Rectangle. When clicking on the Symbol the appropriate properties for either the Circle or Square will be displayed in the Property Editor and if you click outside, the Property Editor will display properties of MySymbol. >> >>3. How are you adding the Symbols? Can you post a small sample so that we can take a look at this issue. >> >>Regards, >>Arun

ll
Replied On September 19, 2004 11:13 PM UTC

Arun, Update! 1, Mouss_up to detect right_click works. 2, I figured out how to use custom symbol, and able to drag and drop into diagram. I was confused by plugin assembly and class. 3,Still has problem to add ports into symbol, can you have some examples by code? Thanks, Chris >Hi Arun, > >more tries over weekends. > >a) If making a class PowerMeter in your mycustomsymbol, which has the same as mysymbol class, I cannot drop symbols. > >b) If I copy the file in your example mysymbol.cs, and just change name to powermeter, then it works. OH, stuck!! > >c) I cannot drop symbol in my real application, where I use MDI. Even if I copy mysymbol.cs and rename...still not working in my MDI application. > >Thanks, >Chris >>Arun, >>Thanks. >> >>a) Mouse right_click, I will try to use Mouse_Up, if it works, it is fine for me. >> >>b) I knew the names defined for symbol and shapes. I did set name of the symbol. However when I drag/drop symbol into diagram, using Tooltip to show the name of the symbol, it shows names are rect( when entering rect), ellipse (when enter ellipse area), then Mysymbol (when mouse close to center). But it works fine in your exmple, any tips? >>//code for tooltip >>private void Model_MouseEnter(object sender, Syncfusion.Windows.Forms.Diagram.NodeMouseEventArgs evtArgs) >> { >> this.toolTipSymbol.SetToolTip(this.diagram1, evtArgs.Node.Name.ToString()); >> this.toolTipSymbol.Active = true; >> >> >> } >> >> private void Model_MouseLeave(object sender, Syncfusion.Windows.Forms.Diagram.NodeMouseEventArgs evtArgs) >> { >> this.toolTipSymbol.Active = false; >> >> } >> >>c) I can load symbol into a pallete after simulating your example. However two problems, >>1,I cannot drag/drop from paletter into diagram >>2,how can I use palettegroupview in palette programably. And I would have several goups, (Instruments symbols, Components symbols...) how can I handle multi-palettegroupbar and multi-groupviews? And more the sybmbol looks like disabled in the palette, not like a push button with fixed 3D border, why? >>///private void MainForm_Load(object sender, System.EventArgs e) >> { >> >> SymbolPalette InstrumentsPalette = new SymbolPalette(); >> InstrumentsPalette.Name = "InstrumentsSymbols"; >> SymbolModel InsSymbolModel = new SymbolModel(); >> InsSymbolModel = InstrumentsPalette.AddSymbol("Symbol_Powermeter"); >> InsSymbolModel.PlugInAssembly = "InstrumentsSymbols"; >> InsSymbolModel.PlugInClass = "InstrumentsSymbols.Symbol_Powermeter"; >> this.paletteGroupBar1.AddPalette(InstrumentsPalette); >>} >> >>public class Symbol_Powermeter : Syncfusion.Windows.Forms.Diagram.Symbol >> { >> private Syncfusion.Windows.Forms.Diagram.Rectangle >> outerRect = null; >> private Ellipse innerEllipse = null; >> private int curEllipseColor = 0; >> private Syncfusion.Windows.Forms.Diagram.Label lbl=null; >> static System.Drawing.Color[] ellipseColors = >> { >> Color.LightBlue, >> Color.Silver, >> Color.Yellow, >> Color.MidnightBlue >> }; >> >> >> >> public Symbol_Powermeter() >> { >> // Add an outer rectangle >> this.outerRect = new Syncfusion.Windows.Forms.Diagram.Rectangle(0, 0, 120, 80); >> this.outerRect.Name = "Rectangle"; >> this.outerRect.FillStyle.Color = Color.Khaki; >> this.AppendChild(outerRect); >> >> // Add an inner ellipse >> this.innerEllipse = new Ellipse(10, 10, 100, 60); >> this.innerEllipse.Name = "Ellipse"; >> this.AppendChild(innerEllipse); >> >> //Add Label >> Syncfusion.Windows.Forms.Diagram.Label lbl = this.AddLabel("Power meter", BoxPosition.Center); >> lbl.BackgroundStyle.Color = Color.Transparent; >> >> >> } >> >> >> protected override void OnMouseEnter(NodeMouseEventArgs evtArgs) >> { >> this.outerRect.FillStyle.Color = Color.Green; >> } >> >> protected override void OnMouseLeave(NodeMouseEventArgs evtArgs) >> { >> this.outerRect.FillStyle.Color = Color.Khaki; >> } >> >> protected override void OnClick(NodeMouseEventArgs evtArgs) >> { >> if (this.curEllipseColor == ellipseColors.Length-1) >> { >> this.curEllipseColor = 0; >> } >> else >> { >> this.curEllipseColor++; >> } >> this.innerEllipse.FillStyle.Color = >> ellipseColors[this.curEllipseColor]; >> } >> >> >> >> } >>3, How can I add port into a symbol programmably? I didn''t find any examples in Forum and KB. >> >>I appreciate you help. >> >>Chris >>>Hi Chris >>> >>>Thanks for the compliments. With reference to your follow up questions: >>> >>>1. We have an open QA incident on this issue. We will be implementing Left and Right Mouse Button click events that can be handled from within the Model instance similar to the current Model.Click events. Currently you can work around this by using the Diagram''s MouseUp event. Here is a code snippet you can paste into the sample posted earlier: >>> >>>private void diagram1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) >>>{ >>> if(e.Button == MouseButtons.Right) >>> { >>> foreach (INode curNode in this.diagram1.Controller.NodesHit) >>> { >>> if (curNode.GetType() == typeof(MySymbol)) >>> MessageBox.Show(String.Concat("Right Click on: ", curNode.Name)); >>> } >>> >>> } >>>} >>> >>> >>>2. When using the Symbol Designer the name of the Symbol is displayed in the tab and will be displayed in the Property Editor if you click outside the nodes (shapes) you are adding to create the Symbol. If you click withiin the Symbol, the property of the appropriate node will be displayed. For example if you are creating a symbol called MySymbol which consists of say a Circle in a Rectangle. When clicking on the Symbol the appropriate properties for either the Circle or Square will be displayed in the Property Editor and if you click outside, the Property Editor will display properties of MySymbol. >>> >>>3. How are you adding the Symbols? Can you post a small sample so that we can take a look at this issue. >>> >>>Regards, >>>Arun

Administrator [Syncfusion]
Replied On September 20, 2004 03:18 PM UTC

Hi Chris Thanks for the update. I suspected that the problem was due to specifying the assembly incorrectly. I am including a modified version of the sample I posted earlier, which demonstrates: a) how you can add more symbols to a palette b) how you can add more palettes to the PaletteGroupBar. and drag and drop these Symbols to the Diagram. Regards Arun

ll
Replied On September 20, 2004 03:57 PM UTC

Arun, All works for now. I appreciate your help. Chris >Hi Chris > >Thanks for the update. I suspected that the problem was due to specifying the assembly incorrectly. > >I am including a modified version of the sample I posted earlier, which demonstrates: > >a) how you can add more symbols to a palette >b) how you can add more palettes to the PaletteGroupBar. > >and drag and drop these Symbols to the Diagram. > >Regards >Arun

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;