populate gridlayout at runtime

I'm trying the GridLayout control ...
I need to add controls to the GridLayout at RunTime. I created a form and added GridLayout1, then:

            Dim rg As New Syncfusion.Windows.Forms.Gauge.RadialGauge
            rg.GaugeLabel = "350 / 50"
            rg.MinimumValue = 0
            rg.MaximumValue = 350
            rg.MinorDifference = 5
            rg.MajorDifference = 50
            rg.Size = New Size(200, 200)
            rg.EnableCustomNeedles = True
            rg.MinorInnerLinesHeight = 0
            rg.MinorTickMarkHeight = 0
            rg.Ranges.Clear()

            Me.GridLayout1.Rows = 5
            Me.GridLayout1.Columns = 20

            Me.GridLayout1.SetParticipateInLayout(rg, True)

but nothing is displayed.

What am I wrong?

Greetings.

Beppe

13 Replies

MK Mallika Kannan Syncfusion Team February 12, 2018 07:06 AM UTC

Hi Beppe,  
   
Thank you for contacting Syncfusion support.   
   
We have checked the reported query “Add Controls to the GridLayout at Runtime”. In your updated code, RadialGauge Control is not added to the Form, so, it was not displayed. The following code can be used to add the Controls to Form. Please make use of the below Code Example.   
 
Code Example: [VB] 
 
rg = New Syncfusion.Windows.Forms.Gauge.RadialGauge() 
rg.GaugeLabel = "350 / 50" 
rg.MinimumValue = 0 
rg.MaximumValue = 350 
rg.MinorDifference = 5 
rg.MajorDifference = 50 
rg.Size = New Size(200, 200) 
rg.EnableCustomNeedles = True 
rg.MinorInnerLinesHeight = 0 
rg.MinorTickMarkHeight = 0 
rg.Ranges.Clear() 
gridLayout1.Columns = 5 
gridLayout1.Rows = 20 
gridLayout1.SetParticipateInLayout(rg, True) 
'Add RadialGauge Control 
Me.Controls.Add(Me.rg) 
 
Screenshot 
 
 
 
We have prepared sample which tries to meet your requirement.  It can be downloaded from below location.    
   
  
Please try this above solution and let us know if it is helpful.   
   
Regards,   
Mallika   
 



BS BEPPE SALVADERI February 12, 2018 03:01 PM UTC

Sorry but I do not understand!
Does the  Me.Controls.Add(Me.rg) statement not add the RadialGauge to the form? 
I did a test and it does not work for me. It gives me the error: rg is not a member of Form1.
I am attaching my test project.

What I would like to create is this (with RadialGauge instead of charts):

Thank you very much
Beppe


Attachment: GLM_9af32ccf.zip


MK Mallika Kannan Syncfusion Team February 13, 2018 10:00 AM UTC

Hi Beppe 
 
Thanks for your update. 
 
We have checked your sample. In Your sample, you have created instance for the RadialGauge control in Button Click event and it is not a member of the Form. So, you get the “rg is not a member of Form1” error. We suggest you to create the instance of RadialGauge control in Form then initialize the RadialGauge Control on Button Click Event. The following code demonstrates the same. 
 
Code Example: [VB] 
 
'Create instance of RadialGauge Control  
Private rg As Syncfusion.Windows.Forms.Gauge.RadialGauge 
 
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click 
Try 
'initialize the Syncfusion RadialGauge Control 
rg = New Syncfusion.Windows.Forms.Gauge.RadialGauge() 
rg.GaugeLabel = "350 / 50" 
rg.MinimumValue = 0 
rg.MaximumValue = 350 
rg.MinorDifference = 5 
rg.MajorDifference = 50 
rg.Size = New Size(200, 200) 
rg.EnableCustomNeedles = True 
rg.MinorInnerLinesHeight = 0 
rg.MinorTickMarkHeight = 0 
rg.Ranges.Clear() 
 
Me.GridLayout1.Rows = 5 
Me.GridLayout1.Columns = 20 
Me.GridLayout1.SetParticipateInLayout(rg, True) 
Me.Controls.Add(Me.rg) 
 
 
Screenshot 
 
 
 
We have modified your sample for the same. It can be downloaded from the below link. 
 
 
Please try this above solution and let us know if it is helpful. 
 
Regards, 
Mallika 
 



BS BEPPE SALVADERI February 14, 2018 01:38 PM UTC

Hi Mallika,
Thanks for the reply.
It works but ... the RadialGauge is added to Form1; I want to add it to the GridLayout. The GridLayout is a container of controls, right?
My final purpose is to populate GridLayout with many RadialGauge and related row and column headers.

Regards.
Beppe


MK Mallika Kannan Syncfusion Team February 15, 2018 11:51 AM UTC

Hi Beppe   
   
Thanks for your update.   
   
Query 1: the RadialGauge is added to Form1; I want to add it to the GridLayout. The GridLayout is a container of controls, right?   
   
GridLayout Control is a Layout Manager. It will arrange child controls in the form of a grid containing rows and columns without header. Please refer the below documentation,   
   
   
Query 2: My final purpose is to populate GridLayout with many RadialGauge and related row and column headers.   
   
We have prepared the sample for your query “Populate GridLayout with many RadialGauge and related row and column headers”. In this Sample, we have loaded the RadialGauge control into Grid cell using GridControl. Please make use of the below Code example.   
   
Code Example: [VB] 
 
