如题,还有combo等控件,方法应该一样吧?

解决方案 »

  1.   

    TextBox textBox1 = new TextBox();
    textBox1.BackColor = System.Drawing.SystemColors.Control;
    textBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
    textBox1.Location = new System.Drawing.Point(64, 20);
    textBox1.Name = "textBox1";
    textBox1.Size = new System.Drawing.Size(200, 14);
    textBox1.TabIndex = 0;
    textBox1.Text = "textBox1";Label label1 = new Label(); 
    label1.BackColor = System.Drawing.Color.Black;
    label1.Location = new System.Drawing.Point(64, 34);
    label1.Name = "label1";
    label1.Size = new System.Drawing.Size(200, 1);
    label1.TabIndex = 1;
    label1.Text = "label1";Controls.Add(textBox1);
    Controls.Add(label1);
    为了方便使用,你可以做成用户控件。
      

  2.   

    有没办法直接重载textBox,设置其样式呢
      

  3.   

    在web里可以用css
    .textstyle 
    {
    color: #000000; 
    FONT-SIZE: 9pt; 
    border-left: medium none; 
    border-right: medium none; 
    border-top: medium none; 
    border-bottom: 1px solid rgb(192,192,192)

    }
    winform俺就不知道了.
      

  4.   

    估计要从CustomControl继承,然后在OnPain()事件中自己按需要重新绘制一下外观吧
      

  5.   

    可以重载OnPain的事件
    也可以直接画
      

  6.   

    这样可以,曾经用过
    如<asp:TextBox id="TextBox1" runat="server" style="Z-INDEX: 102; LEFT: 398px; BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; POSITION: absolute; TOP: 298px; BORDER-BOTTOM-STYLE: solid"></asp:TextBox>只有加样式style="Z-INDEX: 102; LEFT: 398px; BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; POSITION: absolute; TOP: 298px; BORDER-BOTTOM-STYLE: solid"就可以,你试试
      

  7.   

    在WinForm里是不可以直接使用的
    只有自己写用户控件了
      

  8.   

    郁闷。搂住问问题。也不会问啊。在么。有人在回答。WEB中的控件。郁闷ing.
      

  9.   

    我的建议:
    1.把TextBox的BorderStyle改成None
    2.把TextBox的BackColor改成Control(如果仍然需要它为白色背景则不用做此步)
    3.用Panl或者GroupBox等控件在它下面画一条线(即高度接近0),或者用GDI+的方法自己DrawLine()一条线也可以.
    这样就可以达到你想要的效果.
      

  10.   

    把TextBox的BorderStyle设成None.
    然后在OnPaint里画一条直线就行了.