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

📄 bsmessages.pas

📁 布林电话收费管理系统
💻 PAS
📖 第 1 页 / 共 4 页
字号:
    DefaultFont := DefaultButtonFont;
    UseSkinFont := Self.UseSkinFont;
    Caption := '取消';
    ModalResult := mrCancel;
    Cancel := True;
    SetBounds(LeftOffset + MulDiv(92, DialogUnits.X, 4), PasswordEdit.Top + PasswordEdit.Height + 15,
              ButtonWidth, ButtonHeight);
    DefaultHeight := ButtonHeight;
    SkinDataName := FButtonSkinDataName;
    SkinData := CtrlSkinData;
    Form.ClientHeight := Top + Height + 13;
    Image.Top := Form.ClientHeight div 2 - Image.Height div 2; 
  end;

  if Form.ShowModal = mrOk
  then
    begin
      if FLoginMode then FLogin := LoginEdit.Text;
      FPassword := PasswordEdit.Text;
      Result := True;
    end
  else
    Result := False;

  finally
    Form.Free;
  end;
end;


constructor TbsSkinProgressDialog.Create;
begin
  inherited Create(AOwner);

  FAlphaBlend := False;
  FAlphaBlendAnimation := False;
  FAlphaBlendValue := 200;

  Form := nil;
  Gauge := nil;
  FExecute := False;

  FMinValue := 0;
  FMaxValue := 100;
  FValue := 0;

  FCaption := '进程';
  FLabelCaption := '进程名称:';
  FShowPercent := True;

  FButtonSkinDataName := 'button';
  FLabelSkinDataName := 'stdlabel';
  FGaugeSkinDataName := 'gauge';

  FDefaultLabelFont := TFont.Create;
  FDefaultButtonFont := TFont.Create;
  FDefaultGaugeFont := TFont.Create;

  FUseSkinFont := True;

  with FDefaultLabelFont do
  begin
    Name := '宋体';
    Style := [];
    Height := 12;
  end;

  with FDefaultButtonFont do
  begin
    Name := '宋体';
    Style := [];
    Height := 12;
  end;

  with FDefaultGaugeFont do
  begin
    Name := '宋体';
    Style := [];
    Height := 12;
  end;
end;

destructor TbsSkinProgressDialog.Destroy;
begin
  FDefaultLabelFont.Free;
  FDefaultButtonFont.Free;
  FDefaultGaugeFont.Free;
  inherited;
end;

procedure TbsSkinProgressDialog.SetValue(AValue: Integer);
begin
  FValue := AValue;
  if FExecute
  then
    begin
      Gauge.Value := FValue;
      if Gauge.Value = Gauge.MaxValue
      then Form.ModalResult := mrOk;
    end;  
end;

procedure TbsSkinProgressDialog.SetDefaultLabelFont;
begin
  FDefaultLabelFont.Assign(Value);
end;

procedure TbsSkinProgressDialog.SetDefaultGaugeFont;
begin
  FDefaultGaugeFont.Assign(Value);
end;

procedure TbsSkinProgressDialog.SetDefaultButtonFont;
begin
  FDefaultButtonFont.Assign(Value);
end;

procedure TbsSkinProgressDialog.Notification;
begin
  inherited Notification(AComponent, Operation);
  if (Operation = opRemove) and (AComponent = FSD) then FSD := nil;
  if (Operation = opRemove) and (AComponent = FCtrlFSD) then FCtrlFSD := nil;
end;

function TbsSkinProgressDialog.Execute;
var
  BSF: TbsBusinessSkinForm;
  Prompt: TbsSkinStdLabel;
  DialogUnits: TPoint;
  ButtonWidth, ButtonHeight: Integer;
