相关疑难解决方法(0)

如何控制面板内TextBox的焦点顺序?

我有一个包含许多TextBox的表单.我需要一组内的一些TextBox,以及另一组内的其他文本框.按组,我只需要一种方法来使这些TextBox看起来彼此属于.

我制作了两个面板并将TextBox添加到它们中.然后,我在这些面板周围放置了一个边框.

但是,我的问题是,当我按下时Tab,焦点不会转到下一个TextBox,而是按随机顺序转到另一个TextBox.有时下一个TextBox位于第一个Panel中,有时则位于第二个Panel中.如何控制焦点顺序?

这是一张图片来说明我的观点:

一个图像来说明我的观点

c# windows-forms-designer winforms

9
推荐指数
2
解决办法
6711
查看次数

TabIndex无法正常工作

我有一个Windows窗体应用程序.在表单上有三个groupbox.每个组框都包含一些控件.请看图像. 形成

有一个groupbox"flag",其中包含几个复选框."flag"位于"groupbox1"中.我使用Tab键来浏览每个控件,但它不适用于"flag"中的复选框.我确实为每个控件设置了正确的tabindex.

它适用于文本框和按钮,但复选框.

为什么?感谢帮助.

编辑

 // groupBox2
        // 
        this.groupBox2.Controls.Add(this.pictureBox10);
        this.groupBox2.Controls.Add(this.pictureBox9);
        this.groupBox2.Controls.Add(this.pictureBox8);
        this.groupBox2.Controls.Add(this.pictureBox7);
        this.groupBox2.Controls.Add(this.chkStoplight);
        this.groupBox2.Controls.Add(this.lblStoplight);
        this.groupBox2.Controls.Add(this.chkIsCount);
        this.groupBox2.Controls.Add(this.chkExceptionFlag);
        this.groupBox2.Controls.Add(this.chkIsActive);
        this.groupBox2.Controls.Add(this.lblIsActive);
        this.groupBox2.Controls.Add(this.lblExceptionFlag);
        this.groupBox3.Controls.Add(this.lblIsCount);
        this.groupBox2.Location = new System.Drawing.Point(16, 201);
        this.groupBox2.Name = "groupBox2";
        this.groupBox2.Size = new System.Drawing.Size(321, 70);
        this.groupBox2.TabIndex = 10;
        this.groupBox2.TabStop = true;
        this.groupBox2.Text = "Flags";

        // 
        // chkStoplight
        // 
        this.chkStoplight.AutoSize = true;
        this.chkStoplight.Location = new System.Drawing.Point(44, 25);
        this.chkStoplight.Name = "chkStoplight";
        this.chkStoplight.Size = new System.Drawing.Size(15, 14);
        this.chkStoplight.TabIndex = 0;
        this.chkStoplight.UseVisualStyleBackColor = true;

        In the property, I found TabStop is true for chkStoplight.
Run Code Online (Sandbox Code Playgroud)

.net c# winforms

8
推荐指数
1
解决办法
2万
查看次数

标签 统计

c# ×2

winforms ×2

.net ×1

windows-forms-designer ×1