in
Forums
Blogs
Files
Devexpress.Com
ClientCenter
Support Center
DevExpress Channel

How To Draw Watermark Text On the Center of The Grid?

Last post 8/30/2008 4:49 AM by Hars Harsya. 0 replies.
Page 1 of 1 (1 items)
Sort Posts:
Previous Next
  • 8/30/2008 4:49 AM

    How To Draw Watermark Text On the Center of The Grid?

    I try to experimenting with quantum grid v 6.36,

    As we know that we can draw grid background with the following code:

    procedure TForm3.cxGrid1DBTableView1CustomDrawCell(
      Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
      AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
    var
      ARec: TRect;
      ABitmap: TBitmap;
      ATextToDraw: string;
    begin
      if (AViewInfo is TcxGridTableDataCellViewInfo) then
        ATextToDraw := AViewInfo.GridRecord.DisplayTexts[AViewInfo.Item.Index]
      else
        ATextToDraw := VarAsType(AViewInfo.Item.Caption, varString);
      ARec := AViewInfo.Bounds;
      ABitmap := TBitmap.Create;
      ABitmap.LoadFromFile('canceled.bmp');

      ACanvas.Canvas.Brush.Bitmap := ABitmap;
      ACanvas.Canvas.FillRect(ARec);
      ABitmap.Free;
      SetBkMode(ACanvas.Canvas.Handle, TRANSPARENT);
      ACanvas.DrawText(ATextToDraw, AViewInfo.Bounds, 0);
      ADone := True;
    end;

    canceled.bmp is just an image with "CANCELED" text on it.

    ( i developed an sales order application, and when the order is canceled, it will show "canceled" watermark image on the grid)

    The question is, is there any other way to draw background image from a text,

    i mean it just useles i load an image with just a text on it if we can draw directly the "CANCELED" text on the grid background, and put it in the center of the grid..

    any idea how to do this?

    any answers with code snippet  would greatly appreciated Big Smile

Page 1 of 1 (1 items)
Copyright © 1998-2008 Developer Express Inc.
ALL RIGHTS RESERVED