如何从TDBGrid拖放? [英] How do I drag and drop from a TDBGrid?
本文介绍了如何从TDBGrid拖放?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果将DragMode设置为dmAutomatic,则会阻止我选择行。
如果我使用OnCellClick调用BeginDrag,则只会在鼠标向上拖动时触发,这在我看来并没有拖动。
如果我使用OnMouseDown,它只会在标题行上触发。
If I set DragMode to dmAutomatic it prevents me from selecting rows. If I used OnCellClick to call BeginDrag it only fires on mouse up, which is not dragging in my opinion. If I use OnMouseDown it only fires on title row.
我应该怎么做?
推荐答案
重载MouseDown将导致所需的结果。
Overloading MouseDown will lead to the desired result.
type
TDBGrid=Class(DBGrids.TDBGrid)
procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
End;
TForm2 = class(TForm)
.......
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
{ TDBGrid }
procedure TDBGrid.MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
Begindrag(false);
inherited;
end;
这篇关于如何从TDBGrid拖放?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文