'Set Row Count 
gridControl1.RowCount = 5 
'Set Column Count 
gridControl1.ColCount = 4 
'Set Row height 
Me.gridControl1.RowHeightEntries.AddRange(New Syncfusion.Windows.Forms.Grid.GridRowHeight() { 
New Syncfusion.Windows.Forms.Grid.GridRowHeight(0, 30), 
New Syncfusion.Windows.Forms.Grid.GridRowHeight(1, 300), 
New Syncfusion.Windows.Forms.Grid.GridRowHeight(2, 300), 
New Syncfusion.Windows.Forms.Grid.GridRowHeight(3, 300), 
New Syncfusion.Windows.Forms.Grid.GridRowHeight(4, 300), 
New Syncfusion.Windows.Forms.Grid.GridRowHeight(5, 300) 
}) 
'set Column Width 
Me.gridControl1.ColWidthEntries.AddRange(New Syncfusion.Windows.Forms.Grid.GridColWidth() { 
New Syncfusion.Windows.Forms.Grid.GridColWidth(0, 200), 
New Syncfusion.Windows.Forms.Grid.GridColWidth(1, 300), 
New Syncfusion.Windows.Forms.Grid.GridColWidth(2, 300), 
New Syncfusion.Windows.Forms.Grid.GridColWidth(3, 300), 
New Syncfusion.Windows.Forms.Grid.GridColWidth(4, 300) 
}) 
'Set Column Header 
gridControl1(0, 1).CellValue = "SETT2018/06" 
gridControl1(0, 2).CellValue = "SETT2018/07" 
gridControl1(0, 3).CellValue = "SETT2018/08" 
gridControl1(0, 4).CellValue = "SETT2018/09" 
'Set Row Header 
gridControl1(1, 0).CellValue = "GRUPPO 1" 
gridControl1(2, 0).CellValue = "GRUPPO 2" 
gridControl1(3, 0).CellValue = "GRUPPO 3" 
gridControl1(4, 0).CellValue = "GRUPPO 4" 
gridControl1(5, 0).CellValue = "GRUPPO ---" 
'Radial Gauge 
rg = New Syncfusion.Windows.Forms.Gauge.RadialGauge() 
rg.GaugeLabel = "350 / 50" 
rg.MinimumValue = 0 
rg.MaximumValue = 350 
rg.MinorDifference = 5 
rg.MajorDifference = 50 
rg.Size = New Size(200, 200) 
rg.EnableCustomNeedles = True 
rg.MinorInnerLinesHeight = 0 
rg.MinorTickMarkHeight = 0 
rg.Ranges.Clear() 
'Load Radial Gauge into Grid Control 
For i As Integer = 1 To gridControl1.RowCount 
For j As Integer = 1 To gridControl1.ColCount 
'Set the GridControl CellType as Control 
gridControl1(i, j).CellType = "Control" 
'set the Radial Gauge control into Grid Cell 
gridControl1(i, j).Control = rg 
Next j 
 
Next i 
 
Screenshot 
 
 
 
   
Please get back to us with more details, if the above solution doesn’t meet your requirement.   
   
Regards,   
Mallika   



BS BEPPE SALVADERI February 16, 2018 04:03 PM UTC

Hi Mallika,
it seems to me that it is precisely the control I was looking for!
I do some tests ...
Thank you
Beppe


MK Mallika Kannan Syncfusion Team February 19, 2018 05:44 AM UTC

Hi Beppe 
 
Thanks for your update. 
 
We will wait until hear from you.   
 
Regards, 
Mallika 



BS BEPPE SALVADERI February 20, 2018 02:03 PM UTC

Hi Mallika,
is it possible to change the background color of gauge?
I tried to change the black to blue but the instructions 

rg.BackColor = Color.Azure

and 

Me.GridControl1(i, j).BackColor = Color.Azure

do not work.

I attach my test.
Tank You.
Greetings.
Beppe

Attachment: GC_b62a1a16.zip


MK Mallika Kannan Syncfusion Team February 21, 2018 01:12 PM UTC

Hi Beppe 
 
Thanks for your update. 
 
Query:  is it possible to change the background color of gauge? I tried to change the black to blue but the instructions. rg.BackColor = Color.Azure and Me.GridControl1(i, j).BackColor = Color.Azure do not work. 
 
RadialGauge control has BackColor property to set the Background color of RadialGauge, unfortunately it is not working. So, we have logged an issue report with “RadialGauge BackColor property is not working” is a bug. This fix will be included in our Volume 1, SP1, 2018.  
 
If you need the patch for the reported issue,  please share your Essential Studio version. That will helpful to provide the patch for the same. 
 
Regards, 
Mallika 



BS BEPPE SALVADERI February 21, 2018 10:10 PM UTC

Hi Mallika,
Thanks for the reply.
My version of Essential Studio is 15.4.0.17
Regards.
Beppe


DR Durga Rajan Syncfusion Team February 22, 2018 10:27 AM UTC

Hi Beppe, 
  
As mentioned earlier we have logged defect report for the reported “BackColor property of the RadialGauge control is not working” issue. A support incident to track the status of this defect has been created under your account. Please log on to our support website to check for further updates 
  

Regards, 
Durga S. 



BS BEPPE SALVADERI February 28, 2018 05:39 PM UTC

Hi Mallika,
I installed the patch. The error has been corrected.
Many thanks.
Greetings.
Beppe


MK Mallika Kannan Syncfusion Team March 1, 2018 03:48 AM UTC

Hi Beppe 
 
Thanks for your update. 
 
We are glad that the issue has been resolved at your end. 
 
Please let us know if you need any other assistance. 
 
Regards, 
Mallika 


Loader.
Up arrow icon