右键点击ListView如何才能不改变选中状态?
一般鼠标点击ListView会改变项的选中状态(不管是左键还是右键),
如何才能使得右键不改变选中状态?我只要弹出菜单。
[解决办法]
自己画背景
[解决办法]
- Delphi(Pascal) code
private ...... OldWndMethod: TWndMethod; procedure NewWndMethod(var message:TMessage); ......public procedure AfterConstruction; override;implementation......procedure TFormContractList.AfterConstruction; (//FormContractList是我的FORM,不要照抄)begin inherited; OldWndMethod := ListView.WindowProc; ListView.WindowProc := NewWndMethod;end;procedure TFormContractList.NewWndMethod(var message: TMessage);begin case message.Msg of //WM_Paint: ListView.Columns[ListView.Columns.Count - 1].Width := -2; WM_RButtonDown, WM_RButtonUp: Exit; end; OldWndMethod(message);end;