Note that there are some explanatory texts on larger screens.

plurals
  1. PODrag image change while drag over grid
    text
    copied!<p>I'm creating an instance of my custom DragObject on StartDrag:</p> <pre><code>procedure TForm1.GridStartDrag(Sender: TObject; var DragObject: TDragObject); begin DragObject := TMyDragControlObject.Create(Sender as TcxGridSite); end; </code></pre> <p>Lately on another grid on DragOver: </p> <pre><code>procedure TForm1.SecondGridDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean); begin Accept := False; if Source is TMyDragControlObject then with TMyDragControlObject(Source) do // using TcxGrid if (Control is TcxGridSite) or (Control is TcxGrid) then begin Accept := True // checking the record value on grid // the label of drag cursor will be different // getting the record value works fine! if RecordOnGrid.Value &gt; 5 then DragOverPaint(FImageList, 'You can drop here!'); else begin Accept := false; DragOverPaint(FImageList, 'You can''t drop here!'); end end; end; </code></pre> <p>My DragOverPaint procedure:</p> <pre><code>procedure TForm1.DragOverPaint(ImageList: TImageList; AValue: string); var ABmp: TBitmap; begin if not Assigned(ImageList) then Exit; ABmp := TBitmap.Create(); try with ABmp.Canvas do begin ABmp.Width := TextWidth(AValue); ABmp.Height := TextHeight(AValue); TextOut(0, 0, AValue); end; ImageList.BeginUpdate; ImageList.Clear; ImageList.Width := ABmp.Width; ImageList.Height := ABmp.Height; ImageList.AddMasked(ABmp, clNone); ImageList.EndUpdate; finally ABmp.Free(); end; Repaint; end; </code></pre> <p>I want it to repaint DragImageList depending on the grid record value, but the image list doesn't refresh when it's already painted.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload