编了个程序报错无法将类型“int”隐式转换为“System.Windows.Thickness”

风一样的大叔 2011-05-25 11:07:34
编了个程序报错无法将类型“int”隐式转换为“System.Windows.Thickness”




int fontwidth1 = Int32.Parse(ds["fontwidth1"].ToString());
int fontwidth2 = Int32.Parse(ds["fontwidth2"].ToString());
int fontwidth3 = Int32.Parse(ds["fontwidth3"].ToString());

this.textBlock1.Padding =fontwidth1;

就想做个可以动态改变textbox之间的行距的效果,求高手指教啊
...全文
281 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
风一样的大叔 2011-06-02
  • 打赏
  • 举报
回复
可以了,谢谢
风一样的大叔 2011-06-02
  • 打赏
  • 举报
回复
哦,谢谢啊
我试试
Mr_graceless 2011-05-25
  • 打赏
  • 举报
回复
有没有试试强制转换?
this.textBlock1.Padding =(System.Windows.Thickness)fontwidth1;

类似这样的。
我姓区不姓区 2011-05-25
  • 打赏
  • 举报
回复
this.textBlock1.Padding = new System.Windows.Thickness((double)fontwidth1);
风一样的大叔 2011-05-25
  • 打赏
  • 举报
回复
自己先顶个

110,566

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