mardi 19 janvier 2016

C# Checkbox not gaining focus on Tabstop

I am making a config editor form and have hit a bit of an issue, I put a lot of time into userfriendly and efficient design and therefor want the TabIndex to work perfectly to minimize use of mouse.

My problem is now when I try to tab through the controls I noticed the CheckBox was not gaining focus like if you press it with the mouse, this means I couldn't tab through and change their state directly from keyboard.

How do I make the CheckBox gain focus via TabIndex and TabStop so that I can just press Enter to change its state via the KeyUp event.

Below is a picture of my form, and next to it a picture of the TabIndex as well as a the code taken directly from the Form.Designer.cs class.

enter image description here

        // 
        // cbxDefaultPublic
        // 
        this.cbxDefaultPublic.AutoSize = true;
        this.cbxDefaultPublic.Location = new System.Drawing.Point(247, 12);
        this.cbxDefaultPublic.Name = "cbxDefaultPublic";
        this.cbxDefaultPublic.Size = new System.Drawing.Size(15, 14);
        this.cbxDefaultPublic.TabIndex = 1;
        this.cbxDefaultPublic.TabStop = true;
        this.cbxDefaultPublic.UseVisualStyleBackColor = true;




Aucun commentaire:

Enregistrer un commentaire