cxpropertiesconverters.pas

来自「胜天进销存源码,国产优秀的进销存」· PAS 代码 · 共 923 行 · 第 1/3 页

PAS
923
字号
  else if AKind = 'bkOle' then
    Result := bekOle
  else if AKind = 'bkPict' then
    Result := bekPict
  else
    Result := bekAuto;
end;

function TcxBlobEditPropertiesConverter.ConvertBlobPaintStyle(
  const AStyle: string): TcxBlobPaintStyle;
begin
  if AStyle = 'bpsDefault' then
    Result := bpsDefault
  else if AStyle = 'bpsIcon' then
    Result := bpsIcon
  else if AStyle = 'bpsText' then
    Result := bpsText
  else
    Result := bpsDefault;
end;

function TcxBlobEditPropertiesConverter.GetDestination: TcxBlobEditProperties;
begin
  Result := inherited Destination as TcxBlobEditProperties;
end;

{ TcxButtonEditPropertiesConverter }

procedure TcxButtonEditPropertiesConverter.DoImport;
var
  AButtons: TObject;
  AButton: TcxEditButton;
  I: Integer;
begin
  with TcxButtonEditPropertiesAccess(Destination) do
    HideCursor := GetBooleanProperty(Source, 'HideEditCursor', HideCursor);
  with Destination do
  begin
    CharCase := ConvertCharCase(GetEnumProperty(Source, 'CharCase'));
    Alignment.Horz := ConvertAlignment(GetEnumProperty(Source, 'Alignment'));
    ClickKey := GetIntegerProperty(Source, 'ClickKey', ClickKey);
    AButtons := GetClassProperty(Source, 'Buttons');
    if AButtons <> nil then
    begin
      if AButtons is TCollection then
      with TCollection(AButtons) do
      begin
        Buttons.Clear;
        for I := 0 to Count - 1 do
        begin
          AButton := Buttons.Add;
          AButton.Default := GetBooleanProperty(Items[I], 'Default', AButton.Default);
          AButton.Glyph.Assign(GetClassProperty(Items[I], 'Glyph') as TBitmap);
          AButton.Kind := ConvertButtonKind(GetEnumProperty(Items[I], 'Kind'));
          AButton.LeftAlignment := GetBooleanProperty(Items[I], 'LeftAlignment', AButton.LeftAlignment);
          AButton.Visible := GetBooleanProperty(Items[I], 'Visible', AButton.Visible);
          AButton.Width := GetIntegerProperty(Items[I], 'Width', AButton.Width);
        end;
      end;
    end;
  end;
  inherited DoImport;
end;

function TcxButtonEditPropertiesConverter.ConvertButtonKind(const AButtonKind: string): TcxEditButtonKind;
begin
  if AButtonKind = 'bkDown' then
    Result := bkDown
  else if AButtonKind = 'bkEllipsis' then
    Result := bkEllipsis
  else if AButtonKind = 'bkGlyph' then
    Result := bkGlyph
  else
    Result := bkDown;
end;

function TcxButtonEditPropertiesConverter.GetDestination: TcxButtonEditProperties;
begin
  Result := inherited Destination as TcxButtonEditProperties;
end;

{ TcxCalcEditPropertiesConverter }

procedure TcxCalcEditPropertiesConverter.DoImport;
begin
  with Destination do
  begin
    Alignment.Horz := ConvertAlignment(GetEnumProperty(Source, 'Alignment'));
    Alignment.Vert := ConvertVertAlignment(GetEnumProperty(Source, 'VertAlignment'));
    BeepOnError := GetBooleanProperty(Source, 'BeepOnError', BeepOnError);
    ButtonGlyph.Assign(GetClassProperty(Source, 'ButtonGlyph') as TBitmap);
    Precision := GetIntegerProperty(Source, 'Precision', Precision);
    QuickClose := GetBooleanProperty(Source, 'QuickClose', QuickClose);
    ReadOnly := GetBooleanProperty(Source, 'ReadOnly', ReadOnly);
  end;
  inherited DoImport;
end;

function TcxCalcEditPropertiesConverter.GetDestination: TcxCalcEditProperties;
begin
  Result := inherited Destination as TcxCalcEditProperties;
end;

{ TcxCheckBoxPropertiesConverter }

