关于TGridDrawState命名冲突解决方法(C++ Builder)

程序中使用TStringGrid中, 在OnDrawCell事件中报错如下:
E2015 Ambiguity between 'TGridDrawState' and 'Grids::TGridDrawState' 

在网上搜索相关文章如下:
TGridDrawState名字空间冲突问题及解决方法 (老妖的文章)
http://community.csdn.net/Expert/TopicView3.asp?id=5400740

程序曾经出现以下信息
[C++ Error] audit.cpp(35): E2034 Cannot convert 'void (_fastcall * (_closure )(TObject *,int,int,TRect &,Grids::TGridDrawState))(TObject *,int,int,TRect &,Grids::TGridDrawState)' to 'void (_fastcall * (_closure )(TObject *,int,int,const TRect &,Grids::TGridDrawState))(TObject *,int,int,const TRect &,Grids::TGridDrawState)'

同时根据论坛方法StringGrid1->OnDrawCell = TDrawCellEvent(StringGrid1DrawCell);

最终还是出错提示:
[C++ Error] SystemMain.cpp(159): E2015 Ambiguity between 'TDrawCellEvent' and 'Grids::TDrawCellEvent'

后来在老妖的文章如何自画ListView的Item(XP效果) , 事件OnDrawItem指针ListView1->OnDrawItem =(TLVDrawItemEvent)&CrnDrawListViewItem得到启发;

public声明:
 void __fastcall sgAlertDataDrawCell(TObject *Sender, int ACol,
      int ARow, TRect &Rect, Grids::TGridDrawState State);

将事件指针改为SGridAlert->OnDrawCell = (Grids::TDrawCellEvent)&sgAlertDataDrawCell 编译通过并成功响应事件。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值