以编程方式更改texbox的宽度? [英] Programmatically change width of texbox?

查看:64
本文介绍了以编程方式更改texbox的宽度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我认为这很简单,但事实并非如此。我怎么用
以编程方式将文本框的宽度缩小20像素呢?


TextBox1.Width = TextBox1.Width - 20;


不起作用。


提前致谢!


-

I thought this would be straightforward but it''s not. How do I
programmatically reduce the width of a textbox by 20 pixels, say?

TextBox1.Width = TextBox1.Width - 20;

doesn''t work.

Thanks in advance!

--

推荐答案

试用此代码:


TextBox1.Attributes.Add(" width",150)


-

我希望这会有所帮助,

Steve C. Orr,MCSD
http://Steve.Orr.net

" Gandalf" < GA ***** @ sauron.com>在消息中写道

新闻:哦************** @ TK2MSFTNGP12.phx.gbl ...
Try this code:

TextBox1.Attributes.Add("width", 150)

--
I hope this helps,
Steve C. Orr, MCSD
http://Steve.Orr.net
"Gandalf" <ga*****@sauron.com> wrote in message
news:Oh**************@TK2MSFTNGP12.phx.gbl...
我以为这会是直截了当但不是。我如何以编程方式将文本框的宽度缩小20像素呢?

TextBox1.Width = TextBox1.Width - 20;

不会工作。

提前致谢!

-
I thought this would be straightforward but it''s not. How do I
programmatically reduce the width of a textbox by 20 pixels, say?

TextBox1.Width = TextBox1.Width - 20;

doesn''t work.

Thanks in advance!

--



就此而言我可以说:


TextBox1.Width = 150;


有效,但这不是我想要的。


-


" Steve C. Orr,MCSD" <圣*** @ Orr.net>在消息中写道

news:uL ************** @ TK2MSFTNGP11.phx.gbl ...
For that matter I could say:

TextBox1.Width=150;

which works, but that''s not what I want.

--

"Steve C. Orr, MCSD" <St***@Orr.net> wrote in message
news:uL**************@TK2MSFTNGP11.phx.gbl...
试试这段代码:

TextBox1.Attributes.Add(" width",150)

-
我希望这会有所帮助,
Steve C. Orr,MCSD
http://Steve.Orr.net

"甘道夫" < GA ***** @ sauron.com>在消息中写道
新闻:哦************** @ TK2MSFTNGP12.phx.gbl ...
Try this code:

TextBox1.Attributes.Add("width", 150)

--
I hope this helps,
Steve C. Orr, MCSD
http://Steve.Orr.net
"Gandalf" <ga*****@sauron.com> wrote in message
news:Oh**************@TK2MSFTNGP12.phx.gbl...
我认为这很简单但是它'不是。我如何以编程方式将文本框的宽度缩小20像素呢?

TextBox1.Width = TextBox1.Width - 20;

不会工作。

提前致谢!

-
I thought this would be straightforward but it''s not. How do I
programmatically reduce the width of a textbox by 20 pixels, say?

TextBox1.Width = TextBox1.Width - 20;

doesn''t work.

Thanks in advance!

--




你在找这个吗?


this.TextBox1.Width = Unit.Pixel((int)TextBox1.Width.Value - 20);


Natty Gur,首席技术官

Dao2Com Ltd.

28th Baruch Hirsch st。 Bnei-Brak

以色列,51114

电话号码:

办公室:+ 972-(0)3-5786668

传真:+ 972-(0)3-5703475

手机:+ 972-(0)58-888377


了解整体情况

***通过开发人员指南 http://www.developersdex发送。 com ***

不要只是参加USENET ......获得奖励!
are you looking for this ?

this.TextBox1.Width = Unit.Pixel((int)TextBox1.Width.Value - 20) ;

Natty Gur, CTO
Dao2Com Ltd.
28th Baruch Hirsch st. Bnei-Brak
Israel , 51114

Phone Numbers:
Office: +972-(0)3-5786668
Fax: +972-(0)3-5703475
Mobile: +972-(0)58-888377

Know the overall picture
*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!


这篇关于以编程方式更改texbox的宽度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