procedure TcxCheckBoxPropertiesConverter.DoImport;
begin
  with Destination do
  begin
    Alignment := ConvertAlignment(GetEnumProperty(Source, 'Alignment'));
    AllowGrayed := GetBooleanProperty(Source, 'AllowGrayed', AllowGrayed);
    Glyph.Assign(GetClassProperty(Source, 'Glyph') as TBitmap);
    GlyphCount := GetIntegerProperty(Source, 'GlyphCount', GlyphCount);
    ReadOnly := GetBooleanProperty(Source, 'ReadOnly', ReadOnly);
    ValueChecked := GetStringProperty(Source, 'ValueChecked', '');
    ValueGrayed := GetStringProperty(Source, 'ValueGrayed', '');
    ValueUnchecked := GetStringProperty(Source, 'ValueUnchecked', '');
    DisplayChecked := GetStringProperty(Source, 'DisplayChecked', DisplayChecked);
    DisplayGrayed := GetStringProperty(Source, 'DisplayNull', DisplayGrayed);
    DisplayUnchecked := GetStringProperty(Source, 'DisplayUnchecked', DisplayUnchecked);
    NullStyle := ConvertNullFieldStyle(GetEnumProperty(Source, 'ShowNullFieldStyle'));
  end;
  inherited DoImport;
end;

function TcxCheckBoxPropertiesConverter.ConvertNullFieldStyle(const AValue: string): TcxCheckBoxNullValueShowingStyle;
begin
  if AValue = 'nsGrayedChecked' then
    Result := nssGrayedChecked
  else if AValue = 'nsInactive' then
    Result := nssInactive
  else if AValue = 'nsUnchecked' then
    Result := nssUnchecked
  else
    Result := nssUnchecked;
end;

function TcxCheckBoxPropertiesConverter.GetDestination: TcxCheckBoxProperties;
begin
  Result := inherited Destination as TcxCheckBoxProperties;
end;

{ TcxComboBoxPropertiesConverter }

procedure TcxComboBoxPropertiesConverter.DoImport;
var
  AObject: TObject;
  I: Integer;
begin
  with Destination do
  begin
    Alignment.Horz := ConvertAlignment(GetEnumProperty(Source, 'Alignment'));
    Alignment.Vert := ConvertVertAlignment(GetEnumProperty(Source, 'VertAlignment'));
    ButtonGlyph.Assign(GetClassProperty(Source, 'ButtonGlyph') as TBitmap);
    CharCase := ConvertCharCase(GetEnumProperty(Source, 'CharCase'));
    DropDownRows := GetIntegerProperty(Source, 'DropDownRows', DropDownRows);
    ImmediateDropDown := GetBooleanProperty(Source, 'ImmediateDropDown', ImmediateDropDown);
    AObject := GetClassProperty(Source, 'Items');
    if AObject <> nil then
      if AObject is TStrings then
        for I := 0 to TStrings(AObject).Count - 1 do
          Items.Add(TStrings(AObject)[I]);
    MaxLength := GetIntegerProperty(Source, 'MaxLength', MaxLength);
    OEMConvert := GetBooleanProperty(Source, 'OEMConvert', OEMConvert);
    PopupAlignment := ConvertAlignment(GetEnumProperty(Source, 'PopupAlignment'));
    ReadOnly := GetBooleanProperty(Source, 'ReadOnly', ReadOnly);
    Revertable := GetBooleanProperty(Source, 'Revertable', Revertable);
    if GetBooleanProperty(Source, 'DropDownListStyle', False) then
      DropDownListStyle := lsEditFixedList
    else
      DropDownListStyle := lsEditList;
  end;
  inherited DoImport;
end;

function TcxComboBoxPropertiesConverter.GetDestination: TcxComboBoxProperties;
begin
  Result := inherited Destination as TcxComboBoxProperties;
end;

{ TcxCurrencyEditPropertiesConverter }

procedure TcxCurrencyEditPropertiesConverter.DoImport;
begin
  with Destination do
  begin
    Alignment.Horz := ConvertAlignment(GetEnumProperty(Source, 'Alignment'));
    Alignment.Vert := ConvertVertAlignment(GetEnumProperty(Source, 'VertAlignment'));
    ReadOnly := GetBooleanProperty(Source, 'ReadOnly', ReadOnly);
    DecimalPlaces := GetIntegerProperty(Source, 'DecimalPlaces', DecimalPlaces);
    DisplayFormat := GetStringProperty(Source, 'DisplayFormat', DisplayFormat);
    MaxValue := GetFloatProperty(Source, 'MaxValue', MaxValue);
    MinValue := GetFloatProperty(Source, 'MinValue', MinValue);
    Nullable := GetBooleanProperty(Source, 'Nullable', Nullable);
    NullString := GetStringProperty(Source, 'NullString', NullString);
    UseThousandSeparator := GetBooleanProperty(Source, 'UseThousandSeparator', UseThousandSeparator);
  end;
  inherited DoImport;
