一个简单的GDI问题,谢谢了

lxlx714 2008-04-11 07:51:10
我用的Visual C++ 2005,是一个windows application Form,我做一个渐变的背景,但不知道为什么做color这块

pBrush->CenterColor=Color::Blue;
Color [] colors = {Color::FromArgb(255, 0, 0)}; //这里报错
pBrush->SurroundColors=colors;
g->FillEllipse(pBrush,250,100,200,100);

error C2143: syntax error : missing ';' before '['
error C3409: empty attribute block is not allowed
error C2146: syntax error : missing ';' before identifier 'colors'
error C2065: 'colors' : undeclared identifier

谢谢了,请问这里的颜色应该怎么写啊?
...全文
35 4 打赏 收藏 举报
写回复
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
lalala3656 2008-08-02
  • 打赏
  • 举报
回复
我也遇到了跟你一样的问题呀!老兄.看来这个VC++2005.net windows forms application 真它妈的不好用呀!
lxlx714 2008-04-11
  • 打赏
  • 举报
回复
来高人帮下吧,很着急啊
lxlx714 2008-04-11
  • 打赏
  • 举报
回复
如果改成 Color colors[]
就是这样的错误了
1>d:\my documents\visual studio 2005\projects\try\try\Form1.h(97) : error C2728: 'System::Drawing::Color' : a native array cannot contain this managed type
1> Did you mean 'array<System::Drawing::Color>'?
1>d:\my documents\visual studio 2005\projects\try\try\Form1.h(98) : error C2664: 'System::Drawing::Drawing2D::PathGradientBrush::SurroundColors::set' : cannot convert parameter 1 from 'System::Drawing::Color [1]' to 'cli::array<Type,dimension> ^'
1> with
1> [
1> Type=System::Drawing::Color,
1> dimension=1
1> ]
星羽 2008-04-11
  • 打赏
  • 举报
回复
Color [] colors

->

Color colors[]


??
相关推荐
发帖
C++ 语言

6.3w+

社区成员

C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
帖子事件
创建了帖子
2008-04-11 07:51
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下