Hello.
Let me write one more interesting question today. I do copying of tcxGrid. On a standard grid, I did a replacement for Boolean fields like this:
procedure TFormClient.DrawGridCheckBox(Canvas: TCanvas; Rect: TRect; Checked: boolean); var DrawFlags: Integer; begin Canvas.TextRect(Rect, Rect.Left + 1, Rect.Top + 1, ' '); DrawFrameControl(Canvas.Handle, Rect, DFC_BUTTON, DFCS_BUTTONPUSH or DFCS_ADJUSTRECT); DrawFlags := DFCS_BUTTONCHECK or DFCS_ADJUSTRECT;// DFCS_BUTTONCHECK if Checked then DrawFlags := DrawFlags or DFCS_CHECKED; DrawFrameControl(Canvas.Handle, Rect, DFC_BUTTON, DrawFlags); end; Given that TcxCanvas is of a different nature than TCanvas, I rewrite it this way:
procedure TFormClient.DrawGridCheckBox(Canvas: TcxCanvas; Rect: TRect; Checked: boolean); var DrawFlags: Integer; StrCanvas : TCanvas; MyRect: TRect; begin StrCanvas.TextRect(Rect, Rect.Left + 1, Rect.Top + 1, ' '); Canvas.CopyRect(MyRect, StrCanvas, Rect); DrawFrameControl(Canvas.Handle, MyRect, DFC_BUTTON, DFCS_BUTTONPUSH or DFCS_ADJUSTRECT); DrawFlags := DFCS_BUTTONCHECK or DFCS_ADJUSTRECT;// DFCS_BUTTONCHECK if Checked then DrawFlags := DrawFlags or DFCS_CHECKED; DrawFrameControl(Canvas.Handle, MyRect, DFC_BUTTON, DrawFlags); end; However, this does not work, throws out a memory error. According to the assembler, I don’t want to look for a problem. The point is that I cannot find something similar to TextRect in tcxcanvas, since it was with his help that I redrawn ugly Boolean digits 1 and 0 and made quite a decent bird if the value is true in the grid. There is no such detailed documentation, for some reason I can’t see the modules either, so I’m guessing about what's in this TextExtend (). I would like to find something like TextRect. Who can give good advice? Is there a master on these issues)?
PS Let me remind everyone who forgot, TRect has the following structure:
PRect = ^TRect; TRect = record case Integer of 0: (Left, Top, Right, Bottom: Longint); 1: (TopLeft, BottomRight: TPoint); end;