퀀텀그리드(cxGrid) 드래그 드롭하기…
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
procedure TForm2.cxGrid2TableView1DragDrop(Sender, Source: TObject; X, Y: Integer); var Source_Site: TcxGridSite; Sender_Site: TcxGridSite; idx, 복사할위치, 복사당할위치 : Integer; 복사당할_레코드 : TcxCustomGridRecord; begin if ( Source is TcxDragControlObject ) then begin Source_Site := TcxGridSite( TcxDragControlObject(Source).Control ); Sender_Site := TcxGridSite(Sender); // TcxGridSite( TcxDragControlObject(Sender).Control ); if Source_Site.GridView is TcxGridTableView then begin // TcxGridTableView ( 그리드_사이트.GridView ).ViewInfo.GetHitTest( Point( x,y ) ) ) // 복사할위치 := TcxGridTableView ( TcxGridSite( TcxDragControlObject(Source).Control ).GridView ).Controller.SelectedRecords[0]; if TcxGridTableView ( Sender_Site.GridView ).ViewInfo.GetHitTest( Point( x,y ) ) is TcxGridRecordCellHitTest then 복사당할_레코드 := TcxGridRecordCellHitTest( TcxGridTableView ( Sender_Site.GridView ).ViewInfo.GetHitTest( Point( x,y ) ) ).GridRecord else 복사당할_레코드 := nil; if 복사당할_레코드 <> nil then idx := TcxGridTableView ( Sender_Site.GridView ).DataController.InsertRecord( 복사당할_레코드.RecordIndex ) else idx := TcxGridTableView( Sender_Site.GridView ).DataController.AppendRecord; TcxGridTableView ( Sender_Site.GridView ).DataController.Values[ idx, 0 ] := TcxGridTableView ( Source_Site.GridView ).Controller.SelectedRecords[0].Values[0]; end; end; end; procedure TForm2.cxGrid2TableView1DragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean); var 그리드_사이트: TcxGridSite; begin if ( Source is TcxDragControlObject ) then begin 그리드_사이트 := TcxGridSite( TcxDragControlObject(Source).Control ); if 그리드_사이트.GridView is TcxGridTableView then begin Accept := TcxGridTableView ( 그리드_사이트.GridView ) = cxGrid1TableView1; end; end; end; |
최신 댓글