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

📄 abfcomponentsdemomain.pas

📁 一个非常好的OUTLOOK EXPRESS接口控件
💻 PAS
📖 第 1 页 / 共 2 页
字号:
{*******************************************************************************

  abfComponents Demo. Main form unit.

  Copyright (c) 2000-2002 ABF software, Inc.
  All Rights Reserved.

  e-mail: info@ABFsoftware.com
  web:    http://www.ABFsoftware.com

*******************************************************************************}
unit abfComponentsDemoMain;

{$I abf.inc}

interface

uses
{$IfDef D5}
  AppEvnts,
{$EndIf D5}
{$IfDef D4}
  ImgList,
{$EndIf D4}
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ExtCtrls, StdCtrls, Buttons, Menus, ComCtrls,
// ABF VCL  
  abfComponents, abfAppProps;

const
  cFlatButtons = False; // Determines are speed buttons flat or not
  cWidth  = 640;
  cHeight = 400;

type

//==============================================================================
// TfrmComponentsDemoMain
//==============================================================================
// Main form of application.

  TfrmComponentsDemoMain = class(TForm)
    pmMain: TPopupMenu;
      miAboutApp: TMenuItem;
        mi1: TMenuItem;
      miExit: TMenuItem;
  // TbfApplicationProperties
    abfAppProp: TabfApplicationProperties;
    grpApplicationProperties: TGroupBox;
    imgApplicationProperties: TImage;
    lbAppPropInfo: TLabel;
    grpAppPropBeep: TGroupBox;
      chbAppPropMinimize: TCheckBox;
      chbAppPropOnActivate: TCheckBox;
      chbAppPropOnDeactivate: TCheckBox;
      chbAppPropOnRestore: TCheckBox;
      chbAppPropOnHint: TCheckBox;
    grpAppPropHint: TGroupBox;
      lbAppPropHintPause: TLabel;
        edAppPropHintPause: TEdit;
        udAppPropHintPause: TUpDown;
      lbAppPropHintHidePause: TLabel;
        edAppPropHintHidePause: TEdit;
        udAppPropHintHidePause: TUpDown;
      lbAppPropHintShortPause: TLabel;
        edAppPropHintShortPause: TEdit;
        udAppPropHintShortPause: TUpDown;
      btnAppPropHintColor: TSpeedButton;
    dlgColor: TColorDialog;
  // TabfAutoRun
    abfAutoRun: TabfAutoRun;
    grpAutoRun: TGroupBox;
      imgAutoRun: TImage;
      lbAutoRunInfo: TLabel;
      chbAutoRun: TCheckBox;
  // TabfOneInstance
    abfOneInstance: TabfOneInstance;
    grpOneInstance: TGroupBox;
      imgOneInstance: TImage;
      lbOneInstanceInfo: TLabel;
      btnOneInstance: TButton;
  // TabfTrayIcon
    abfTrayIcon: TabfTrayIcon;
    grpTrayIcon: TGroupBox;
      imgIcon: TImage;
      lbTrayIconInfo: TLabel;
      lbIconHint: TLabel;
        edIconHint: TEdit;
      btnIconLoad: TSpeedButton;
      btnIconShow: TSpeedButton;
      btnIconHide: TSpeedButton;
      chbIconEnabled: TCheckBox;
      chbIconCycleIcons: TCheckBox;
      chbIconMinimizeToTray: TCheckBox;
      chbIconPopupByLeft: TCheckBox;
    pmIcon: TPopupMenu;
      miIconHide: TMenuItem;
      mi5: TMenuItem;
      miIconShowApp: TMenuItem;
      miIconHideApp: TMenuItem;
      mi6: TMenuItem;
      miIconAbout: TMenuItem;
      miIconExit: TMenuItem;
    dlgIconLoad: TOpenDialog;
    imgsIcon: TImageList;
  // TabfWndProcHook
    abfWndProcHook: TabfWndProcHook;
    grpWPH: TGroupBox;
      imgWPH: TImage;
      lbWPHInfo: TLabel;
      edHookedControl: TEdit;
      grpWPHBeep: TGroupBox;
        chbWPHMouseDown: TCheckBox;
        chbWPHKeyDown: TCheckBox;
        chbWPHKeyUp: TCheckBox;
      chbWPHActive: TCheckBox;
      chbWPHAutoDrag: TCheckBox;
  // TabfWav
    abfWav: TabfWav;
    grpWav: TGroupBox;
      imgWav: TImage;
      lbWavInfo: TLabel;
      chbWavLopped: TCheckBox;
      chbWavAsync: TCheckBox;
      btnWav: TBitBtn;
    btnIconBaloon: TSpeedButton;
  // Events
    procedure FormCreate(Sender: TObject);
    procedure ComponentIconClick(Sender: TObject);
    procedure AboutClick(Sender: TObject);
    procedure CloseClick(Sender: TObject);
  // TbfApplicationProperties
    procedure chbAppPropBeepClick(Sender: TObject);
    procedure btnAppPropHintColorClick(Sender: TObject);
    procedure edAppPropHintChange(Sender: TObject);
  // TabfAutoRun
    procedure chbAutoRunClick(Sender: TObject);
  // TabfOneInstance
    procedure btnOneInstanceClick(Sender: TObject);
  // TabfTrayIcon
    procedure edIconHintChange(Sender: TObject);
    procedure btnIconLoadClick(Sender: TObject);
    procedure chbIconEnabledClick(Sender: TObject);
    procedure chbIconCycleIconsClick(Sender: TObject);
    procedure chbIconMinimizeToTrayClick(Sender: TObject);
    procedure chbIconPopupByLeftClick(Sender: TObject);
    procedure btnIconShowClick(Sender: TObject);
    procedure btnIconHideClick(Sender: TObject);
    procedure btnIconBaloonClick(Sender: TObject);
    procedure miIconHideAppClick(Sender: TObject);
    procedure miIconShowAppClick(Sender: TObject);
  // TabfWndProcHook
    procedure abfWndProcHookMessageBefore(Sender: TObject;
      var Msg: TMessage; var Handled: Boolean);
    procedure chbWPHActiveClick(Sender: TObject);
    procedure chbWPHAutoDragClick(Sender: TObject);
  // TabfWav
    procedure abfWavPlayAfter(Sender: TObject);
    procedure abfWavPlayBefore(Sender: TObject);
    procedure btnWavClick(Sender: TObject);
    procedure chbWavAsyncClick(Sender: TObject);
    procedure chbWavLoppedClick(Sender: TObject);
    procedure FormResize(Sender: TObject);
    procedure FormCanResize(Sender: TObject; var NewWidth,
      NewHeight: Integer; var Resize: Boolean);
    procedure abfTrayIconBalloonClick(Sender: TObject);
  private
    FSoundPlayed: Boolean;
    procedure DoBeep(Sender: TObject);
    procedure ChangeAppPropGlyph;
    procedure UpdateAppProp;
    procedure UpdateIconProp;
    procedure UpdateWav;
    procedure UpdateWavButton;
    procedure StopSound;
  end;{TfrmMain = class(TForm)}

