Ignore:
Timestamp:
Apr 17, 2019, 10:42:18 AM (5 years ago)
Author:
chronos
Message:
  • Modified: Updated Graphics32 library.
Location:
GraphicTest/Packages/Graphics32
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • GraphicTest/Packages/Graphics32

    • Property svn:ignore set to
      lib
  • GraphicTest/Packages/Graphics32/GR32_Dsgn_Color.pas

    r450 r522  
    4747  Consts,
    4848  DesignIntf, DesignEditors, VCLEditors,
    49   Windows, Registry, Graphics, Dialogs, Forms,
     49  Windows, Registry, Graphics, Dialogs, Forms, Controls,
    5050{$ENDIF}
    5151  GR32, GR32_Image;
     
    7070    procedure RemoveColor(const AName: string);
    7171  end;
     72
     73{$IFDEF COMPILER2010_UP}
     74  TColor32Dialog = class(TCommonDialog)
     75  private
     76    FColor: TColor32;
     77    FCustomColors: TStrings;
     78    procedure SetCustomColors(Value: TStrings);
     79  public
     80    function Execute(ParentWnd: HWND): Boolean; override;
     81  published
     82    property Color: TColor32 read FColor write FColor default clBlack32;
     83    property CustomColors: TStrings read FCustomColors write SetCustomColors;
     84    property Ctl3D default True;
     85  end;
     86{$ENDIF}
    7287
    7388  { TColor32Property }
     
    106121
    107122implementation
     123
     124{$IFDEF COMPILER2010_UP}
     125uses
     126  GR32_Dsgn_ColorPicker;
     127{$ENDIF}
    108128
    109129{ TColorManager }
     
    387407
    388408
     409{ TColor32Dialog }
     410
     411{$IFDEF COMPILER2010_UP}
     412procedure TColor32Dialog.SetCustomColors(Value: TStrings);
     413begin
     414  FCustomColors.Assign(Value);
     415end;
     416
     417function TColor32Dialog.Execute(ParentWnd: HWND): Boolean;
     418var
     419  ColorPicker: TFormColorPicker;
     420begin
     421  ColorPicker := TFormColorPicker.Create(nil);
     422  try
     423    ColorPicker.Color := FColor;
     424    Result := ColorPicker.ShowModal = mrOK;
     425    if Result then
     426      FColor := ColorPicker.Color;
     427  finally
     428    ColorPicker.Free;
     429  end;
     430end;
     431{$ENDIF}
     432
     433
    389434{ TColor32Property }
    390435
     
    392437procedure TColor32Property.Edit;
    393438var
     439{$IFDEF COMPILER2010_UP}
     440  ColorDialog: TColor32Dialog;
     441{$ELSE}
    394442  ColorDialog: TColorDialog;
     443{$ENDIF}
    395444  IniFile: TRegIniFile;
    396445
     
    427476begin
    428477  IniFile := nil;
     478{$IFDEF COMPILER2010_UP}
     479  ColorDialog := TColor32Dialog.Create(Application);
     480{$ELSE}
    429481  ColorDialog := TColorDialog.Create(Application);
     482{$ENDIF}
    430483  try
    431484    GetCustomColors;
    432     ColorDialog.Color := WinColor(GetOrdValue);
     485    ColorDialog.Color := GetOrdValue;
    433486    ColorDialog.HelpContext := 25010;
     487{$IFNDEF COMPILER2010_UP}
    434488    ColorDialog.Options := [cdShowHelp];
     489{$ENDIF}
    435490    if ColorDialog.Execute then
    436       SetOrdValue(Cardinal(Color32(ColorDialog.Color)));
     491      SetOrdValue(Cardinal(ColorDialog.Color));
    437492    SaveCustomColors;
    438493  finally
     
    446501begin
    447502  Result := [paMultiSelect, {$IFDEF EXT_PROP_EDIT}paDialog,{$ENDIF} paValueList,
    448   paRevertable];
     503    paRevertable];
    449504end;
    450505
Note: See TracChangeset for help on using the changeset viewer.