textbox的边框如何改变颜色?,重写也可以!

 所属目录:Java   |   类型:技术问答   |   时间:2007-05-21
 问题:

textbox的边框如何改变颜色?,重写也可以!

· 网友精彩回答:

发表者:jimh

一定要重写了,继承一个控件,这样应该就可以了,颜色可以自己定义,我这里使用的红色。  
  public   class   mytextbox:   textbox  
  {  
  ....  
  protected   override   void   wndproc(ref   message   m)  
  {  
      base.wndproc(ref   m);  
      if   (m.msg   ==   wm_paint)  
      {  
          graphics   g   =   this.creategraphics();  
          g.drawrectangle(pens.red,   0,   0,   this.width   -   1,   this.height   -   1);  
          g.dispose();  
      }  
  }  
  .....  
  }

发表者:singlepine

.txtbox  
  {  
  font-size: 8pt;  
  font-family: verdana;  
  width: 100%;  
  height: 19px;  
  border: 1px   solid   #7b9ebd;  
  vertical-align: middle;    
  }

发表者:ghchen

楼上的方法都行

发表者:cdo

graphics   g   =   this.creategraphics();  
  g.drawrectangle(pens.red,   0,   0,   this.width   -   1,   this.height   -   1);

发表者:dongzi226

textbox1   .bordercolor   =   system.drawing   .color   .red

发表者:itoltgvi

textbox1.bordercolor   =   system.drawing.color.blue

发表者:cuike519

一楼和二楼的分别是winform和webform中的实现方法!

发表者:dongzi226

不用重载;  
  this.textbox1   .borderstyle   =   borderstyle   .solid   ;  
  this.textbox1   .bordercolor   =   system.drawing   .color   .red     ;  
 

发表者:jzerobiao

顶...

.
处理 SSI 文件时出错
© 2006-2008 All Rights Reserved