From 6eb2ce848ffdb67c0c5b12eb3761cbe3be6bf84e Mon Sep 17 00:00:00 2001 From: sekelsenmat Date: Fri, 11 Nov 2011 06:04:49 +0000 Subject: [PATCH] customdrawn: Corrects the drawing of TCDGroupBox dsCommon and dsWinCE git-svn-id: trunk@33469 - --- components/customdrawn/customdrawn_common.pas | 8 +++- components/customdrawn/customdrawn_wince.pas | 43 +++++++++++++++++++ 2 files changed, 49 insertions(+), 2 deletions(-) diff --git a/components/customdrawn/customdrawn_common.pas b/components/customdrawn/customdrawn_common.pas index 9ba497c1f6..738903899c 100644 --- a/components/customdrawn/customdrawn_common.pas +++ b/components/customdrawn/customdrawn_common.pas @@ -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; diff --git a/components/customdrawn/customdrawn_wince.pas b/components/customdrawn/customdrawn_wince.pas index c8bcab878a..9c9b9cbe68 100644 --- a/components/customdrawn/customdrawn_wince.pas +++ b/components/customdrawn/customdrawn_wince.pas @@ -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