事件付值问题

surname 2003-07-30 10:08:06
void __fastcall TForm1::FunctionDrawCell(TObject *Sender,
int ACol,int ARow,TRect &Rect,TGridRrawState State)
{
....
}

StringGrid1->OnDrawCell = FunctionDrawCell;

这样子为什么不行?

//-------------------------------------------
void __fastcall TForm1::FunctionSelectCell(TObject *Sender,
int ACol,int ARow,bool &SanSelect)
{
....
}
StringGrid1->OnSelectCell = FunctionSelectCell;
这样子又行,求解,谢谢

...全文
32 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
surname 2003-07-30
  • 打赏
  • 举报
回复
是这样给分吗
surname 2003-07-30
  • 打赏
  • 举报
回复
汗颜... 真是太不好意思了^
行了,谢谢,太感谢了
kingfish 2003-07-30
  • 打赏
  • 举报
回复
出错信息抄错了吧,少了const

加const
void __fastcall TForm1::FunctionDrawCell(TObject *Sender, int ACol,
int ARow, const TRect &Rect, TGridDrawState State)

surname 2003-07-30
  • 打赏
  • 举报
回复
我在窗体的OnCreate事件写的

这样也不行:
StringGrid1->OnDrawCell = &FunctionDrawCell;

可是这句就行:
StringGrid1->OnSelectCell = FunctionSelectCell;
kingfish 2003-07-30
  • 打赏
  • 举报
回复
StringGrid1->OnDrawCell = FunctionDrawCell;
你写在哪的?


比如这样
void __fastcall TForm1::BitBtn1Click(TObject *Sender)
{
StringGrid1->OnDrawCell = FunctionDrawCell;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::FunctionDrawCell(TObject *Sender, int ACol,
int ARow, TRect &Rect, TGridDrawState State)
{
//
}


surname 2003-07-30
  • 打赏
  • 举报
回复
不好意思^,打错
void __fastcall TForm1::FunctionDrawCell(TObject *Sender,
int ACol,int ARow,TRect &Rect,TGridDrawState State)

这样也不行呀
出错信息:
[C++ Error]From1cpp.cpp(1203):E2034 Cannot convert
'void (__fastcall) *(_closure )
(TObject *,int,int,TRect &,TGridDrawState))
(TObject *,int,int,TRect &,TGridDrawState)'
to
'void (__fastcall) *(_closure )
(TObject *,int,int,TRect &,TGridDrawState))
(TObject *,int,int,TRect &,TGridDrawState)'
kingfish 2003-07-30
  • 打赏
  • 举报
回复
是Draw
Rraw是什么意思,你在哪里看来的
surname 2003-07-30
  • 打赏
  • 举报
回复
类TStringGrid 的 OnDrawCell 这个事件参数是有 TGridRrawState 这个啊
kingfish 2003-07-30
  • 打赏
  • 举报
回复
TGridRrawState????
TGridDrawState

604

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder VCL组件使用和开发
社区管理员
  • VCL组件使用和开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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