📄 rxctlreg.pas
字号:
GetComponentProperties(Components, tkAny, Designer, CheckEdit);
finally
//Components.Free;
end;
end;
procedure TAnimatedEditor.LoadAniFile(Image: TAnimatedImage);
var
Dialog: TOpenDialog;
AniCursor: TAnimatedCursorImage;
CurDir: string;
begin
CurDir := GetCurrentDir;
Dialog := TOpenDialog.Create(Application);
try
with Dialog do begin
Options := [ofHideReadOnly, ofFileMustExist];
DefaultExt := 'ani';
Filter := LoadStr(srAniCurFilter);
if Execute then begin
AniCursor := TAnimatedCursorImage.Create;
try
AniCursor.LoadFromFile(FileName);
AniCursor.AssignToBitmap(Image.Glyph, clFuchsia, True,
Image.Orientation = goVertical);
Image.Interval := AniCursor.DefaultRate;
Image.TransparentColor := clFuchsia;
Designer.Modified;
finally
AniCursor.Free;
end;
end;
end;
finally
Dialog.Free;
SetCurrentDir(CurDir);
end;
end;
procedure TAnimatedEditor.ExecuteVerb(Index: Integer);
begin
if (Index = GetVerbCount - 1) then
LoadAniFile(TAnimatedImage(Component))
else if (Index = GetVerbCount - 2) then
EditImage(TAnimatedImage(Component))
else inherited ExecuteVerb(Index);
end;
function TAnimatedEditor.GetVerb(Index: Integer): string;
begin
if (Index = GetVerbCount - 1) then Result := LoadStr(srLoadAniCursor)
else if (Index = GetVerbCount - 2) then Result := LoadStr(srEditPicture)
else Result := inherited GetVerb(Index);
end;
function TAnimatedEditor.GetVerbCount: Integer;
begin
Result := inherited GetVerbCount + 2;
end;
{$IFDEF DCS}
{$IFDEF WIN32}
type
TRxImageListEditor = class(TComponentEditor)
private
procedure SaveAsBitmap(ImageList: TImageList);
public
procedure ExecuteVerb(Index: Integer); override;
function GetVerb(Index: Integer): string; override;
function GetVerbCount: Integer; override;
end;
procedure TRxImageListEditor.SaveAsBitmap(ImageList: TImageList);
var
Bitmap: TBitmap;
SaveDlg: TOpenDialog;
I: Integer;
begin
if ImageList.Count > 0 then begin
{$IFDEF RX_D3}
SaveDlg := TSavePictureDialog.Create(Application);
{$ELSE}
SaveDlg := TSaveDialog.Create(Application);
{$ENDIF}
with SaveDlg do
try
Options := [ofHideReadOnly, ofOverwritePrompt];
DefaultExt := GraphicExtension(TBitmap);
Filter := GraphicFilter(TBitmap);
if Execute then begin
Bitmap := TBitmap.Create;
try
with Bitmap do begin
Width := ImageList.Width * ImageList.Count;
Height := ImageList.Height;
if ImageList.BkColor <> clNone then
Canvas.Brush.Color := ImageList.BkColor
else Canvas.Brush.Color := clWindow;
Canvas.FillRect(Bounds(0, 0, Width, Height));
for I := 0 to ImageList.Count - 1 do
ImageList.Draw(Canvas, ImageList.Width * I, 0, I);
{$IFDEF RX_D3}
HandleType := bmDIB;
if PixelFormat in [pf15bit, pf16bit] then try
PixelFormat := pf24bit;
except {} end;
{$ENDIF}
end;
Bitmap.SaveToFile(FileName);
finally
Bitmap.Free;
end;
end;
finally
Free;
end;
end
else Beep;
end;
procedure TRxImageListEditor.ExecuteVerb(Index: Integer);
begin
if Designer <> nil then
case Index of
0: if EditImageList(Component as TImageList) then Designer.Modified;
1: SaveAsBitmap(TImageList(Component));
end;
end;
function TRxImageListEditor.GetVerb(Index: Integer): string;
begin
case Index of
{$IFDEF RX_D3}
0: Result := SImageListEditor;
{$ELSE}
0: Result := LoadStr(SImageEditor);
{$ENDIF}
1: Result := LoadStr(srSaveImageList);
else Result := '';
end;
end;
function TRxImageListEditor.GetVerbCount: Integer;
begin
Result := 2;
end;
{$ENDIF WIN32}
{$ENDIF DCS}
{ TWeekDayProperty }
type
TWeekDayProperty = class(TEnumProperty)
function GetAttributes: TPropertyAttributes; override;
end;
function TWeekDayProperty.GetAttributes: TPropertyAttributes;
begin
Result := [paMultiSelect, paValueList];
end;
{$IFDEF RX_D3}
resourcestring
srSamples = 'Samples';
{$ENDIF}
procedure Register;
const
{$IFDEF RX_D3}
BaseClass: TClass = TPersistent;
{$ELSE}
BaseClass: TClass = TComponent;
{$ENDIF}
begin
RegisterComponents(LoadStr(srRXControls), [TComboEdit, TFilenameEdit,
TDirectoryEdit, TDateEdit, TRxCalcEdit, TCurrencyEdit, TTextListBox,
TRxCheckListBox, TFontComboBox, TColorComboBox, TRxSplitter, TRxSlider,
TRxLabel, {$IFDEF WIN32} TRxRichEdit, {$ENDIF}
TRxClock, TAnimatedImage, TRxDrawGrid, TRxSpeedButton,
{$IFDEF USE_RX_GIF} TRxGIFAnimator, {$ENDIF} TRxSpinButton, TRxSpinEdit,
TRxSwitch, TRxDice]);
{$IFDEF CBUILDER}
{$IFNDEF RX_V110} { C++Builder 1.0 }
RegisterComponents(ResStr(srAdditional), [TScroller]);
{$ELSE}
RegisterComponents(ResStr(srSamples), [TScroller]);
{$ENDIF}
{$ELSE}
RegisterComponents(ResStr(srSamples), [TScroller]);
{$ENDIF}
{$IFDEF RX_D3}
RegisterNonActiveX([TCustomComboEdit, TCustomDateEdit, TCustomNumEdit,
TFileDirEdit, TRxCustomListBox, TRxRichEdit], axrComponentOnly);
RegisterNonActiveX([TScroller], axrComponentOnly);
{$ENDIF RX_D3}
RegisterPropertyEditor(TypeInfo(TDayOfWeekName), nil, '', TWeekDayProperty);
{$IFDEF RX_D3}
RegisterPropertyEditor(TypeInfo(string), TCustomNumEdit, 'Text', nil);
{$ELSE}
RegisterPropertyEditor(TypeInfo(string), TCustomNumEdit, 'Text', TStringProperty);
{$ENDIF}
RegisterPropertyEditor(TypeInfo(string), TFileDirEdit, 'Text', TStringProperty);
RegisterPropertyEditor(TypeInfo(string), TCustomDateEdit, 'Text', TStringProperty);
RegisterPropertyEditor(TypeInfo(string), TFileNameEdit, 'Filter', TFilterProperty);
RegisterPropertyEditor(TypeInfo(string), TFileNameEdit, 'FileName', TFilenameProperty);
RegisterPropertyEditor(TypeInfo(string), TDirectoryEdit, 'Text', TDirnameProperty);
RegisterPropertyEditor(TypeInfo(string), BaseClass, 'FolderName', TDirnameProperty);
RegisterPropertyEditor(TypeInfo(string), BaseClass, 'DirectoryName', TDirnameProperty);
RegisterPropertyEditor(TypeInfo(string), BaseClass, 'Hint', THintProperty);
RegisterPropertyEditor(TypeInfo(string), TMenuItem, 'Hint', TStringProperty);
RegisterPropertyEditor(TypeInfo(string), TCustomComboEdit, 'ButtonHint', THintProperty);
RegisterPropertyEditor(TypeInfo(TStrings), TRxCheckListBox, 'Items', TCheckItemsProperty);
RegisterPropertyEditor(TypeInfo(TControl), BaseClass, 'Gauge', TProgressControlProperty);
RegisterPropertyEditor(TypeInfo(TControl), BaseClass, 'ProgressBar', TProgressControlProperty);
{$IFDEF RX_D3}
RegisterPropertyEditor(TypeInfo(Boolean), TFontComboBox, 'TrueTypeOnly', nil);
RegisterPropertyEditor(TypeInfo(TCursor), TRxSplitter, 'Cursor', nil);
{$ELSE}
RegisterPropertyEditor(TypeInfo(TDateTime), TPersistent, '', TDateProperty);
RegisterPropertyEditor(TypeInfo(TModalResult), TPersistent, '', TRxModalResultProperty);
{$ENDIF}
RegisterPropertyEditor(TypeInfo(TCaption), TLabel, 'Caption', THintProperty);
RegisterPropertyEditor(TypeInfo(TCaption), TRxLabel, 'Caption', THintProperty);
RegisterPropertyEditor(TypeInfo(TCaption), TRxSpeedButton, 'Caption', THintProperty);
RegisterPropertyEditor(TypeInfo(Integer), BaseClass, '', TRxIntegerProperty);
RegisterPropertyEditor(TypeInfo(ShortInt), BaseClass, '', TRxIntegerProperty);
RegisterPropertyEditor(TypeInfo(SmallInt), BaseClass, '', TRxIntegerProperty);
RegisterPropertyEditor(TypeInfo(Longint), BaseClass, '', TRxIntegerProperty);
RegisterPropertyEditor(TypeInfo(Word), BaseClass, '', TRxIntegerProperty);
RegisterPropertyEditor(TypeInfo(Byte), BaseClass, '', TRxIntegerProperty);
RegisterPropertyEditor(TypeInfo(Cardinal), BaseClass, '', TRxIntegerProperty);
RegisterPropertyEditor(TypeInfo(Single), BaseClass, '', TRxFloatProperty);
RegisterPropertyEditor(TypeInfo(Double), BaseClass, '', TRxFloatProperty);
RegisterPropertyEditor(TypeInfo(Extended), BaseClass, '', TRxFloatProperty);
{$IFDEF WIN32}
RegisterPropertyEditor(TypeInfo(Currency), BaseClass, '', TRxFloatProperty);
{$ENDIF}
RegisterComponentEditor(TPaintBox, TPaintBoxEditor);
RegisterComponentEditor(TAnimatedImage, TAnimatedEditor);
{$IFDEF WIN32}
{$IFDEF DCS}
RegisterComponentEditor(TCustomImageList, TRxImageListEditor);
RegisterComponentEditor(TImageList, TRxImageListEditor);
{$ENDIF}
{$ENDIF}
RegisterRxColors;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -