⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 suidsgn.pas

📁 SUIPack是一款为Delphi和C++Builder开发的所见即所得的界面增强VCL组件
💻 PAS
📖 第 1 页 / 共 3 页
字号:
                UnConvertControls(Ctrl, TTabControl, IncHeight, Dsgn)
            else if Ctrl.ClassNameIs('TsuiTabSheet') then
                UnConvertControls(Ctrl, TTabSheet, IncHeight, Dsgn)
            else if Ctrl.ClassNameIs('TsuiPageControl') then
                UnConvertControls(Ctrl, TPageControl, IncHeight, Dsgn)
            else if Ctrl.ClassNameIs('TsuiTrackBar') then
                UnConvertControls(Ctrl, TTrackBar, IncHeight, Dsgn)
            else if Ctrl.ClassNameIs('TsuiScrollBar') then
                UnConvertControls(Ctrl, TScrollBar, IncHeight, Dsgn)
            else if Ctrl.ClassNameIs('TsuiStringGrid') then
                UnConvertControls(Ctrl, TStringGrid, IncHeight, Dsgn)
            else if Ctrl.ClassNameIs('TsuiDrawGrid') then
                UnConvertControls(Ctrl, TDrawGrid, IncHeight, Dsgn)
            else if Ctrl.ClassNameIs('TsuiStatusBar') then
                UnConvertControls(Ctrl, TStatusBar, IncHeight, Dsgn)
            else if Ctrl.ClassNameIs('TsuiMaskEdit') then
                UnConvertControls(Ctrl, TMaskEdit, IncHeight, Dsgn)
            else if Ctrl.ClassNameIs('TsuiDriveComboBox') then
                UnConvertControls(Ctrl, TDriveComboBox, IncHeight, Dsgn)
{$IFDEF DB}
            else if Ctrl.ClassNameIs('TsuiDBEdit') then
                UnConvertControls(Ctrl, TDBEdit, IncHeight, Dsgn)
            else if Ctrl.ClassNameIs('TsuiDBMemo') then
                UnConvertControls(Ctrl, TDBMemo, IncHeight, Dsgn)
            else if Ctrl.ClassNameIs('TsuiDBImage') then
                UnConvertControls(Ctrl, TDBIMage, IncHeight, Dsgn)
            else if Ctrl.ClassNameIs('TsuiDBListBox') then
                UnConvertControls(Ctrl, TDBListBox, IncHeight, Dsgn)
            else if Ctrl.ClassNameIs('TsuiDBComboBox') then
                UnConvertControls(Ctrl, TDBComboBox, IncHeight, Dsgn)
            else if Ctrl.ClassNameIs('TsuiDBCheckBox') then
                UnConvertControls(Ctrl, TDBCheckBox, IncHeight, Dsgn)
            else if Ctrl.ClassNameIs('TsuiDBRadioGroup') then
                UnConvertControls(Ctrl, TDBRadioGroup, IncHeight, Dsgn)
            else if Ctrl.ClassNameIs('TsuiDBNavigator') then
                UnConvertControls(Ctrl, TDBNavigator, IncHeight, Dsgn)
            else if Ctrl.ClassNameIs('TsuiDBLookupListBox') then
                UnConvertControls(Ctrl, TDBLookupListBox, IncHeight, Dsgn)
            else if Ctrl.ClassNameIs('TsuiDBLookupComboBox') then
                UnConvertControls(Ctrl, TDBLookupComboBox, IncHeight, Dsgn)
            else if Ctrl.ClassNameIs('TsuiDBGrid') then
                UnConvertControls(Ctrl, TDBGrid, IncHeight, Dsgn)
{$ENDIF}
            else
            begin
                if IsHasProperty(Ctrl, 'Top') then
                    SetOrdProp(Ctrl, 'Top', GetOrdProp(Ctrl, 'Top') - IncHeight);
            end;

            if IsHasProperty(Ctrl, 'DataSource') then
                SetObjectProp(Ctrl, 'DataSource', aDB);
            if IsHasProperty(Ctrl, 'DataField') then
                SetPropValue(Ctrl, 'DataField', aFld);
        end
    end;

    if suiForm <> nil then
        RemoveOldControl(suiForm);

    RemoveOldControl(nil, true);
