.NET-将颜色名称字符串转换为System.Drawing.Color [英] .NET - Converting Color Name Strings into System.Drawing.Color
本文介绍了.NET-将颜色名称字符串转换为System.Drawing.Color的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
将红色,绿色,黄色, aliceblue等字符串转换为实际的System.Drawing.Color值的最佳方法是什么?
What is the best way to turn strings like "red", "green", "yellow", "aliceblue", etc... into the actual System.Drawing.Color value?
我正在查看反射,但似乎不正确。
I was looking at reflection and something about that didn't seem right.
推荐答案
您可以使用Color.FromName()
You can use Color.FromName()
这篇关于.NET-将颜色名称字符串转换为System.Drawing.Color的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文