如何将字符串转换为 Color

wmycom 2010-10-15 10:21:31
已知 字符串 255,255,255分别代表RGB

现在需要将以上 RGB设置为textbox1.backcolor属性。应该怎么写
...全文
223 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
tongfeng1981 2010-10-31
  • 打赏
  • 举报
回复
路过,学习了,赚点积分
1
wuyq11 2010-10-15
  • 打赏
  • 举报
回复
Dim rgbs As String() = TEXTBOX1.Split(","C)
Dim c As Color = Color.FromArgb(Convert.ToInt32(rgbs(0)), Convert.ToInt32(rgbs(1)), Convert.ToInt32(rgbs(2)))
兔子-顾问 2010-10-15
  • 打赏
  • 举报
回复

Dim s As String = "255,255,255"
Dim fields As String() = s.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries)
Dim c As Color = Color.FromArgb(Integer.Parse(fields(0)), Integer.Parse(fields(1)), Integer.Parse(fields(2)))


c->你要的
sprc_lcl 2010-10-15
  • 打赏
  • 举报
回复

string strRgb = "255,255,255";
string[] rgbs = strRgb.Split(',');
Color c = Color.FromArgb(Convert.ToInt32(rgbs[0]),Convert.ToInt32(rgbs[1]),Convert.ToInt32(rgbs[2]));
一路博客 2010-10-15
  • 打赏
  • 举报
回复
TextBox1.BackColor = Color.FromArgb(255, 255, 255)
fananndy 2010-10-15
  • 打赏
  • 举报
回复
这,,不是在textbox中显示不同颜色的文本?

16,718

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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