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

📄 frm_menu.pas

📁 Source Code TrayIcon and BaloonHint
💻 PAS
字号:
unit Frm_Menu;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, XPMan, SistemaIconeTray, ExtDlgs, ExtCtrls, Menus, ShellAPI,
  jvTrayIcon;

type
  TForm1 = class(TForm)
    Button_MostrarIT: TButton;
    Button_OcultarIT: TButton;
    Button_Modificar: TButton;
    XPManifest1: TXPManifest;
    OpenPictureDialog1: TOpenPictureDialog;
    PopupMenu1: TPopupMenu;
    MostrarForma1: TMenuItem;
    OcultarForma1: TMenuItem;
    Sair1: TMenuItem;
    Label2: TLabel;
    Panel1: TPanel;
    Image_Icone: TImage;
    Label_DescIcone: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label_MostTexto: TLabel;
    Label_MostIcone: TLabel;
    TimerAnimado: TTimer;
    Timer_Prev: TTimer;
    Label5: TLabel;
    RadioGroup1: TRadioGroup;
    Edit_Icone: TEdit;
    Button_Procurar: TButton;
    RB_IcoPers: TRadioButton;
    RB_IcoAnim: TRadioButton;
    CheckBox_Icone: TCheckBox;
    GroupBox1: TGroupBox;
    Edit_Mensagem: TEdit;
    CheckBox_Mensagem: TCheckBox;
    GroupBox2: TGroupBox;
    Edit_BalaoTitulo: TEdit;
    Edit_BalaoTexto: TEdit;
    ComboBox_Icone: TComboBox;
    Button_Mostrar: TButton;
    Label6: TLabel;
    Label7: TLabel;
    Label1: TLabel;
    procedure AtualizarDados(Sender: TObject);
    procedure Button_ProcurarClick(Sender: TObject);
    procedure Button_ModificarClick(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormCreate(Sender: TObject);
    procedure OcultarForma1Click(Sender: TObject);
    procedure MostarForma1Click(Sender: TObject);
    procedure Button_OcultarITClick(Sender: TObject);
    procedure Button_MostrarITClick(Sender: TObject);
    procedure Button_FecharClick(Sender: TObject);
    procedure TimerAnimadoTimer(Sender: TObject);
    procedure Timer_PrevTimer(Sender: TObject);
    procedure Button_MostrarClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  NID: TIconeTray;
  TIcone: TIcon;

implementation

{$R *.dfm}

//******************************************************************************

procedure TForm1.AtualizarDados(Sender: TObject);
begin
TIcone := TIcon.Create;
Edit_Icone.Enabled := CheckBox_Icone.Checked;
Edit_Mensagem.Enabled := CheckBox_Mensagem.Checked;
Button_Procurar.Enabled := CheckBox_Icone.Checked;
Button_Modificar.Enabled := True;

RB_IcoPers.Enabled := CheckBox_Icone.Checked;
RB_IcoAnim.Enabled := CheckBox_Icone.Checked;

Label_MostTexto.Font.Color := clBlue;
Label_MostIcone.Font.Color := clBlue;

  if CheckBox_Mensagem.Checked = True then begin
     Label_MostTexto.Caption := Edit_Mensagem.Text;
        if Edit_Mensagem.Text = '' then begin
           Label_MostTexto.Caption := 'Campo Vazio';
           Label_MostTexto.Font.Color := clRed;
        end;
  end else begin
     Label_MostTexto.Caption := 'Teste Do Sistema IconeTray';
  end;

  if CheckBox_Icone.Checked = True then begin

     if RB_IcoAnim.Checked = True then begin
        Edit_Icone.Enabled := False;        // Edit_Icone desativado
        Button_Procurar.Enabled := False;   // Button_Procurar desativado
        Timer_Prev.Enabled := True;
        Label_MostIcone.Caption := 'Animado';
     end else begin
        Timer_Prev.Enabled := False;
     end;

     if RB_IcoPers.Checked = True then begin
        Edit_Icone.Enabled := True;         // Edit_Icone ativado
        Button_Procurar.Enabled := True;    // Button_Procurar ativado
        if FileExists(Edit_Icone.Text) then begin
           TIcone:=Ticon.Create;
           TIcone.LoadFromFile(Edit_Icone.Text);
           Image_Icone.Picture.Icon := TIcone;
           Label_MostIcone.Caption := 'Personalizado';
        end else begin
           Label_MostIcone.Font.Color := clRed;
           Label_MostIcone.Caption := 'N鉶 Encontrado';
           //TIcone.Handle := ExtractIcon(Application.Handle, Pchar(Application.ExeName), 1); // 1

⌨️ 快捷键说明

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