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

📄 bsmessages.pas

📁 BusinessSkinForm_v6.07_FS,delphi皮肤
💻 PAS
📖 第 1 页 / 共 3 页
字号:
          then
            begin
              Caption := ACtrlSkinData.ResourceStrData.GetResStr('MSG_CAP_SHOWFLAG');
              if Caption = '' then Caption := BS_MSG_CAP_SHOWFLAG;
            end
          else
            Caption := BS_MSG_CAP_SHOWFLAG;
          if (FIndex <> -1) and UseSkinFont
          then
            begin
              Result.Canvas.Font.Name := FontName;
              Result.Canvas.Font.Height := FontHeight;
            end
          else
            Result.Canvas.Font.Assign(ADefaultFont);
          W := Result.Canvas.TextWidth(Caption);
          W := W + 30;
          if Result.ClientWidth < W + 30 then Result.ClientWidth := W + 30;
          SetBounds(5, Y, W + 25, DefaultHeight);
        end;
      end;

    if Width > Result.BSF.GetMaxWidth
    then
      Width := Result.BSF.GetMaxWidth
    else
    if Width < Result.BSF.GetMinWidth
    then
      Width := Result.BSF.GetMinWidth;

    // add buttons
    if mbOk in Buttons then DefaultButton := mbOk else
      if mbYes in Buttons then DefaultButton := mbYes else
        DefaultButton := mbRetry;
    if mbCancel in Buttons then CancelButton := mbCancel else
      if mbNo in Buttons then CancelButton := mbNo else
        CancelButton := mbOk;
    X := (ClientWidth - ButtonGroupWidth) div 2;
    for B := Low(TMsgDlgBtn) to High(TMsgDlgBtn) do
      if B in Buttons then
        with TbsSkinButton.Create(Result) do
        begin
          Parent := Result;
          Name := ButtonNames[B];
          CanFocused := True;
          Caption := GetButtonCaption(B, ACtrlSkinData);
          ModalResult := ModalResults[B];
          if B = DefaultButton then Default := True;
          if B = CancelButton then Cancel := True;
          DefaultHeight := ButtonHeight;
          SetBounds(X, Result.ClientHeight - ButtonHeight - 10,
            ButtonWidth, ButtonHeight);
          DefaultFont := ADefaultButtonFont;
          UseSkinFont := AUseSkinFont;
          Inc(X, ButtonWidth + ButtonSpacing);
          if B = mbHelp then
            OnClick := Result.HelpButtonClick;
          SkinDataName := AButtonSkinDataName;
          SkinData := ACtrlSkinData;
        end;
  end;
end;

constructor TbsMessageForm.CreateEx(AOwner: TComponent; X, Y: Integer);
begin
  inherited CreateNew(AOwner);
  DisplayCheckBox := nil;
  BorderStyle := bsDialog;
  KeyPreview := True;
  BSF := TbsBusinessSkinForm.Create(Self);
  BSF.BorderIcons := [];
  if X < -10000
  then
    BSF.PositionInMonitor := bspDesktopCenter
  else
    begin
      Self.Left := X;
      Self.Top := Y;
    end;
end;

procedure TbsMessageForm.HelpButtonClick(Sender: TObject);
begin
  Application.HelpContext(HelpContext);
end;

constructor TbsSkinMessage.Create;
begin
  inherited Create(AOwner);
  FShowAgainFlag := False;
  FShowAgainFlagValue := False;
  FAlphaBlend := False;
  FAlphaBlendAnimation := False;
  FAlphaBlendValue := 200;
  FButtonSkinDataName := 'button';
  FMessageLabelSkinDataName := 'stdlabel';
  FDefaultFont := TFont.Create;
  FDefaultButtonFont := TFont.Create;
  FUseSkinFont := True;
  with FDefaultFont do
  begin
    Name := 'Arial';
    Style := [];
    Height := 14;
  end;
  with FDefaultButtonFont do
  begin
    Name := 'Arial';
    Style := [];
    Height := 14;
  end;
end;

destructor TbsSkinMessage.Destroy;
begin
  FDefaultFont.Free;
  FDefaultButtonFont.Free;
  inherited;
end;

function TbsSkinMessage.CustomMessageDlgHelp;
begin
  with CreateCustomMessageDialog(Msg, ACaption, AImages, AImageIndex, Buttons,
       FSD, FCtrlFSD, FButtonSkinDataName,
       FMessageLabelSkinDataName, FDefaultFont, FDefaultButtonFont, FUseSkinFont,
       FAlphaBlend, FAlphaBlendAnimation, FAlphaBlendValue, FShowAgainFlag, FShowAgainFlagValue,
       -10001, -10001) do
  begin
    try
      HelpContext := HelpCtx;
      HelpFile := HelpFileName;
      Result := ShowModal;
    finally
      if DisplayCheckBox <> nil
      then
        begin
          Self.ShowAgainFlagValue := not DisplayCheckBox.Checked;
        end;
      Free;
    end;
  end;
end;

function  TbsSkinMessage.CustomMessageDlgPos(const Msg: string;
      ACaption: String; AImages: TCustomImageList; AImageIndex: Integer;
      Buttons: TMsgDlgButtons; HelpCtx: Longint; X, Y: Integer): Integer;
