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. Image for the cookie policy date

How to dynamicly create GroupBarItem and linklabels in GroupBarBox

I have a Group Bar named "tsbCategory" within XPTaskBarBox named tskReport. I want to dynamiclly populate tsbCategory''''s GroupBarItem with a string array named msCategories. Inside each GroupBarItem, I add a panel to hold several linklabel controls inside. I did it with following code. I can see the the group each bar item and its linklabels. The problem is the the GourpBar layout not freshed,the linklabel is overlaying on groupbar items. How can i sovle it? TIA Coding: private string[] msCategories={"Parameters","Models","Inventory","Present Status","Rehabilitation"}; private void frmReport_Load(object sender, System.EventArgs e) { foreach (string s in msCategories) { Syncfusion.Windows.Forms.Tools.GroupBarItem gbiCategory; gbiCategory = new Syncfusion.Windows.Forms.Tools.GroupBarItem(); gbiCategory.Tag=s; gbiCategory.Text=s; this.gbrCategory.GroupBarItems.Add(gbiCategory); Syncfusion.Windows.Forms.Tools.GradientPanel pnlClient; pnlClient = new Syncfusion.Windows.Forms.Tools.GradientPanel(); gbiCategory.Client = pnlClient; gbiCategory.Client.Width=172; gbiCategory.Client.Height=172; gbiCategory.Visible=true; pnlClient.Visible=true; pnlClient.Name = "pnl" + s; pnlClient.BackColor = System.Drawing.Color.Transparent; pnlClient.Border3DStyle = System.Windows.Forms.Border3DStyle.Flat; pnlClient.BorderColor = System.Drawing.Color.Transparent; pnlClient.BorderStyle = System.Windows.Forms.BorderStyle.None; pnlClient.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); pnlClient.Location = new System.Drawing.Point(0, 0); pnlClient.Size = new System.Drawing.Size(172, 172); this.gbrCategory.Controls.Add(pnlClient); for (int i=1;i<=10;i++) { STN.PMA.UL.tmpLinkLabel lnkRpt1=new tmpLinkLabel(); lnkRpt1.Text="Report"+i.ToString(); lnkRpt1.Name="Report"+i.ToString(); lnkRpt1.Visible=true; lnkRpt1.Location=new Point(0,(i-1)*20); pnlClient.Controls.Add(lnkRpt1); } gbiCategory.Client.Refresh(); this.Refresh(); } }

4 Replies

AD Administrator Syncfusion Team September 18, 2004 11:04 PM UTC

Hi, I have created a test sample as per your specifications and have attached it here. I could not see any overlay problems with the GroupBarItems/LinkLabels. Please refer to it and let me know if I have not understood the problem correctly. If so, kindly modify the sample to show the problem and send it back to us so that we could further investigate it. Note that this sample was created using v2.1.0.9. Please upgrade to the same if you are using an older version. We appreciate your interest in Syncfusion products. Regards, Guru Patwal Syncfusion, Inc.


AD Administrator Syncfusion Team September 20, 2004 03:03 PM UTC

I did it like your sample. It works now. Thank you very much! >Hi, > >I have created a test sample as per your specifications and have attached it here. I could not see any overlay problems with the GroupBarItems/LinkLabels. Please refer to it and let me know if I have not understood the problem correctly. If so, kindly modify the sample to show the problem and send it back to us so that we could further investigate it. Note that this sample was created using v2.1.0.9. Please upgrade to the same if you are using an older version. We appreciate your interest in Syncfusion products. > >Regards, >Guru Patwal >Syncfusion, Inc.


AD Administrator Syncfusion Team September 22, 2004 02:22 PM UTC

One more question. Because the linkelable text is from database table, It is hard to decide the width of the linklabel. I want to let user to change the GroupBar width by drag it''s edge line and the linklabel auto-expand to the new width. E.g in your examples, if the Loinklabel.Name is "Sectional Attributes Structur Data " , the linklable is hard to see. How can I make it fit all length of linklabel text? TIA >Hi, > >I have created a test sample as per your specifications and have attached it here. I could not see any overlay problems with the GroupBarItems/LinkLabels. Please refer to it and let me know if I have not understood the problem correctly. If so, kindly modify the sample to show the problem and send it back to us so that we could further investigate it. Note that this sample was created using v2.1.0.9. Please upgrade to the same if you are using an older version. We appreciate your interest in Syncfusion products. > >Regards, >Guru Patwal >Syncfusion, Inc.


AD Administrator Syncfusion Team September 23, 2004 02:17 AM UTC

Hi, If the length of the LinkLabels vary a lot and in some cases the GroupBar cannot display the entire LinkLabel, resize the GroupBar dynamically based on the length of the longest LinkLabel. Please refer to the button''s Click event handler that shows how you could do this : int longestlabel; private void button2_Click(object sender, System.EventArgs e) { int count=1; foreach (GroupBarItem gbi in this.groupBar1.GroupBarItems) { Panel panel = new Panel(); // To layout the LinkLabels one below the other FlowLayout flowlayout = new FlowLayout(panel); panel.Name = "Panel" + count.ToString(); gbi.Client = panel; // Assume that the text for the LinkLabels is read from a DataBase using a loop for (int i=0; i<3; i++) { LinkLabel label = new LinkLabel(); label.Name = "LinkLabel" + (i+1).ToString(); switch (i) { case 0 : label.Text = "LinkLabel" + (i+1).ToString(); break; case 1 : label.Text = "LongLinkLabel" + (i+1).ToString(); break; case 2 : label.Text = "LongestLinkLabel" + (i+1).ToString(); break; } if (i==0) longestlabel = label.Width; else if (label.Width > longestlabel) longestlabel = label.Width; panel.Controls.Add(label); } count++; } // To force a repaint this.groupBar1.GroupBarItems[this.groupBar1.SelectedItem].Visible = false; this.groupBar1.GroupBarItems[this.groupBar1.SelectedItem].Visible = true; this.groupBar1.Width = longestlabel + 50; } I have modified my previous sample accordingly and have attached it here. Please refer to it and let me know if this works for you. Regards, Guru Patwal Syncfusion, Inc.

Loader.
Live Chat Icon For mobile
Up arrow icon