请教各路豪杰:请问DRAG AND DROP在DELPHI中怎么用?
例如从一个DBgrid向另外一个DBGrid拖拽,请给出简单示例!
另外,我在TreeView中的Expanding事件中添加新接点,我希望
赋值给Node但是他每次都将我要展开的Node的下一级子接点的最后
报告给我,我该怎么做。我不想用Label,如能解决,不胜感激!!
例如从一个DBgrid向另外一个DBGrid拖拽,请给出简单示例!
另外,我在TreeView中的Expanding事件中添加新接点,我希望
赋值给Node但是他每次都将我要展开的Node的下一级子接点的最后
报告给我,我该怎么做。我不想用Label,如能解决,不胜感激!!
解决方案 »
- 急~delphi報表打印出錯
- filter order by问题
- TFastSearch控件
- TADOQuery参数类型不匹配:expecting:Integer actual:BCD
- 请问TWinSocketStream.read(strbuf,100)能读strbub中的回车符吗?
- rxrichedit怎么调不出PopupMenu
- C++中的Uchar* 对应于delphi中类型?
- 怎么获得delphi的源程序 在线等!立即给分!
- 如何选定一个TDBGRID中的所有行?
- 在mdi表單中調用設為最大化的子表單時,它首先顯示小的子表單,然后才把它最大化,影響美觀,有何辦法解決?
- 通过IP获得计算机名
- 请问TBUTTON上的字可以换行吗?谢谢
http://www.chinaoak.com/download/material/interface/BCBDragDrop.htm
http://www.ruijier.com/knowledge/program/de4.htm
2.第二个你要实现什么功能?
This code comes from an application that contains a list box and three labels, each with a different font and color. The DragMode property for each of the labels is dmAutomatic. The user can select a label and drag it to a list box and drop it. When the label is dropped, the items in the list box assume the color and font of the dropped label.
This OnDragOver event handler permits the list box to accept a dropped label:procedure TForm1.ListBox1DragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);begin
Accept := Source is TLabel;end;This OnDragDrop event handler implements the drop behavior.procedure TForm1.ListBox1DragDrop(Sender, Source: TObject; X, Y: Integer);begin
if (Sender is TListBox) and (Source is TLabel) then
begin
with Sender as TListBox do
begin
Font := (Source as TLabel).Font;
Color := (Source as TLabel).Color;
end;
end;
end;至于OnExpanding事件,俺不明白你在问什么。俺用该事件没遇到什么问题。
什么是“Node的下一级子节点的最后报告”?你用Label干什么?倒成了俺提问了。呵呵。
---------------------------------1问题如上--------------------------
我要做的是部门和人员对照关系情况。我的部门有N级,每级以三位字符串递加。编码不会重复,但是部门名称可以不同级重复。我想在左边的树中表现的是分级部门情况,即只有部门名称而不出现部门编码。所以按照以前的习惯我在Form的Create事件中加入了根节点,然后在每次对节点进行展开的时候加入他的子节点也就是在OnExpanding事件中。可是由于我每次添加给树的内容:即表现出来的标题在库中是不唯一的,所以我用到了Data,我希望在我每次展开节点的时候找到我添加的Data,然后通过Data再到数据库中查询,做出相应的动作。可是每次我想在OnExpanding中查找Data时,我发现我总不能得到我点击的那个节点的Data,我得到的是他的子节点的最末Data。或许是我用的不对,或许是其他什么的原因,我始终没有办法解决,请二位大虾帮忙!!!!Data是我按照帮助上面声明的指向Record的一个指针。