0

現在、VS 2012. .NET 4.5 で作業しており、mmc スナップインに取り組んでいます。(私は当然知っている?!)

だから私はこのトピックに従いました:

WinFormsでChecked Comboboxを実装する簡単な方法はありますか

スケジュールされたタスクマネージャーに似たものが欲しいので。

しかし、その解決策は私にはうまくいかないようです。リストビューがポップアップしますが、リストビューのチェックボックスをクリックしようとすると. それは私に大きな中指を与え、私のドロップダウンを閉じます.

コンボボックスの「フォーカスが失われた」クローズイベントを抑制する方法はありますか? リストを非表示にすることはできませんが、非表示になることはありません。

例えば:

// designer class


// 
// comboBox1
// 
this.comboBox1.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
this.comboBox1.DropDownHeight = 1;
this.comboBox1.DropDownWidth = 1;
this.comboBox1.FormattingEnabled = true;
this.comboBox1.IntegralHeight = false;
this.comboBox1.Location = new System.Drawing.Point(256, 371);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(238, 21);
this.comboBox1.TabIndex = 5;
this.comboBox1.DropDown += new System.EventHandler(this.comboBox1_DropDown);
this.comboBox1.DropDownClosed += new System.EventHandler(this.comboBox1_DropDownClosed);
// 
// lstWeekDays
// 
this.lstWeekDays.CheckBoxes = true;
this.lstWeekDays.Location = new System.Drawing.Point(50, 63);
this.lstWeekDays.Name = "lstWeekDays";
this.lstWeekDays.Size = new System.Drawing.Size(263, 97);
this.lstWeekDays.TabIndex = 13;
this.lstWeekDays.Tag = "lstlstWeekDays";
this.lstWeekDays.UseCompatibleStateImageBehavior = false;
this.lstWeekDays.View = System.Windows.Forms.View.SmallIcon;
this.lstWeekDays.Visible = false;

// Code behind

public Form1()
{
    InitializeComponent();
    this.lstWeekDays.Items.Add("Monday");
    this.lstWeekDays.Items.Add("Tuesday");
    this.lstWeekDays.Items.Add("Wednesday");
    this.lstWeekDays.Items.Add("Thursday");
    this.lstWeekDays.Items.Add("Friday");
    this.lstWeekDays.Items.Add("Saturday");
    this.lstWeekDays.Items.Add("Sunday");
}

private void comboBox1_DropDown(object sender, EventArgs e)
{
    lstWeekDays.Visible = true;
}

private void comboBox1_DropDownClosed(object sender, EventArgs e)
{
    lstWeekDays.Visible = false;
}

パネルではなく、このリストにチェックボックスを追加します。

4

0 に答える 0