var
  frmComponentsDemoMain: TfrmComponentsDemoMain;

//==============================================================================
// Entry point
//==============================================================================
procedure ShowDemo;

{******************************************************************************}
implementation
{******************************************************************************}
{$R *.DFM}
uses
  abfAboutApplication, abfAboutComponent;

//==============================================================================
// Entry point
//==============================================================================

procedure ShowDemo;
begin
  if not Assigned(frmComponentsDemoMain) then
    Application.CreateForm(TfrmComponentsDemoMain, frmComponentsDemoMain);
  frmComponentsDemoMain.Show;
  frmComponentsDemoMain.BringToFront;
end;


//==============================================================================
// TfrmComponentsDemoMain
//==============================================================================
// Main form of application.
{ TfrmComponentsDemoMain }

procedure TfrmComponentsDemoMain.DoBeep(Sender: TObject);
begin
  Beep;
end;

//------------------------------------------------------------------------------

procedure TfrmComponentsDemoMain.ChangeAppPropGlyph;
var
  Glyph: TBitmap;
  R: TRect;
begin
  Glyph := TBitmap.Create;
  with Glyph, Glyph.Canvas do
  try
    Width  := btnAppPropHintColor.Width  - 8;
    Height := btnAppPropHintColor.Height - 8;
    R := Rect(0, 0, Width, Height);
    Brush.Style := bsSolid;
  // Create transparent part becouse LeftBotom point specifies a transparent
  //  color of the glyph. Select color for it other then Application.HintColor
    Brush.Color := clBtnFace;
    FrameRect(R);
  // Draw complex border
    InflateRect(R, -1, -1);
    Brush.Color := clWhite;
    FrameRect(R);
    InflateRect(R, -1, -1);
    Brush.Color := clBtnShadow;
    FrameRect(R);
  // Draw color rect
    InflateRect(R, -1, -1);
    Brush.Color := Application.HintColor;
    FillRect(R);
  // Assign new glyph to button
    btnAppPropHintColor.Glyph := Glyph;
  finally
    Glyph.Free;
  end;
end;

//------------------------------------------------------------------------------

procedure TfrmComponentsDemoMain.UpdateAppProp;
begin
  udAppPropHintPause.Position := Application.HintPause;
  udAppPropHintHidePause.Position := Application.HintHidePause;
  udAppPropHintShortPause.Position := Application.HintShortPause;
  edAppPropHintPause.Text := IntToStr(udAppPropHintPause.Position);
  edAppPropHintHidePause.Text := IntToStr(udAppPropHintHidePause.Position);
  edAppPropHintShortPause.Text := IntToStr(udAppPropHintShortPause.Position);
end;

//------------------------------------------------------------------------------

procedure TfrmComponentsDemoMain.UpdateIconProp;
begin
  with abfTrayIcon do
  begin
    edIconHint.Text := Hint;
    chbIconEnabled.Checked := Enabled;
    chbIconCycleIcons.Checked := CycleIcons;
    chbIconMinimizeToTray.Checked := MinimizeToTray;
    chbIconPopupByLeft.Checked := PopupByLeft;
    UpDate;
  end;
end;

//------------------------------------------------------------------------------

procedure TfrmComponentsDemoMain.UpdateWav;
begin
  with abfWav do
  begin
    chbWavAsync.Checked := AsyncPlay;
    chbWavLopped.Checked := Looped;
  end;
  UpdateWavButton
end;

//------------------------------------------------------------------------------

procedure TfrmComponentsDemoMain.UpdateWavButton;
begin
  if FSoundPlayed then btnWav.Caption := 'Stop sound'
  else btnWav.Caption := 'Play sound';
end;

//------------------------------------------------------------------------------

procedure TfrmComponentsDemoMain.StopSound;
begin
  abfWav.Stop;
  FSoundPlayed := False;
end;


//==============================================================================
// Published by Delphi

procedure TfrmComponentsDemoMain.FormCreate(Sender: TObject);
begin
{$IfDef D3}
  btnAppPropHintColor.Flat := cFlatButtons;
  btnIconLoad.Flat := cFlatButtons;
  btnIconShow.Flat := cFlatButtons;
  btnIconHide.Flat := cFlatButtons;
{$EndIf D3}
  ChangeAppPropGlyph;
  UpdateAppProp;

⌨️ 快捷键说明

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