Form with a Chart does not display properly
-
vendredi 10 août 2012 21:46
Hi All:
I am using VB.Net 2008. I posted a similar thread a while ago on another forum (which never got answered), and since then I have realized that the problem is with the chart. So, I am posting it here in hopes that someone can tell me what is wrong. I am sorry about the double posting.
I have a form which has several textboxes, comboboxes and a chart, with 5 series (please see the Design code. I am sorry to have done it this way, as I do not know how to attach a file to these posts). When I run the program to display the form, the form displays completely white for about a second or so, and then it draws the controls on it. If I delete the chart, all is fine, and the form displays instantaneously. Is there a way dispaly the form correctly from the start? Thank you;
Bob
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _ Partial Class FrmCircle Inherits System.Windows.Forms.Form 'Form overrides dispose to clean up the component list. <System.Diagnostics.DebuggerNonUserCode()> _ Protected Overrides Sub Dispose(ByVal disposing As Boolean) Try If disposing AndAlso components IsNot Nothing Then components.Dispose() End If Finally MyBase.Dispose(disposing) End Try End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. <System.Diagnostics.DebuggerStepThrough()> _ Private Sub InitializeComponent() Dim ChartArea1 As System.Windows.Forms.DataVisualization.Charting.ChartArea = New System.Windows.Forms.DataVisualization.Charting.ChartArea Dim Legend1 As System.Windows.Forms.DataVisualization.Charting.Legend = New System.Windows.Forms.DataVisualization.Charting.Legend Dim Series1 As System.Windows.Forms.DataVisualization.Charting.Series = New System.Windows.Forms.DataVisualization.Charting.Series Dim Series2 As System.Windows.Forms.DataVisualization.Charting.Series = New System.Windows.Forms.DataVisualization.Charting.Series Dim Series3 As System.Windows.Forms.DataVisualization.Charting.Series = New System.Windows.Forms.DataVisualization.Charting.Series Dim Series4 As System.Windows.Forms.DataVisualization.Charting.Series = New System.Windows.Forms.DataVisualization.Charting.Series Dim Series5 As System.Windows.Forms.DataVisualization.Charting.Series = New System.Windows.Forms.DataVisualization.Charting.Series Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(FrmCircle)) Me.BtnClose = New System.Windows.Forms.Button Me.BtnDrawGraph = New System.Windows.Forms.Button Me.GroupBox1 = New System.Windows.Forms.GroupBox Me.TextBox4 = New System.Windows.Forms.TextBox Me.Label4 = New System.Windows.Forms.Label Me.TextBox3 = New System.Windows.Forms.TextBox Me.Label3 = New System.Windows.Forms.Label Me.TextBox2 = New System.Windows.Forms.TextBox Me.Label2 = New System.Windows.Forms.Label Me.TextBox1 = New System.Windows.Forms.TextBox Me.Label1 = New System.Windows.Forms.Label Me.ComboBox1 = New System.Windows.Forms.ComboBox Me.GroupBox2 = New System.Windows.Forms.GroupBox Me.RadioButton2 = New System.Windows.Forms.RadioButton Me.RadioButton1 = New System.Windows.Forms.RadioButton Me.TextBox5 = New System.Windows.Forms.TextBox Me.Label5 = New System.Windows.Forms.Label Me.ComboBox2 = New System.Windows.Forms.ComboBox Me.Chart1 = New System.Windows.Forms.DataVisualization.Charting.Chart Me.GroupBox1.SuspendLayout() Me.GroupBox2.SuspendLayout() CType(Me.Chart1, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' 'BtnClose ' Me.BtnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel Me.BtnClose.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.BtnClose.Location = New System.Drawing.Point(657, 434) Me.BtnClose.Name = "BtnClose" Me.BtnClose.Size = New System.Drawing.Size(94, 33) Me.BtnClose.TabIndex = 20 Me.BtnClose.Text = "&Close" Me.BtnClose.UseVisualStyleBackColor = True ' 'BtnDrawGraph ' Me.BtnDrawGraph.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.BtnDrawGraph.Location = New System.Drawing.Point(520, 434) Me.BtnDrawGraph.Name = "BtnDrawGraph" Me.BtnDrawGraph.Size = New System.Drawing.Size(131, 33) Me.BtnDrawGraph.TabIndex = 19 Me.BtnDrawGraph.Text = "Draw Circle" Me.BtnDrawGraph.UseVisualStyleBackColor = True ' 'GroupBox1 ' Me.GroupBox1.Controls.Add(Me.TextBox4) Me.GroupBox1.Controls.Add(Me.Label4) Me.GroupBox1.Controls.Add(Me.TextBox3) Me.GroupBox1.Controls.Add(Me.Label3) Me.GroupBox1.Controls.Add(Me.TextBox2) Me.GroupBox1.Controls.Add(Me.Label2) Me.GroupBox1.Controls.Add(Me.TextBox1) Me.GroupBox1.Controls.Add(Me.Label1) Me.GroupBox1.Controls.Add(Me.ComboBox1) Me.GroupBox1.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.GroupBox1.Location = New System.Drawing.Point(12, 12) Me.GroupBox1.Name = "GroupBox1" Me.GroupBox1.Size = New System.Drawing.Size(344, 202) Me.GroupBox1.TabIndex = 0 Me.GroupBox1.TabStop = False Me.GroupBox1.Text = "Draw circle using:" ' 'TextBox4 ' Me.TextBox4.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.TextBox4.Location = New System.Drawing.Point(100, 154) Me.TextBox4.Name = "TextBox4" Me.TextBox4.Size = New System.Drawing.Size(227, 22) Me.TextBox4.TabIndex = 9 ' 'Label4 ' Me.Label4.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Label4.Location = New System.Drawing.Point(6, 157) Me.Label4.Name = "Label4" Me.Label4.Size = New System.Drawing.Size(88, 16) Me.Label4.TabIndex = 8 Me.Label4.Text = "Label4" Me.Label4.TextAlign = System.Drawing.ContentAlignment.TopRight ' 'TextBox3 ' Me.TextBox3.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.TextBox3.Location = New System.Drawing.Point(100, 126) Me.TextBox3.Name = "TextBox3" Me.TextBox3.Size = New System.Drawing.Size(227, 22) Me.TextBox3.TabIndex = 7 ' 'Label3 ' Me.Label3.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Label3.Location = New System.Drawing.Point(6, 129) Me.Label3.Name = "Label3" Me.Label3.Size = New System.Drawing.Size(88, 16) Me.Label3.TabIndex = 6 Me.Label3.Text = "Label3" Me.Label3.TextAlign = System.Drawing.ContentAlignment.TopRight ' 'TextBox2 ' Me.TextBox2.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.TextBox2.Location = New System.Drawing.Point(99, 98) Me.TextBox2.Name = "TextBox2" Me.TextBox2.Size = New System.Drawing.Size(227, 22) Me.TextBox2.TabIndex = 5 ' 'Label2 ' Me.Label2.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Label2.Location = New System.Drawing.Point(6, 101) Me.Label2.Name = "Label2" Me.Label2.Size = New System.Drawing.Size(88, 16) Me.Label2.TabIndex = 4 Me.Label2.Text = "Label2" Me.Label2.TextAlign = System.Drawing.ContentAlignment.TopRight ' 'TextBox1 ' Me.TextBox1.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.TextBox1.Location = New System.Drawing.Point(99, 70) Me.TextBox1.Name = "TextBox1" Me.TextBox1.Size = New System.Drawing.Size(227, 22) Me.TextBox1.TabIndex = 3 ' 'Label1 ' Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Label1.Location = New System.Drawing.Point(6, 73) Me.Label1.Name = "Label1" Me.Label1.Size = New System.Drawing.Size(88, 16) Me.Label1.TabIndex = 2 Me.Label1.Text = "Label1" Me.Label1.TextAlign = System.Drawing.ContentAlignment.TopRight ' 'ComboBox1 ' Me.ComboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList Me.ComboBox1.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.ComboBox1.FormattingEnabled = True Me.ComboBox1.Location = New System.Drawing.Point(99, 22) Me.ComboBox1.Name = "ComboBox1" Me.ComboBox1.Size = New System.Drawing.Size(228, 24) Me.ComboBox1.TabIndex = 1 ' 'GroupBox2 ' Me.GroupBox2.Controls.Add(Me.RadioButton2) Me.GroupBox2.Controls.Add(Me.RadioButton1) Me.GroupBox2.Controls.Add(Me.TextBox5) Me.GroupBox2.Controls.Add(Me.Label5) Me.GroupBox2.Controls.Add(Me.ComboBox2) Me.GroupBox2.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.GroupBox2.Location = New System.Drawing.Point(12, 240) Me.GroupBox2.Name = "GroupBox2" Me.GroupBox2.Size = New System.Drawing.Size(344, 162) Me.GroupBox2.TabIndex = 10 Me.GroupBox2.TabStop = False Me.GroupBox2.Text = "To find point A (or B), use the additional needed information from:" ' 'RadioButton2 ' Me.RadioButton2.AutoSize = True Me.RadioButton2.Location = New System.Drawing.Point(219, 126) Me.RadioButton2.Name = "RadioButton2" Me.RadioButton2.Size = New System.Drawing.Size(107, 20) Me.RadioButton2.TabIndex = 15 Me.RadioButton2.TabStop = True Me.RadioButton2.Text = "RadioButton2" Me.RadioButton2.UseVisualStyleBackColor = True ' 'RadioButton1 ' Me.RadioButton1.AutoSize = True Me.RadioButton1.Location = New System.Drawing.Point(35, 126) Me.RadioButton1.Name = "RadioButton1" Me.RadioButton1.Size = New System.Drawing.Size(107, 20) Me.RadioButton1.TabIndex = 14 Me.RadioButton1.TabStop = True Me.RadioButton1.Text = "RadioButton1" Me.RadioButton1.UseVisualStyleBackColor = True ' 'TextBox5 ' Me.TextBox5.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.TextBox5.Location = New System.Drawing.Point(99, 85) Me.TextBox5.Name = "TextBox5" Me.TextBox5.Size = New System.Drawing.Size(227, 22) Me.TextBox5.TabIndex = 13 ' 'Label5 ' Me.Label5.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Label5.Location = New System.Drawing.Point(8, 88) Me.Label5.Name = "Label5" Me.Label5.Size = New System.Drawing.Size(83, 16) Me.Label5.TabIndex = 12 Me.Label5.Text = "Label5" Me.Label5.TextAlign = System.Drawing.ContentAlignment.TopRight ' 'ComboBox2 ' Me.ComboBox2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList Me.ComboBox2.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.ComboBox2.FormattingEnabled = True Me.ComboBox2.Location = New System.Drawing.Point(98, 39) Me.ComboBox2.Name = "ComboBox2" Me.ComboBox2.Size = New System.Drawing.Size(228, 24) Me.ComboBox2.TabIndex = 11 ' 'Chart1 ' ChartArea1.Name = "ChartArea1" Me.Chart1.ChartAreas.Add(ChartArea1) Legend1.Enabled = False Legend1.Name = "Legend1" Me.Chart1.Legends.Add(Legend1) Me.Chart1.Location = New System.Drawing.Point(371, 22) Me.Chart1.Name = "Chart1" Series1.ChartArea = "ChartArea1" Series1.Legend = "Legend1" Series1.Name = "Series1" Series2.BorderColor = System.Drawing.Color.Yellow Series2.ChartArea = "ChartArea1" Series2.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.FastPoint Series2.Color = System.Drawing.Color.Yellow Series2.Legend = "Legend1" Series2.MarkerSize = 6 Series2.Name = "Series2" Series3.BorderWidth = 2 Series3.ChartArea = "ChartArea1" Series3.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line Series3.Color = System.Drawing.Color.Cyan Series3.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Series3.Legend = "Legend1" Series3.MarkerBorderColor = System.Drawing.Color.Cyan Series3.MarkerColor = System.Drawing.Color.Cyan Series3.MarkerSize = 7 Series3.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Diamond Series3.Name = "Series3" Series4.BorderWidth = 2 Series4.ChartArea = "ChartArea1" Series4.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line Series4.Color = System.Drawing.Color.Magenta Series4.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Series4.Legend = "Legend1" Series4.MarkerBorderColor = System.Drawing.Color.Magenta Series4.MarkerColor = System.Drawing.Color.Magenta Series4.MarkerSize = 7 Series4.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Diamond Series4.Name = "Series4" Series5.BorderColor = System.Drawing.Color.Yellow Series5.ChartArea = "ChartArea1" Series5.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.FastPoint Series5.Color = System.Drawing.Color.Yellow Series5.Legend = "Legend1" Series5.MarkerBorderColor = System.Drawing.Color.Yellow Series5.MarkerColor = System.Drawing.Color.Yellow Series5.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Square Series5.Name = "Series5" Me.Chart1.Series.Add(Series1) Me.Chart1.Series.Add(Series2) Me.Chart1.Series.Add(Series3) Me.Chart1.Series.Add(Series4) Me.Chart1.Series.Add(Series5) Me.Chart1.Size = New System.Drawing.Size(380, 380) Me.Chart1.TabIndex = 18 Me.Chart1.TabStop = False Me.Chart1.Text = "Chart1" ' 'FrmCircle ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.AutoScroll = True Me.ClientSize = New System.Drawing.Size(761, 484) Me.Controls.Add(Me.Chart1) Me.Controls.Add(Me.GroupBox2) Me.Controls.Add(Me.GroupBox1) Me.Controls.Add(Me.BtnClose) Me.Controls.Add(Me.BtnDrawGraph) Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon) Me.MaximumSize = New System.Drawing.Size(777, 522) Me.Name = "FrmCircle" Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent Me.Text = "Circle" Me.GroupBox1.ResumeLayout(False) Me.GroupBox1.PerformLayout() Me.GroupBox2.ResumeLayout(False) Me.GroupBox2.PerformLayout() CType(Me.Chart1, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) End Sub Friend WithEvents BtnClose As System.Windows.Forms.Button Friend WithEvents BtnDrawGraph As System.Windows.Forms.Button Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox Friend WithEvents TextBox3 As System.Windows.Forms.TextBox Friend WithEvents Label3 As System.Windows.Forms.Label Friend WithEvents TextBox2 As System.Windows.Forms.TextBox Friend WithEvents Label2 As System.Windows.Forms.Label Friend WithEvents TextBox1 As System.Windows.Forms.TextBox Friend WithEvents Label1 As System.Windows.Forms.Label Friend WithEvents ComboBox1 As System.Windows.Forms.ComboBox Friend WithEvents TextBox4 As System.Windows.Forms.TextBox Friend WithEvents Label4 As System.Windows.Forms.Label Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox Friend WithEvents TextBox5 As System.Windows.Forms.TextBox Friend WithEvents Label5 As System.Windows.Forms.Label Friend WithEvents ComboBox2 As System.Windows.Forms.ComboBox Friend WithEvents Chart1 As System.Windows.Forms.DataVisualization.Charting.Chart Friend WithEvents RadioButton2 As System.Windows.Forms.RadioButton Friend WithEvents RadioButton1 As System.Windows.Forms.RadioButton End Class
Public Enum cntl L1 = 1 L2 = 2 L3 = 3 L4 = 4 L5 = 5 GB = 9 CB = 10 End Enum Dim cmb1Index As Int16 = -1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ComboBox1.Items.Add("Points A and B") ComboBox1.Items.Add("Center and Point A") ComboBox1.Items.Add("Center and Point B") ComboBox1.Items.Add("Center and Radius") ComboBox1.Items.Add("Center and " & "S" & "1") ComboBox1.Items.Add("Center and " & "S" & "2") ComboBox1.Items.Add("S" & "1 and Radius") ComboBox1.Items.Add("S" & "2 and Radius") ComboBox1.Items.Add("Point A and " & "S" & "1") ComboBox1.Items.Add("Point A and " & "S" & "2") ComboBox1.Items.Add("Point B and " & "S" & "1") ComboBox1.Items.Add("Point B and " & "S" & "2") ComboBox1.Items.Add("S" & "1 and " & "S" & "2") ComboBox1.Items.Add("Points A' and B'") ComboBox1.SelectedIndex = 0 RadioButton1.Checked = True RadioButton1.Text = "T" & "xy is positive" RadioButton2.Text = "T" & "xy is negative" End Sub Private Sub BtnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnClose.Click Me.Close() If FormIsOpen = False Then Me.Dispose() End Sub Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged Dim k As Int16 k = ComboBox1.SelectedIndex If k = cmb1Index Then Exit Sub If k = 0 Then ShowControl(1, True, "S" & "x :", "") ShowControl(2, True, "S" & "y :", "") ShowControl(3, True, "T" & "xy :", "") ShowControl(4, True, "A" & " (Optional) :", "") ElseIf k = 1 Then ShowControl(1, True, "S" & " ave :", "") ShowControl(2, True, "S" & "x :", "") ShowControl(3, True, "T" & "xy :", "") ShowControl(4, True, "A" & " (Optional) :", "") ElseIf k = 2 Then ShowControl(1, True, "S" & " ave :", "") ShowControl(2, True, "S" & "y :", "") ShowControl(3, True, "T" & "xy :", "") ShowControl(4, True, "A" & " (Optional) :", "") ElseIf k = 3 Then ShowControl(1, True, "S" & " ave :", "") ShowControl(2, True, "Radius :", "") ShowControl(3, False, "", "") ShowControl(4, True, "A" & " (Optional) :", "") ElseIf k = 4 Then ShowControl(1, True, "S" & " ave :", "") ShowControl(2, True, "S" & "1 :", "") ShowControl(3, False, "", "") ShowControl(4, True, "A" & " (Optional) :", "") ElseIf k = 5 Then ShowControl(1, True, "S" & " ave :", "") ShowControl(2, True, "S" & "2 :", "") ShowControl(3, False, "", "") ShowControl(4, True, "A" & " (Optional) :", "") ElseIf k = 6 Then ShowControl(1, True, "S" & "1 :", "") ShowControl(2, True, "Radius :", "") ShowControl(3, False, "", "") ShowControl(4, True, "A" & " (Optional) :", "") ElseIf k = 7 Then ShowControl(1, True, "S" & "2 :", "") ShowControl(2, True, "Radius :", "") ShowControl(3, False, "", "") ShowControl(4, True, "A" & " (Optional) :", "") ElseIf k = 8 Then ShowControl(1, True, "S" & "x :", "") ShowControl(2, True, "T" & "xy :", "") ShowControl(3, True, "S" & "1 :", "") ShowControl(4, True, "A" & " (Optional) :", "") ElseIf k = 9 Then ShowControl(1, True, "S" & "x :", "") ShowControl(2, True, "T" & "xy :", "") ShowControl(3, True, "S" & "2 :", "") ShowControl(4, True, "A" & " (Optional) :", "") ElseIf k = 10 Then ShowControl(1, True, "S" & "y :", "") ShowControl(2, True, "T" & "xy :", "") ShowControl(3, True, "S" & "1 :", "") ShowControl(4, True, "A" & " (Optional) :", "") ElseIf k = 11 Then ShowControl(1, True, "S" & "y :", "") ShowControl(2, True, "T" & "xy :", "") ShowControl(3, True, "S" & "2 :", "") ShowControl(4, True, "A" & " (Optional) :", "") ElseIf k = 12 Then ShowControl(1, True, "S" & "1 :", "") ShowControl(2, True, "S" & "2 :", "") ShowControl(3, False, "", "") ShowControl(4, True, "A" & " (Optional) :", "") ElseIf k = 13 Then ShowControl(1, True, "S" & "x' :", "") ShowControl(2, True, "S" & "y' :", "") ShowControl(3, True, "T" & "x'y' :", "") ShowControl(4, True, "A" & " :", "") End If Select Case k Case 3, 6, 12 ComboBox2.Items.Clear() ComboBox2.Items.Add("S" & "x") ComboBox2.Items.Add("S" & "y") ComboBox2.Items.Add("A" & " P1") ComboBox2.SelectedIndex = 0 ShowControl(5, True, ComboBox2.Text & " :", "") ShowControl(cntl.GB, True, "Use the additional needed information from", "Use the additional needed information from") Case 5, 7 ComboBox2.Items.Clear() ComboBox2.Items.Add("S" & "x") ComboBox2.Items.Add("S" & "y") ComboBox2.Items.Add("A" & " P2") ComboBox2.SelectedIndex = 0 ShowControl(5, True, ComboBox2.Text & " :", "") ShowControl(cntl.GB, True, "Use the additional needed information from", "Use the additional needed information from") Case Else ShowControl(cntl.GB, False, "", "") ComboBox2.SelectedIndex = -1 End Select If RadioButton1.Checked = False Then RadioButton1.Checked = True cmb1Index = ComboBox1.SelectedIndex End Sub Private Sub ShowControl(ByVal ct As Int16, ByVal Status As Boolean, ByVal msg1 As String, Optional ByVal msg2 As String = "") Dim obj1 As Object, obj2 As Object Select Case ct Case 1 obj1 = Label1 obj2 = TextBox1 Case 2 obj1 = Label2 obj2 = TextBox2 Case 3 obj1 = Label3 obj2 = TextBox3 Case 4 obj1 = Label4 obj2 = TextBox4 Case 5 obj1 = Label5 obj2 = TextBox5 Case 9 obj1 = GroupBox2 obj2 = GroupBox2 End Select If Status = False Then obj1.visible = False obj2.visible = False Else If obj1.visible = False Then obj1.visible = True obj2.visible = True End If obj1.text = msg1 obj2.text = msg2 End If End Sub
Toutes les réponses
-
mardi 14 août 2012 20:22
Hi All:
I found a work around on this issue and I believe this is a bug in the control. If I create teh chart control as the very first control on my form, and then create the other controls, the form displays properly. However, if I create a control first and then the chart, this strange behavior surfaces. So, for now, I had to recreate my entire form, and making sure the chart was the very first control. Also, I did not copy and paste the other controls, but I manually recreated them from scratch. And now this new form displays properly. The old form (where the controls where created before the chart) still has the issue. Hopefully, someone from Microsoft (a developer) can look at this issue.
Bob
- Marqué comme réponse booboo_US mardi 14 août 2012 20:23

