0

3 つのユーザー コントロールがあり、それらを 3 つの異なるタブのタブ コントロールに挿入しています。ここでの問題は、ユーザー コントロールをタブ コントロールに挿入すると、ボタンのデザインとパネルのデザインが変更されることです。1 つの例は、ボタンが丸い代わりに鋭いエッジを持っていることです。これは何が原因ですか?

これは、ユーザー コントロールをタブ コントロールに挿入するための私のコードです。

public void addUC(UserControl control, TabPage tab)
{
    control.Parent = tab;
    control.Anchor = (AnchorStyles.Bottom | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Left);
}

Designer.cs クラス:

 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.Controls.Add(this.panel2);
            this.Controls.Add(this.panel1);
            this.Controls.Add(this.adresseListPanel);
            this.Controls.Add(this.landComboBox);
            this.Controls.Add(this.searchPanel);
            this.Name = "CustomerMainControl";
            this.Size = new System.Drawing.Size(1291, 568);
            this.Load += new System.EventHandler(this.CustomerMainControl_Load);
            this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.CustomerMainControl_KeyDown);
            this.panel1.ResumeLayout(false);
            this.panel1.PerformLayout();
            this.adresseListPanel.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.adresseDataGrid)).EndInit();
            this.searchPanel.ResumeLayout(false);
            this.searchPanel.PerformLayout();
            this.ResumeLayout(false);

誰でもこれで私を助けることができますか?

4

1 に答える 1

1

UI からの関連する詳細:

ここに画像の説明を入力

これは、2000年以前の古いWindowsバージョンでGUIがどのように見えるかです. アプリは Visual Styles を有効にせずに実行されています。これは、Program.cs の Main() メソッドが Application.EnableVisualStyles() を呼び出さない場合に発生します。プロジェクト テンプレートから生成された定型コード:

    [STAThread]
    static void Main() {
        Application.EnableVisualStyles();          // <=== HERE!
        Application.SetCompatibleTextRenderingDefault(false);
        Application.Run(new Form1());
    }

ヒントがなければ、それがどのように起こったのかを推測するのは難しい. アプリの起動方法がわからない場合は、F11 キーを押してアプリのスタートアップ コードをデバッグします。

于 2013-01-31T12:29:12.743 に答える