customdrawn: Corrects the drawing of TCDGroupBox dsCommon and dsWinCE

git-svn-id: trunk@33469 -
This commit is contained in:
sekelsenmat 2011-11-11 06:04:49 +00:00
parent bb87ce4341
commit 6eb2ce848f
2 changed files with 49 additions and 2 deletions

View File

@ -940,10 +940,14 @@ begin
ADest.Rectangle(0, 0, ASize.cx, ASize.cy);
// frame
ADest.Pen.Color := clBlack;
ADest.Pen.Color := WIN2000_FRAME_WHITE;
ADest.Pen.Style := psSolid;
ADest.Brush.Style := bsClear;
ADest.Rectangle(0, FCaptionMiddle, ASize.cx, ASize.cy-FCaptionMiddle);
ADest.Rectangle(Bounds(1, 1+FCaptionMiddle, ASize.cx-1, ASize.cy-1-FCaptionMiddle));
ADest.Pen.Color := WIN2000_FRAME_GRAY;
ADest.Rectangle(Bounds(0, FCaptionMiddle, ASize.cx-1, ASize.cy-1-FCaptionMiddle));
ADest.Pixels[0, ASize.cy-1] := WIN2000_FRAME_WHITE;
ADest.Pixels[ASize.cx-1, FCaptionMiddle] := WIN2000_FRAME_WHITE;
// ToDo: Make the caption smaller if it is too big
lCaption := AStateEx.Caption;

View File

@ -41,6 +41,9 @@ type
// TCDCheckBox
procedure DrawCheckBoxSquare(ADest: TCanvas; ADestPos: TPoint; ASize: TSize;
AState: TCDControlState; AStateEx: TCDControlStateEx); override;
// TCDGroupBox
procedure DrawGroupBox(ADest: TCanvas; ADestPos: TPoint; ASize: TSize;
AState: TCDControlState; AStateEx: TCDControlStateEx); override;
// ===================================
// Common Controls Tab
// ===================================
@ -184,6 +187,46 @@ begin
end;
end;
procedure TCDDrawerWinCE.DrawGroupBox(ADest: TCanvas; ADestPos: TPoint;
ASize: TSize; AState: TCDControlState; AStateEx: TCDControlStateEx);
var
FCaptionMiddle: integer;
lTextSize: TSize;
lCaption: String;
begin
FCaptionMiddle := ADest.TextHeight(cddTestStr) div 2;
if FCaptionMiddle = 0 then FCaptionMiddle := AStateEx.Font.Size div 2;
if FCaptionMiddle = 0 then FCaptionMiddle := 5;
// Background
ADest.Brush.Color := AStateEx.ParentRGBColor;
ADest.Brush.Style := bsSolid;
ADest.Pen.Style := psSolid;
ADest.Pen.Color := AStateEx.ParentRGBColor;
ADest.Rectangle(0, 0, ASize.cx, ASize.cy);
// frame
ADest.Pen.Color := clBlack;
ADest.Pen.Style := psSolid;
ADest.Brush.Style := bsClear;
ADest.Rectangle(0, FCaptionMiddle, ASize.cx, ASize.cy);
// ToDo: Make the caption smaller if it is too big
lCaption := AStateEx.Caption;
lTextSize := ADest.TextExtent(lCaption);
// fill the text background
ADest.Brush.Style := bsSolid;
ADest.Brush.Color := AStateEx.ParentRGBColor;
ADest.Pen.Style := psClear;
ADest.Rectangle(Bounds(FCaptionMiddle, 0, lTextSize.cx+5, lTextSize.cy));
// paint text
ADest.Pen.Style := psClear;
ADest.Brush.Style := bsClear;
ADest.TextOut(FCaptionMiddle+3, 0, lCaption);
end;
procedure TCDDrawerWinCE.DrawTab(ADest: TCanvas; ADestPos: TPoint;
ASize: TSize; AState: TCDControlState; AStateEx: TCDCTabControlStateEx);
var