begin
  Form := TForm.Create(Application);
  Form.BorderStyle := bsDialog;
  Form.Caption := FCaption;
  Form.Position := poScreenCenter;
  BSF := TbsBusinessSkinForm.Create(Form);
  BSF.BorderIcons := [];
  BSF.SkinData := SkinData;
  BSF.MenusSkinData := CtrlSkinData;
  BSF.AlphaBlend := AlphaBlend;
  BSF.AlphaBlendAnimation := AlphaBlendAnimation;
  BSF.AlphaBlendValue := AlphaBlendValue;

  try

  with Form do
  begin
    Canvas.Font := Font;
    DialogUnits := GetAveCharSize(Canvas);
    ClientWidth := MulDiv(180, DialogUnits.X, 4);
  end;

  Prompt := TbsSkinStdLabel.Create(Form);
  with Prompt do
  begin
    Parent := Form;
    Left := MulDiv(8, DialogUnits.X, 4);
    Top := MulDiv(8, DialogUnits.Y, 8);
    Constraints.MaxWidth := MulDiv(164, DialogUnits.X, 4);
    WordWrap := False;
    DefaultFont := DefaultLabelFont;
    UseSkinFont := Self.UseSkinFont;
    SkinDataName := FLabelSkinDataName;
    SkinData := CtrlSkinData;
    Caption := FLabelCaption;
  end;

  Gauge := TbsSkinGauge.Create(Form);
  with Gauge do
  begin
    Parent := Form;
    MinValue := FMinValue;
    MaxValue := FMaxValue;
    ShowPercent := FShowPercent;
    Value := FValue;
    DefaultFont := DefaultGaugeFont;
    UseSkinFont := Self.UseSkinFont;
    Left := Prompt.Left;
    Top := Prompt.Top + Prompt.Height + 5;
    DefaultWidth := MulDiv(164, DialogUnits.X, 4);
    SkinDataName := FGaugeSkinDataName;
    SkinData := CtrlSkinData;
  end;

  ButtonWidth := MulDiv(50, DialogUnits.X, 4);
  ButtonHeight := MulDiv(14, DialogUnits.Y, 8);

  with TbsSkinButton.Create(Form) do
  begin
    Parent := Form;
    DefaultFont := DefaultButtonFont;
    UseSkinFont := Self.UseSkinFont;
    Caption := '取消';
    ModalResult := mrCancel;
    Cancel := True;
    SetBounds(Gauge.Left + Gauge.Width - ButtonWidth, Gauge.Top + Gauge.Height + 15,
              ButtonWidth, ButtonHeight);
    DefaultHeight := ButtonHeight;
    SkinDataName := FButtonSkinDataName;
    SkinData := CtrlSkinData;
    Form.ClientHeight := Top + Height + 13;
  end;

  FExecute := True;

  if Form.ShowModal = mrOk then Result := True else Result := False;

  FExecute := False;

  finally
    Form.Free;
    Gauge := nil;
    Form := nil;
  end;
end;

constructor TbsFontDlgForm.Create(AOwner: TComponent);
begin
  inherited CreateNew(AOwner);
  KeyPreview := True;
  BorderStyle := bsDialog;
  Position := poScreenCenter;
  BSF := TbsBusinessSkinForm.Create(Self);

  FontColorLabel := TbsSkinStdLabel.Create(Self);
  with FontColorLabel do
  begin
    Left := 5;
    Top := 50;
    Caption := '颜色:';
    AutoSize := True;
    Parent := Self;
  end;

  FontColorBox := TbsSkinColorComboBox.Create(Self);
  with FontColorBox do
  begin
    Left := 5;
    Top := 65;
    Width := 200;
    DefaultHeight := 21;
    Parent := Self;
    ExStyle := [bscbCustomColor, bscbPrettyNames, bscbStandardColors];
    OnChange := FontColorChange;
  end;

  FontNameLabel := TbsSkinStdLabel.Create(Self);
  with FontNameLabel do
  begin
    Left := 5;
    Top := 5;
    Caption := '名称:';
    AutoSize := True;
    Parent := Self;
  end;

  FontNameBox := TbsSkinFontComboBox.Create(Self);
  with FontNameBox do
  begin
    Left := 5;
    Top := 20;
    Width := 200;
    DefaultHeight := 21;
    Parent := Self;
    PopulateList;
    TabOrder := 0;
    TabStop := True;
    OnChange := FontNameChange;
  end;

  FontSizeLabel := TbsSkinStdLabel.Create(Self);
  with FontSizeLabel do
  begin
    Left := 5;
    Top := 95;
    Caption := '大小:';
    AutoSize := True;
    Parent := Self;
  end;

  FontSizeEdit := TbsSkinSpinEdit.Create(Self);
  with  FontSizeEdit do
  begin
    MinValue := -100;
    MaxValue := 100;
    Left := 5;
    Top := 110;
    Parent := Self;
    Width := 95;
    OnChange := FontSizeChange;
  end;

  FontHeightLabel := TbsSkinStdLabel.Create(Self);
  with FontHeightLabel do
  begin
    Left := 110;
    Top := 95;
    Caption := '高度:';
    AutoSize := True;
    Parent := Self;
  end;

  FontHeightEdit := TbsSkinSpinEdit.Create(Self);
  with FontHeightEdit do
  begin
    MinValue := -500;
    MaxValue := 500;
    Left := 110;
    Top := 110;
    Width := 95;
    Parent := Self;
    OnChange := FontHeightChange;
  end;

  FontExLabel := TbsSkinStdLabel.Create(Self);
  with FontExLabel do
  begin
    Left := 210;
    Top := 50;
    Caption := '字体示例:';
    AutoSize := True;
    Parent := Self;
  end;

  FontExamplePanel := TbsSkinPanel.Create(Self);
  with FontExamplePanel do
  begin
    Parent := Self;
    BorderStyle := bvFrame;
    Left := 210;
    Top := 65;
    Width := 185;
    Height := 67;
  end;

  FontExampleLabel := TLabel.Create(Self);
  with FontExampleLabel do
  begin
    Parent := FontExamplePanel;
    Transparent := True;
    Align := alClient;
    Caption := 'AaBbYyZz';
  end;

  OkButton := TbsSkinButton.Create(Self);
  with OkButton do
  begin
    Caption := '确定';
    CanFocused := True;
    Left := 230;
    Top := 155;
    Width := 75;
    DefaultHeight := 25;
    Parent := Self;
    ModalResult := mrOk;
  end;

  CancelButton := TbsSkinButton.Create(Self);
  with CancelButton do
  begin
    Caption := '取消';
    CanFocused := True;
    Left := 320;
    Top := 155;
    Width := 75;
    DefaultHeight := 25;
    Parent := Self;
    ModalResult := mrCancel;
    Cancel := True;
  end;

  FontStyleLabel := TbsSkinStdLabel.Create(Self);
  with FontStyleLabel do
  begin
    Left := 210;
    Top := 5;
    Caption := '字型:';
    AutoSize := True;
    Parent := Self;
  end;

  BoldButton := TbsSkinSpeedButton.Create(Self);
  with BoldButton do
  begin
    Parent := Self;
    AllowAllUp := True;
    DefaultWidth := 25;
    DefaultHeight := 25;
    SkinDataName := 'toolbutton';
    GroupIndex := 1;
    NumGlyphs := 1;
    Left := 210;
    Top := 20;
    Glyph.LoadFromResourceName(HInstance, 'BS_BOLD');
    OnClick := BoldButtonClick;
  end;

  ItalicButton := TbsSkinSpeedButton.Create(Self);
  with ItalicButton do
  begin
    Parent := Self;
    AllowAllUp := True;
    DefaultWidth := 25;
    DefaultHeight := 25;
    SkinDataName := 'toolbutton';
    GroupIndex := 1;
    NumGlyphs := 1;
    Left := 240;
    Top := 20;
    Glyph.LoadFromResourceName(HInstance, 'BS_ITALIC');
    OnClick := ItalicButtonClick;
  end;

  UnderLineButton := TbsSkinSpeedButton.Create(Self);
  with UnderLineButton do
  begin
    Parent := Self;
    AllowAllUp := True;
    DefaultWidth := 25;
    DefaultHeight := 25;
    SkinDataName := 'toolbutton';
    GroupIndex := 1;
    NumGlyphs := 1;
    Left := 270;
    Top := 20;
    Glyph.LoadFromResourceName(HInstance, 'BS_UNDERLINE');
    OnClick := UnderLineButtonClick;
  end;

  StrikeOutButton := TbsSkinSpeedButton.Create(Self);
  with StrikeOutButton do
  begin
    Parent := Self;
    AllowAllUp := True;
    DefaultWidth := 25;
    DefaultHeight := 25;
    SkinDataName := 'toolbutton';
    GroupIndex := 1;
    NumGlyphs := 1;
    Left := 300;
    Top := 20;
    Glyph.LoadFromResourceName(HInstance, 'BS_STRIKEOUT');
    OnClick := StrikeOutButtonClick;
  end;