end;

{ TsuiPageControlEditor }

procedure TsuiPageControlEditor.Edit;
begin

end;

procedure TsuiPageControlEditor.ExecuteVerb(Index: Integer);
begin
    case Index of
    0 : PageControl_InsertPage(Component);
    1 : PageControl_RemovePage(Component);
    end;

    Designer.Modified();
end;

function TsuiPageControlEditor.GetVerb(Index: Integer): String;
begin
    case Index of
    0 : Result := 'New Page';
    1 : Result := 'Delete Page';
    end;
end;

function TsuiPageControlEditor.GetVerbCount: Integer;
begin
    Result := 2;
end;

procedure TsuiPageControlEditor.PrepareItem(Index: Integer;
{$IFDEF SUIPACK_D5}
    const AItem: TMenuItem);
{$ENDIF}
{$IFDEF SUIPACK_D6UP}
    const AItem: IMenuItem);
{$ENDIF}
begin
    inherited;
    if Index = 1 then
        AItem.Enabled := PageControl_CanRemove(Component);
end;

{ TsuiUnConvertor }

constructor TsuiUnConvertor.Create(AOwner: TComponent);
begin
    inherited;

    if not (AOwner is TCustomForm) then
        Exit;

    if Win32Platform = VER_PLATFORM_WIN32_WINDOWS then
    begin
        MessageDlg('Sorry, can''t convert under Windows 98.', mtError, [mbOK], 0);
        SysUtils.Abort;
        Exit;
    end;

    if MessageDlg('Are you sure to convert all controls to the standard VCL?', mtConfirmation, [mbYes, mbNo], 0) = mrYes then
        ConvertToVCL(TCustomForm(AOwner));

    SysUtils.Abort;
end;

{ TsuiFileThemeEditor }

procedure TsuiFileThemeEditor.Edit;
begin
    if Component is TsuiFileTheme then
    begin
        FileThemeEdit(Component as TsuiFileTheme);
        Designer.Modified();
    end;
end;

procedure TsuiFileThemeEditor.ExecuteVerb(Index: Integer);
begin
    case Index of
    0 : Edit;
    end;
end;

function TsuiFileThemeEditor.GetVerb(Index: Integer): String;
begin
    case Index of
    0 : Result := 'Load a theme file...';
    end;
end;

function TsuiFileThemeEditor.GetVerbCount: Integer;
begin
    Result := 1;
end;

{ TsuiThemeMgrCompListEditor }

procedure TsuiThemeMgrCompListEditor.Edit;
begin
    ThemeManagerEdit(GetComponent(0) as TsuiThemeManager);
    Designer.Modified();
end;

function TsuiThemeMgrCompListEditor.GetAttributes: TPropertyAttributes;
begin
    Result := [paDialog, paReadOnly{$IFDEF SMLPACK_D6UP}, paVCL{$ENDIF}];
end;

function TsuiThemeMgrCompListEditor.GetValue: string;
begin
    Result := 'Component List';
end;

{ TsuiTabSheetEditor }

procedure TsuiTabSheetEditor.Edit;
begin

end;

procedure TsuiTabSheetEditor.ExecuteVerb(Index: Integer);
begin
    case Index of
    0 : TabSheet_InsertPage(Component);
    1 : TabSheet_RemovePage(Component);
    end;

    Designer.Modified();
end;

function TsuiTabSheetEditor.GetVerb(Index: Integer): String;
begin
    case Index of
    0 : Result := 'New Page';
    1 : Result := 'Delete Page';
    end;
end;

function TsuiTabSheetEditor.GetVerbCount: Integer;
begin
    Result := 2;
end;

procedure TsuiTabSheetEditor.PrepareItem(Index: Integer;
{$IFDEF SUIPACK_D5}
    const AItem: TMenuItem);
{$ENDIF}
{$IFDEF SUIPACK_D6UP}
    const AItem: IMenuItem);
{$ENDIF}
begin
    inherited;
    if Index = 1 then
        AItem.Enabled := TabSheet_CanRemove(Component);
