我使用的winforms有一個面板,並且在該面板內部有一個groupbox。Windows窗體控件最終沒有顯示在屏幕上
在組框中它有兩個單選按鈕的控制。 在客戶端機器中,有時候這個屏幕會變成空白而沒有單選按鈕。它只顯示組框標題。
我已檢查它發生在一天2-3只否則它工作正常。
我們稱之爲父窗體中的showdialog。
以下是報告給微軟論壇smiliar問題 https://social.msdn.microsoft.com/Forums/windows/en-US/8bfb02d5-70df-45a0-96ae-7aef4d4d427c/win-form-is-not-loading-properly-with-windows-8?forum=winforms
,但沒能找到這個解決方案。 請讓我知道是否有人遇到類似的問題,以及解決方案是什麼。
此示例代碼:
private void InitializeComponent()
{
this.groupBox1 = new Cross.CustomControls.GroupBox();
this.rb1 = new System.Windows.Forms.RadioButton();
this.rb2 = new System.Windows.Forms.RadioButton();
this.btnOK = new System.Windows.Forms.Button();
this.lblMessage = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(208)))), ((int)(((byte)(208)))), ((int)(((byte)(191)))));
this.groupBox1.Controls.Add(this.rb1);
this.groupBox1.Controls.Add(this.rb2);
this.groupBox1.DrawTopOnly = false;
this.groupBox1.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.groupBox1.Font = new System.Drawing.Font("Arial", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.groupBox1.Location = new System.Drawing.Point(72, 141);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Padding = new System.Windows.Forms.Padding(3, 21, 3, 2);
this.groupBox1.Size = new System.Drawing.Size(277, 74);
this.groupBox1.TabIndex = 1;
this.groupBox1.Text = "DF";
this.groupBox1.TitleColor = System.Drawing.Color.Blue;
//
// rb1
//
this.rb1.AutoSize = true;
this.rb1.Checked = true;
this.rb1.Location = new System.Drawing.Point(30, 35);
this.rb1.Name = "rb1";
this.rb1.Size = new System.Drawing.Size(101, 21);
this.rb1.TabIndex = 0;
this.rb1.TabStop = true;
this.rb1.Text = "rb1";
this.rb1.UseVisualStyleBackColor = true;
this.rb1.CheckedChanged += new System.EventHandler(this.rb1_CheckedChanged);
//
// rb2
//
this.rb2.AutoSize = true;
this.rb2.Location = new System.Drawing.Point(149, 35);
this.rb2.Name = "rb2";
this.rb2.Size = new System.Drawing.Size(96, 21);
this.rb2.TabIndex = 1;
this.rb2.TabStop = true;
this.rb2.Text = "rb2";
this.rb2.UseVisualStyleBackColor = true;
this.rb2.CheckedChanged += new System.EventHandler(this.rb2_CheckedChanged);
//
// btnOK
//
this.btnOK.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.btnOK.Location = new System.Drawing.Point(274, 221);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(75, 29);
this.btnOK.TabIndex = 2;
this.btnOK.Text = "&OK";
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
//
// lblMessage
//
this.lblMessage.Location = new System.Drawing.Point(72, 85);
this.lblMessage.Name = "lblMessage";
this.lblMessage.Size = new System.Drawing.Size(337, 42);
this.lblMessage.TabIndex = 3;
//
// frmDFCardType
//
this.ArchSubTitle = "c";
this.ArchTitle = "CT";
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(421, 273);
this.Controls.Add(this.lblMessage);
this.Controls.Add(this.btnOK);
this.Controls.Add(this.groupBox1);
this.Font = new System.Drawing.Font("Arial", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "frmDFCardType";
this.Controls.SetChildIndex(this.PleaseWait, 0);
this.Controls.SetChildIndex(this.groupBox1, 0);
this.Controls.SetChildIndex(this.btnOK, 0);
this.Controls.SetChildIndex(this.lblMessage, 0);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false);
}
顯示完整的代碼,因爲您粘貼的這部分根本沒有意義。 –
添加了設計師代碼! – Akhilesh
嘗試使用SuspendLayout,ResumeLayout和PerformLayout刪除代碼並查看會發生什麼 –