begin
  with CreateCustomMessageDialog(Msg, ACaption, AImages, AImageIndex, Buttons,
       FSD, FCtrlFSD, FButtonSkinDataName,
       FMessageLabelSkinDataName, FDefaultFont, FDefaultButtonFont, FUseSkinFont,
       FAlphaBlend, FAlphaBlendAnimation, FAlphaBlendValue, FShowAgainFlag, FShowAgainFlagValue,
       X, Y) do
    try
      HelpContext := HelpCtx;
      Result := ShowModal;
    finally
      if DisplayCheckBox <> nil
      then
        begin
          Self.ShowAgainFlagValue := not DisplayCheckBox.Checked;
        end;
      Free;
    end;
end;

function TbsSkinMessage.CustomMessageDlg;
begin
  with CreateCustomMessageDialog(Msg, ACaption, AImages, AImageIndex, Buttons,
       FSD, FCtrlFSD, FButtonSkinDataName,
       FMessageLabelSkinDataName, FDefaultFont, FDefaultButtonFont, FUseSkinFont,
       FAlphaBlend, FAlphaBlendAnimation, FAlphaBlendValue, FShowAgainFlag, FShowAgainFlagValue,
       -10001, -10001) do
    try
      HelpContext := HelpCtx;
      Result := ShowModal;
    finally
      if DisplayCheckBox <> nil
      then
        begin
          Self.ShowAgainFlagValue := not DisplayCheckBox.Checked;
        end;
      Free;
    end;
end;

function TbsSkinMessage.MessageDlg2;
begin
  with CreateMessageDialog2(Msg, ACaption, DlgType, Buttons,
       FSD, FCtrlFSD, FButtonSkinDataName,
       FMessageLabelSkinDataName, FDefaultFont, FDefaultButtonFont, FUseSkinFont,
       FAlphaBlend, FAlphaBlendAnimation, FAlphaBlendValue, FShowAgainFlag, FShowAgainFlagValue,
       -10001, -10001) do
  begin
    try
      HelpContext := HelpCtx;
      Result := ShowModal;
    finally
      if DisplayCheckBox <> nil
      then
        begin
          Self.ShowAgainFlagValue := not DisplayCheckBox.Checked;
        end;
      Free;
    end;
  end;
end;

function TbsSkinMessage.MessageDlgHelp2;
begin
  with CreateMessageDialog2(Msg, ACaption,
       DlgType, Buttons,
       FSD, FCtrlFSD, FButtonSkinDataName,
       FMessageLabelSkinDataName, FDefaultFont, FDefaultButtonFont, FUseSkinFont,
       FAlphaBlend, FAlphaBlendAnimation, FAlphaBlendValue, FShowAgainFlag, FShowAgainFlagValue,
       -10001, -10001) do
  begin
    try
      HelpContext := HelpCtx;
      HelpFile := HelpFileName;
      Result := ShowModal;
    finally
      if DisplayCheckBox <> nil
      then
        begin
          Self.ShowAgainFlagValue := not DisplayCheckBox.Checked;
        end;
      Free;
    end;
  end;
end;

function TbsSkinMessage.MessageDlgPos(const Msg: string; DlgType: TMsgDlgType;
      Buttons: TMsgDlgButtons; HelpCtx: Longint; X, Y: Integer): Integer;
begin
  with CreateMessageDialog(Msg, DlgType, Buttons,
       FSD, FCtrlFSD, FButtonSkinDataName,
       FMessageLabelSkinDataName, FDefaultFont, FDefaultButtonFont, FUseSkinFont,
       FAlphaBlend, FAlphaBlendAnimation, FAlphaBlendValue, FShowAgainFlag, FShowAgainFlagValue,
       X, Y) do
  begin
    try
      HelpContext := HelpCtx;
      Result := ShowModal;
    finally
      if DisplayCheckBox <> nil
      then
        begin
          Self.ShowAgainFlagValue := not DisplayCheckBox.Checked;
        end;
      Free;
    end;
  end;
end;


function TbsSkinMessage.MessageDlg;
begin
  with CreateMessageDialog(Msg, DlgType, Buttons,
       FSD, FCtrlFSD, FButtonSkinDataName,
       FMessageLabelSkinDataName, FDefaultFont, FDefaultButtonFont, FUseSkinFont,
       FAlphaBlend, FAlphaBlendAnimation, FAlphaBlendValue, FShowAgainFlag, FShowAgainFlagValue,
       -10001, -10001) do
  begin
    try
      HelpContext := HelpCtx;
      Result := ShowModal;
    finally
      if DisplayCheckBox <> nil
      then
        begin
          Self.ShowAgainFlagValue := not DisplayCheckBox.Checked;
        end;
      Free;
    end;
  end;
end;

function TbsSkinMessage.MessageDlgHelp;
begin
  with CreateMessageDialog(Msg, DlgType, Buttons,
       FSD, FCtrlFSD, FButtonSkinDataName,
       FMessageLabelSkinDataName, FDefaultFont, FDefaultButtonFont, FUseSkinFont,
       FAlphaBlend, FAlphaBlendAnimation, FAlphaBlendValue, FShowAgainFlag, FShowAgainFlagValue,
       -10001, -10001) do
  begin
    try
      HelpContext := HelpCtx;
      HelpFile := HelpFileName;
      Result := ShowModal;
    finally
      if DisplayCheckBox <> nil
      then
        begin
          Self.ShowAgainFlagValue := not DisplayCheckBox.Checked;
        end;
      Free;
    end;
  end;
end;

procedure TbsSkinMessage.SetDefaultFont;
begin
  FDefaultFont.Assign(Value);
end;

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

procedure TbsSkinMessage.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;

end.

⌨️ 快捷键说明

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