首页 > 解决方案 > 动态文本框对齐

问题描述

我有一个按钮,单击该按钮将创建其他文本框。问题是我没有让它们与公司代码的默认框对齐。

  public System.Windows.Forms.TextBox Addcompcode()
        {
            System.Windows.Forms.TextBox txt = new System.Windows.Forms.TextBox();
            this.Controls.Add(txt);
            txt.Top = A * 123;
            txt.Left = 90;
            txt.Text = "Company Code";
            A = A + 1;
            return txt;
        }

标签: c#asp.net.net

解决方案


尝试遵循垂直对齐

this.txt.VerticalAlignment = VerticalTextAlignment.Top;

推荐阅读