end;

{ TsuiDialogEditor }

procedure TsuiDialogEditor.Edit;
begin
    if Component is TsuiDialog then
        (Component as TsuiDialog).ShowModal();
end;

{ TsuiThemeManagerEditor }

procedure TsuiThemeManagerEditor.Edit;
begin
    if Component is TsuiThemeManager then
    begin
        ThemeManagerEdit(Component as TsuiThemeManager);
        Designer.Modified();
    end;
end;

procedure TsuiThemeManagerEditor.ExecuteVerb(Index: Integer);
begin
    case Index of
    0 : Edit;
    end;
end;

function TsuiThemeManagerEditor.GetVerb(Index: Integer): String;
begin
    case Index of
    0 : Result := 'Edit list...';
    end;
end;

function TsuiThemeManagerEditor.GetVerbCount: Integer;
begin
    Result := 1;
end;

{ TsuiConvertor }

constructor TsuiConvertor.Create(AOwner: TComponent);
var
    Form : TCustomForm;
    i : Integer;
begin
    inherited;

    if not (AOwner is TCustomForm) then
        Exit;

    if Win32Platform = VER_PLATFORM_WIN32_WINDOWS then
    begin
        MessageDlg('Sorry, can''t convert under Windows 98.', mtError, [mbOK], 0);
        SysUtils.Abort;
        Exit;
    end;

    Form := AOwner as TCustomForm;
    for i := 0 to Form.ControlCount - 1 do
    begin
        if Form.Controls[i] is TsuiForm then
        begin
            MessageDlg('Sorry, you have a TsuiForm already. Converting canceled.', mtError, [mbOK], 0);
            SysUtils.Abort;
            Exit;
        end;
    end;

    frmConv := TfrmConv.Create(nil);
    frmConv.cb_theme.ItemIndex := 0;
    if frmConv.ShowModal() = mrOK then
        ConvertToSUIPack(TCustomForm(AOwner), frmConv.cb_theme.Text, TsuiUIStyle(frmConv.cb_theme.ItemIndex + 1));
    frmConv.Free();
    SysUtils.Abort;
end;

{ TsuiThemeFileEditor }

procedure TsuiThemeFileEditor.Edit;
var
    OpenDialog: TOpenDialog;
begin
    OpenDialog := TOpenDialog.Create(Application);
    OpenDialog.Filter := 'Sunisoft Skin File(*.ssk)|*.ssk';
    if OpenDialog.Execute() then
    begin
        TsuiFileTheme(GetComponent(0)).ThemeFile := OpenDialog.FileName;
        Modified();
    end;
    OpenDialog.Free();
end;

function TsuiThemeFileEditor.GetAttributes: TPropertyAttributes;
begin
    Result := [paDialog];
end;

function TsuiThemeFileEditor.GetValue: string;
begin
    Result := TsuiFileTheme(GetComponent(0)).ThemeFile;
end;

{ TsuiBuiltInThemeFileEditor }

procedure TsuiBuiltInThemeFileEditor.Edit;
var
    OpenDialog: TOpenDialog;
begin
    OpenDialog := TOpenDialog.Create(Application);
    OpenDialog.Filter := 'Sunisoft Skin File(*.ssk)|*.ssk';
    if OpenDialog.Execute() then
    begin
        TsuiBuiltInFileTheme(GetComponent(0)).ThemeFile := OpenDialog.FileName;
        Modified();
    end;
    OpenDialog.Free();
end;

function TsuiBuiltInThemeFileEditor.GetAttributes: TPropertyAttributes;
begin
    Result := [paDialog, paReadOnly];
end;

function TsuiBuiltInThemeFileEditor.GetValue: string;
begin
    Result := TsuiBuiltInFileTheme(GetComponent(0)).ThemeFile;
end;

{ TsuiBuiltInFileThemeEditor }

procedure TsuiBuiltInFileThemeEditor.Edit;
begin
    if Component is TsuiFileTheme then
    begin
        BuiltInFileThemeEdit(Component as TsuiBuiltInFileTheme);
        Designer.Modified();
    end;
end;

end.

⌨️ 快捷键说明

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