|T O P I C R E V I E W
||Posted - 30 Jan 2017 : 04:50:19
I'm facing with a strange behavior on SPC charts. I have a User Control developed with Vb.NET. This control is dinamically instantiated by code many times and added on TabControl pages (one control per page).
Everything is working perfectly except the very first UC instance! The first one is presented with big fonts instead of the others with the correct dimension.
What could it be? How can I solve this issue?
|6 L A T E S T R E P L I E S (Newest First)
||Posted - 14 Feb 2017 : 03:39:18
Ok thank you.
I prepare a small project and send it to you.
||Posted - 11 Feb 2017 : 10:57:34
Sorry, we cannot reproduce the problem with SPCGeneralizedTableDisplay.DefaultTableFont. We placed in the SPCApplication1 program before the call to InitSPCTimeVariableControlChart and it worked as expected.
Dim numdatapointsinview As Integer = 17
SPCGeneralizedTableDisplay.DefaultTableFont = New Font("Arial", 16)
' Initialize the SPCTimeVariableControlChart
Me.InitSPCTimeVariableControlChart(charttype, numsamplespersubgroup, numdatapointsinview, timeincrementminutes)
Test this on your end. If it works see if you can modify the program to reproduce your problem. If you are unable to do that, you are going to have to supply us with the complete source to the simplest possible example (project) which reproduces the problem. You can send the zipped example project to firstname.lastname@example.org.
||Posted - 10 Feb 2017 : 12:36:49
Based on what you said I've found two things:
a. it seems that, after Control.Add(objChart), at very first time, the object is set back to the UC size defined on User Control (despite the code settings). Anyway setting again the size AFTER Control.Add it seems working better.
b. Even the resize works better font size is not customized: I'm setting "SPCGeneralizedTableDisplay.DefaultTableFont" before Init but seems not working.
Please can you help me on setting font correctly?
||Posted - 31 Jan 2017 : 08:46:33
Events often don't get fired in the correct order so don't rely on that. Your first chart gets defined and rendered while it still has a default user control size of 100x100, but then it is resized to the windows size, causing fonts to resize proportionately. So give it a default preferred size which is your expected window size. It doesn't have to be exact, just ball park to give font resizing algorithm a starting point. Do it BEFORE you add it to a form, probably in the chart definition method.
||Posted - 31 Jan 2017 : 08:16:37
Is it the size of the control?
Actually UserControl Dock property is Fill, should I calculate it and set during a particular event on form (I'm thinking about Show event)?
||Posted - 30 Jan 2017 : 16:47:41
In the chart definition, define the expected size before the first chart is displayed using the ChartView PreferredSize property.
chartVu.PreferredSize = New Size(1200, 800)