Warum ComboBox verbirgt cursor, wenn DroppedDown eingestellt ist?

Erstellen wir WinForms-Anwendung (ich habe Visual Studio 2008 unter Windows Vista, aber es scheint, dass die beschriebene situation findet sich fast überall, von Win98 bis Vista, auf systemeigenem oder verwaltetem code).

Schreiben, wie code:

using System;
using System.Drawing;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public class Form1 : Form
    {
        private readonly Button button1 = new Button();
        private readonly ComboBox comboBox1 = new ComboBox();
        private readonly TextBox textBox1 = new TextBox();

        public Form1() {
            SuspendLayout();
            textBox1.Location = new Point(21, 51);
            button1.Location = new Point(146, 49);
            button1.Text = "button1";
            button1.Click += button1_Click;
            comboBox1.Items.AddRange(new[] {"1", "2", "3", "4", "5", "6"});
            comboBox1.Location = new Point(21, 93);
            AcceptButton = button1;
            Controls.AddRange(new Control[] {textBox1, comboBox1, button1});
            Text = "Form1";
            ResumeLayout(false);
            PerformLayout();
        }

        private void button1_Click(object sender, EventArgs e) {
            comboBox1.DroppedDown = true;
        }
    }
}

Führen Sie dann die app. Platzieren Sie die Maus-cursor auf die form und nicht-touch-Maus. Geben Sie etwas in das Textfeld - cursor wird ausgeblendet, weil es. Wenn Sie die Enter-Taste drücken - Ereignis wirft und ComboBox gelöscht werden, nach unten. Aber jetzt cursor wird nicht angezeigt, auch wenn Sie es verschieben! Und wird nur angezeigt, wenn Sie klicken Sie irgendwo.

Dort Ich gefunden habe, die Diskussion über dieses problem. Aber es gibt keine gute Lösung...

Irgendwelche Gedanken? 🙂

InformationsquelleAutor Ivan Danilov | 2009-07-07

Schreibe einen Kommentar