diff --git a/components/mbColorLib/HSLColorPicker.pas b/components/mbColorLib/HSLColorPicker.pas index 570d9735c..784f24ee1 100644 --- a/components/mbColorLib/HSLColorPicker.pas +++ b/components/mbColorLib/HSLColorPicker.pas @@ -52,7 +52,7 @@ type procedure CreateWnd; override; procedure Resize; override; procedure Paint; override; - procedure PaintParentBack; override; +// procedure PaintParentBack; override; procedure WMSetFocus(var Message: {$IFDEF FPC}TLMSetFocus{$ELSE}TWMSetFocus{$ENDIF}); message {$IFDEF FPC}LM_SETFOCUS{$ELSE}WM_SETFOCUS{$ENDIF}; procedure DoMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); @@ -109,8 +109,8 @@ uses constructor THSLColorPicker.Create(AOwner: TComponent); begin inherited; - ControlStyle := ControlStyle - [csAcceptsControls] + [csOpaque]; - DoubleBuffered := true; +// ControlStyle := ControlStyle - [csAcceptsControls] + [csOpaque]; + //DoubleBuffered := true; PBack := TBitmap.Create; PBack.PixelFormat := pf32bit; {$IFDEF DELPHI_7_UP} {$IFDEF DELPHI} @@ -323,7 +323,7 @@ function THSLColorPicker.GetManual:boolean; begin Result := FHSPicker.Manual or FLPicker.Manual; end; - + (* procedure THSLColorPicker.PaintParentBack; begin if PBack = nil then @@ -333,13 +333,20 @@ begin end; PBack.Width := Width; PBack.Height := Height; - PaintParentBack(PBack); + if Color = clDefault then begin + PBack.Transparent := true; + PBack.TransparentColor := clForm; + PBack.Canvas.Brush.Color := clForm; + end else + PBack.Canvas.Brush.Color := Color; + PBack.Canvas.FillRect(0, 0, Width, Height); +// PaintParentBack(PBack); end; - + *) procedure THSLColorPicker.Resize; begin inherited; - PaintParentBack; + // PaintParentBack(Canvas); if (FHSPicker = nil) or (FLPicker = nil) then exit; @@ -354,12 +361,12 @@ end; procedure THSLColorPicker.CreateWnd; begin inherited; - PaintParentBack; + // PaintParentBack; end; procedure THSLColorPicker.Paint; begin - PaintParentBack; + PaintParentBack(Canvas); Canvas.Draw(0, 0, PBack); end; diff --git a/components/mbColorLib/HexaColorPicker.pas b/components/mbColorLib/HexaColorPicker.pas index ae05922f5..77ddd7182 100644 --- a/components/mbColorLib/HexaColorPicker.pas +++ b/components/mbColorLib/HexaColorPicker.pas @@ -295,24 +295,28 @@ var XOffs, YOffs, Count: Integer; dColor: Single; OffScreen: TBitmap; - {$IFDEF DELPHI_7_UP} + {$IFDEF DELPHI_7_UP} {$IFDEF DELPHI} MemDC: HDC; OldBMP: HBITMAP; - {$ENDIF} + {$ENDIF} {$ENDIF} begin OffScreen := TBitmap.Create; try - OffScreen.PixelFormat := pf32bit; + // OffScreen.PixelFormat := pf32bit; OffScreen.Width := Width; OffScreen.Height := FColorCombRect.Bottom - FColorCombRect.Top + FBWCombRect.Bottom - FBWCombRect.Top; //Parent background {$IFDEF FPC} if Color = clDefault then + begin + Offscreen.Transparent := true; + Offscreen.TransparentColor := clForm; Offscreen.Canvas.Brush.Color := clForm - else + end else {$ENDIF} OffScreen.Canvas.Brush.Color := Color; OffScreen.Canvas.FillRect(OffScreen.Canvas.ClipRect); + {$IFDEF DELPHI_7_UP}{$IFDEF DELPHI} if ParentBackground then with ThemeServices do @@ -325,6 +329,7 @@ begin if MemDC <> 0 then DeleteDC(MemDC); end; {$ENDIF}{$ENDIF} + with OffScreen.Canvas do begin Pen.Style := psClear; @@ -454,7 +459,7 @@ end; procedure THexaColorPicker.Paint; begin - PaintParentBack; + PaintParentBack; //(Canvas); if FColorCombs = nil then CalculateCombLayout; DrawCombControls; diff --git a/components/mbColorLib/SLHColorPicker.pas b/components/mbColorLib/SLHColorPicker.pas index 06f8b0b84..0fd521300 100644 --- a/components/mbColorLib/SLHColorPicker.pas +++ b/components/mbColorLib/SLHColorPicker.pas @@ -52,7 +52,7 @@ type procedure DoChange; procedure DoMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); procedure Paint; override; - procedure PaintParentBack; override; +// procedure PaintParentBack; override; procedure Resize; override; procedure WMSetFocus(var Message: {$IFDEF FPC}TLMSetFocus{$ELSE}TWMSetFocus{$ENDIF}); message {$IFDEF FPC}LM_SETFOCUS{$ELSE}WM_SETFOCUS{$ENDIF}; @@ -329,7 +329,7 @@ end; procedure TSLHColorPicker.Resize; begin inherited; - PaintParentBack; +// PaintParentBack; if (FSLPicker = nil) or (FHPicker = nil) then exit; @@ -340,7 +340,7 @@ begin FHPicker.Left := Width - FHPicker.Width; FHPicker.Height := Height; end; - + { procedure TSLHColorPicker.PaintParentBack; begin if PBack = nil then @@ -351,12 +351,12 @@ begin PBack.Width := Width; PBack.Height := Height; PaintParentBack(PBack); -end; +end; } procedure TSLHColorPicker.Paint; begin - PaintParentBack; - Canvas.Draw(0, 0, PBack); + PaintParentBack(Canvas); +// Canvas.Draw(0, 0, PBack); end; procedure TSLHColorPicker.CreateWnd; diff --git a/components/mbColorLib/mbBasicPicker.pas b/components/mbColorLib/mbBasicPicker.pas index 435811099..c0e876b02 100644 --- a/components/mbColorLib/mbBasicPicker.pas +++ b/components/mbColorLib/mbBasicPicker.pas @@ -45,12 +45,12 @@ type procedure WMEraseBkgnd(var Message: TWMEraseBkgnd); message WM_ERASEBKGND; {$ELSE} procedure CMParentColorChanged(var Message: TLMessage); message CM_PARENTCOLORCHANGED; - procedure WMEraseBkgnd(var Message: TLMEraseBkgnd); message LM_ERASEBKGND; +// procedure WMEraseBkgnd(var Message: TLMEraseBkgnd); message LM_ERASEBKGND; {$ENDIF} public constructor Create(AOwner: TComponent); override; destructor Destroy; override; - function GetDefaultColor(const DefaultColorType: TDefaultColorType): TColor; override; +// function GetDefaultColor(const DefaultColorType: TDefaultColorType): TColor; override; published property ParentColor default true; end; @@ -95,11 +95,11 @@ procedure TmbBasicPicker.CreateGradient; begin // to be implemented by descendants end; - + { function TmbBasicPicker.GetDefaultColor(const DefaultColorType: TDefaultColorType): TColor; begin result := inherited GetDefaultColor(DefaultColorType); -end; +end; } function TmbBasicPicker.GetGradientColor(AValue: Integer): TColor; begin @@ -170,13 +170,19 @@ end; procedure TmbBasicPicker.PaintParentBack(ABitmap: TBitmap); begin + ABitmap.Width := Width; + ABitmap.Height := Height; {$IFNDEF DELPHI} - if Color = clDefault then - ABitmap.Canvas.Brush.Color := GetDefaultColor(dctBrush) - else + if Color = clDefault then begin + ABitmap.Transparent := true; + ABitmap.TransparentColor := clForm; + ABitmap.Canvas.Brush.Color := clForm; //GetDefaultColor(dctBrush) + end else {$ENDIF} ABitmap.Canvas.Brush.Color := Color; ABitmap.Canvas.FillRect(ABitmap.Canvas.ClipRect); + Canvas.Draw(0, 0, ABitmap); + {$IFDEF DELPHI_7_UP}{$IFDEF DELPHI} if ParentBackground then with ThemeServices do @@ -197,7 +203,11 @@ var begin Offscreen := TBitmap.Create; try - Offscreen.PixelFormat := pf32bit; + // Offscreen.PixelFormat := pf32bit; + if Color = clDefault then begin + Offscreen.Transparent := true; + Offscreen.TransparentColor := GetDefaultColor(dctBrush); + end; Offscreen.Width := Width; Offscreen.Height := Height; PaintParentBack(Offscreen); @@ -244,13 +254,13 @@ begin Result := true; end; - + (* !!!!!!!!!!!!!!!!! procedure TmbBasicPicker.WMEraseBkgnd( var Message: {$IFDEF DELPHI}TWMEraseBkgnd{$ELSE}TLMEraseBkgnd{$ENDIF} ); begin inherited; // Message.Result := 1; -end; +end; *) end. diff --git a/components/mbColorLib/mbColorTree.pas b/components/mbColorLib/mbColorTree.pas index 490f8f403..a66819cd1 100644 --- a/components/mbColorLib/mbColorTree.pas +++ b/components/mbColorLib/mbColorTree.pas @@ -348,7 +348,7 @@ begin if Selected then Brush.Color := clHighlight else - Brush.Color := Color; //clBtnFace; + Brush.Color := Color; FillRect(R); MoveTo(R.Left, R.Bottom - 1); LineTo(R.Right, R.Bottom - 1); @@ -427,13 +427,15 @@ begin Font.Style := [fsBold]; if Selected then begin - Brush.Color := clHighlightText; + //Brush.Color := clHighlightText; Pen.Color := clHighlightText; + Font.Color := clHighlightText; end else begin - Brush.Color := clWindowText; + //Brush.Color := clWindowText; Pen.Color := clWindowText; + Font.Color := clWindowText; end; TR := Rect(R.Left + 48, R.Top + (48 - TextHeight(itemText)) div 2, R.Right - 15, R.Bottom); if Assigned(FDraw) then FDraw(Self, Index, Canvas.Font, itemText, Selected); diff --git a/components/mbColorLib/mbTrackBarPicker.pas b/components/mbColorLib/mbTrackBarPicker.pas index 5682ab08f..0c16b569f 100644 --- a/components/mbColorLib/mbTrackBarPicker.pas +++ b/components/mbColorLib/mbTrackBarPicker.pas @@ -56,7 +56,6 @@ type FBevelOuter: TBevelCut; FBevelWidth: TBevelWidth; FBorderStyle: TBorderStyle; - procedure SetBevelInner(Value: TBevelCut); procedure SetBevelOuter(Value: TBevelCut); procedure SetBevelWidth(Value: TBevelWidth); @@ -77,8 +76,10 @@ type FPickRect: TRect; FLayout: TTrackBarLayout; FLimit: integer; + FBack: TBitmap; procedure CreateGradient; override; procedure Paint; override; +// procedure PaintParentBack; procedure DrawFrames; dynamic; procedure Resize; override; procedure CreateWnd; override; @@ -191,7 +192,7 @@ const constructor TmbTrackBarPicker.Create(AOwner: TComponent); begin inherited; - ControlStyle := ControlStyle - [csAcceptsControls] + [csOpaque]; + //ControlStyle := ControlStyle - [csAcceptsControls]; // + [csOpaque]; // !!!!!!!! DoubleBuffered := true; {$IFDEF DELPHI_7_UP} {$IFDEF DELPHI} ParentBackground := true; @@ -200,10 +201,14 @@ begin Height := 22; TabStop := true; ParentShowHint := true; + + FBack := TBitmap.Create; + FGradientWidth := 256; FGradientHeight := 12; FGradientBmp := TBitmap.Create; FGradientBmp.PixelFormat := pf32bit; + mx := 0; my := 0; FIncrement := 1; @@ -232,6 +237,7 @@ end; destructor TmbTrackbarPicker.Destroy; begin FGradientBmp.Free; + FBack.Free; inherited; end; @@ -385,7 +391,7 @@ end; procedure TmbTrackBarPicker.Paint; begin CalcPickRect; - PaintParentBack; + PaintParentBack(Canvas); FArrowPos := GetArrowPos; Execute(TBA_Paint); if FBorderStyle <> bsNone then