积极答复者
VC++2008 winform程序Color::FromArgb的问题

问题
-
在VC++2008中使用Windows应用程序建立窗体做程序的时候,其Color::FromArgb()老是创建不正确,代码如下:
System::Int32^ k=System::Convert ::ToInt32( 0.299 * 222 + 0.587 *333 + 0.114 * 444);
Color red = Color::FromArgb(k,k,k);错误为error C2665: “System::Drawing::Color::FromArgb”: 4 个重载中没有一个可以转换所有参数类型
请问这个怎么解决呢?我着实没有搞懂这个问题的解决办法,谢谢!- 已移动 Sheng Jiang 蒋晟Moderator 2010年10月2日 3:16 System::Drawing (发件人:Visual C++)
答案
-
Int32^和Int32是不同的,一个是值类型,一个是引用类型
The following is signature, not part of post
Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
Visual C++ MVP- 已标记为答案 ThankfulHeartModerator 2010年10月8日 7:06
-
或者你可以直接这样做:
Color red = Color::FromArgb( 255, 0, 0 );
Color green = Color::FromArgb( 0, 255, 0 );
Color blue = Color::FromArgb( 0, 0, 255 );举例部分的整数你填写自己需要的。
- 已标记为答案 ThankfulHeartModerator 2010年10月8日 7:06
全部回复
-
Int32^和Int32是不同的,一个是值类型,一个是引用类型
The following is signature, not part of post
Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
Visual C++ MVP- 已标记为答案 ThankfulHeartModerator 2010年10月8日 7:06
-
或者你可以直接这样做:
Color red = Color::FromArgb( 255, 0, 0 );
Color green = Color::FromArgb( 0, 255, 0 );
Color blue = Color::FromArgb( 0, 0, 255 );举例部分的整数你填写自己需要的。
- 已标记为答案 ThankfulHeartModerator 2010年10月8日 7:06