end;

procedure TbsFontDlgForm.FontSizeChange(Sender: TObject);
begin
  FontExampleLabel.Font.Size := Trunc(FontSizeEdit.Value);
  FontHeightEdit.SimpleSetValue(FontExampleLabel.Font.Height);
end;

procedure TbsFontDlgForm.FontHeightChange(Sender: TObject);
begin
  FontExampleLabel.Font.Height := Trunc(FontHeightEdit.Value);
  FontSizeEdit.SimpleSetValue(FontExampleLabel.Font.Size);
end;

procedure TbsFontDlgForm.FontNameChange(Sender: TObject);
begin
  FontExampleLabel.Font.Name := FontNameBox.FontName;
end;

procedure TbsFontDlgForm.FontColorChange(Sender: TObject);
begin
  FontExampleLabel.Font.Color := FontColorBox.Selected;
end;

procedure TbsFontDlgForm.BoldButtonClick(Sender: TObject);
begin
  if BoldButton.Down
  then
    FontExampleLabel.Font.Style := FontExampleLabel.Font.Style + [fsBold]
  else
    FontExampleLabel.Font.Style := FontExampleLabel.Font.Style - [fsBold];
end;

procedure TbsFontDlgForm.ItalicButtonClick(Sender: TObject);
begin
  if ItalicButton.Down
  then
    FontExampleLabel.Font.Style := FontExampleLabel.Font.Style + [fsItalic]
  else
    FontExampleLabel.Font.Style := FontExampleLabel.Font.Style - [fsItalic];
end;

procedure TbsFontDlgForm.StrikeOutButtonClick(Sender: TObject);
begin
  if StrikeOutButton.Down
  then
    FontExampleLabel.Font.Style := FontExampleLabel.Font.Style + [fsStrikeOut]
  else
    FontExampleLabel.Font.Style := FontExampleLabel.Font.Style - [fsStrikeOut];
end;

procedure TbsFontDlgForm.UnderLineButtonClick(Sender: TObject);
begin
  if UnderLineButton.Down
  then
    FontExampleLabel.Font.Style := FontExampleLabel.Font.Style + [fsUnderLine]
  else
    FontExampleLabel.Font.Style := FontExampleLabel.Font.Style - [fsUnderLine];
end;

constructor TbsSkinFontDialog.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  FAlphaBlend := False;
  FAlphaBlendAnimation := False;
  FAlphaBlendValue := 200;
  FTitle := '字体';
  FDefaultFont := TFont.Create;
  FFont := TFont.Create;
  with FDefaultFont do
  begin
    Name := '宋体';

⌨️ 快捷键说明

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