end;

function TcxCurrencyEditPropertiesConverter.GetDestination: TcxCurrencyEditProperties;
begin
  Result := inherited Destination as TcxCurrencyEditProperties;
end;

{ TcxDateEditPropertiesConverter }

procedure TcxDateEditPropertiesConverter.DoImport;
var
  ADateButtons: TStringList;
  AcxDateButtons: TDateButtons;
  I: Integer;
  ADateOnError: string;
begin
  with Destination do
  begin
    Alignment.Horz := ConvertAlignment(GetEnumProperty(Source, 'Alignment'));
    Alignment.Vert := ConvertVertAlignment(GetEnumProperty(Source, 'VertAlignment'));
    ButtonGlyph.Assign(GetClassProperty(Source, 'ButtonGlyph') as TBitmap);
    ADateButtons := TStringList.Create;
    try
      GetSetProperty(Source, 'DateButtons', ADateButtons);
      ADateButtons.Sort;
      AcxDateButtons := [];
      if ADateButtons.Find('btnToday', I) then
        Include(AcxDateButtons, btnToday);
      if ADateButtons.Find('btnClear', I) then
        Include(AcxDateButtons, btnClear);
      DateButtons := AcxDateButtons;
    finally
      ADateButtons.Free;
    end;
    if GetBooleanProperty(Source, 'DateValidation') then
      DateOnError := deNoChange
    else
    begin
      ADateOnError := GetEnumProperty(Source, 'DateOnError');
      if ADateOnError = 'deToday'then
        DateOnError := deToday
      else if ADateOnError = 'deNull' then
        DateOnError := deNull;
    end;
    SaveTime := GetBooleanProperty(Source, 'SaveTime', SaveTime);
    if GetBooleanProperty(Source, 'UseEditMask', False) then
      InputKind := ikMask
    else
      InputKind := ikRegExpr;
  end;
  inherited DoImport;
end;

function TcxDateEditPropertiesConverter.GetDestination: TcxDateEditProperties;
begin
  Result := inherited Destination as TcxDateEditProperties;
end;

{ TcxHyperLinkEditPropertiesConverter }

procedure TcxHyperLinkEditPropertiesConverter.DoImport;
begin
  with Destination do
  begin
    Alignment.Horz := ConvertAlignment(GetEnumProperty(Source, 'Alignment'));
    Alignment.Vert := ConvertVertAlignment(GetEnumProperty(Source, 'VertAlignment'));
    ReadOnly := GetBooleanProperty(Source, 'ReadOnly', ReadOnly);
    SingleClick := GetBooleanProperty(Source, 'SingleClick', SingleClick);
    StartKey := GetIntegerProperty(Source, 'StartKey', StartKey);
  end;
  inherited DoImport;
end;

function TcxHyperLinkEditPropertiesConverter.GetDestination: TcxHyperLinkEditProperties;
begin
  Result := inherited Destination as TcxHyperLinkEditProperties;
end;

{ TcxImagePropertiesConverter }

procedure TcxImagePropertiesConverter.DoImport;
var
  AObject: TObject;
  AGlyph: TObject;
  AButtons: TStringList;
  AMenuItems: TcxPopupMenuItems;
  I: Integer;
begin
  with Destination do
  begin
    Center := GetBooleanProperty(Source, 'Center', Center);
    CustomFilter := GetStringProperty(Source, 'CustomFilter', CustomFilter);
    GraphicTransparency := ConvertPictureTransparency(
      GetEnumProperty(Source, 'GraphicTransparency'));
    ReadOnly := GetBooleanProperty(Source, 'ReadOnly', ReadOnly);
    Stretch := GetBooleanProperty(Source, 'Stretch', Stretch);
    AObject := GetClassProperty(Source, 'PopupToolBar');
    if AObject <> nil then
    begin
      PopupMenuLayout.CustomMenuItemCaption := GetStringProperty(AObject,
        'CustomButtonCaption', PopupMenuLayout.CustomMenuItemCaption);
      AGlyph := GetClassProperty(AObject, 'CustomButtonGlyph');
      PopupMenuLayout.CustomMenuItemGlyph.Assign(AGlyph as TBitmap);
      AButtons := TStringList.Create;
      try
        GetSetProperty(AObject, 'Buttons', AButtons);
        AButtons.Sort;
        AMenuItems := [];
        if AButtons.Find('ptbCut', I) then
          Include(AMenuItems, pmiCut);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?