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

📄 unit1.pas

📁 工程管理部门配件仓库属于生产辅助仓库
💻 PAS
字号:
//// this code is for Demo purpose
//// it is a product of tekhnelogos
//// at www.tekhnelogos.com

//// use it for free in all your applications
//// including commercial ones.
//// also it is not neccessary that you should
//// give cretid to me or my company in your
//// products.

//// Just send me mails that you have loved this component

/// M Ali Caliskan
/// President of Tekhnelogos.Com
/// Power Components for Developers

//// Dont hesitate to use my mail adresses

/// mualic@netone.com.tr

/// info@tekhnelogos.com
/// sails@tekhnelogos.com
/// support@tekhnelogos.com
/// webmaster@tekhnelogos.com




unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Outlook, ExtDlgs, ExtCtrls;

type
  TForm1 = class(TForm)
    ListBox1: TListBox;
    Label1: TLabel;
    Edit1: TEdit;
    Button1: TButton;
    Edit2: TEdit;
    Button2: TButton;
    Image1: TImage;
    Label2: TLabel;
    OpenPictureDialog1: TOpenPictureDialog;
    Outlook1: TOutlook;
    procedure Outlook1TabChange(Sender: TObject; Item: String);
    procedure Outlook1ItemClick(Sender: TObject; Item: String);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Image1DblClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Outlook1TabChange(Sender: TObject; Item: String);
begin
  ListBox1.Items.Add('The OnTabChange Event has occured: Tab has changed to '+ Item);
end;

procedure TForm1.Outlook1ItemClick(Sender: TObject; Item: String);
begin
  ListBox1.Items.Add('The OnItemClick Event has occured:'+Item+' has been clicked');
end;

procedure TForm1.Button1Click(Sender: TObject);
var HeaderCount : integer;
begin
HeaderCount := Outlook1.Items.Counts[0];// Index 0 gives header (tab) count
  Outlook1.Items.Headers[HeaderCount+1] := Edit1.Text;
  /// If you assing a header of and index much (and much) than the headercount
  // then the headers in the mean will be created also with empty caption
  // So to create a new tab(header) just set the Header array with the index
 // HeaderCoun + 1

  /// Never forget to call this to see the changes
 Outlook1.RefreshDisplay;
  //outlook1.LoadFromFile('c:\s.obt');
  //outlook1.SaveToFile('c:\s.obt');
end;

procedure TForm1.Button2Click(Sender: TObject);
var HeaderIdx,ItemIdx : integer;
    Picture : TPicture;
begin
  HeaderIdx := Outlook1.ActiveTab;
  ItemIdx   := Outlook1.Items.Counts[HeaderIdx] + 1;

  Outlook1.Items.Items[HeaderIdx,ItemIdx] := Edit2.Text;
  /// If you assing an item of an index more than the itemcount
  // then the items in the mean will be created also with empty caption
  // So to create a new item just set the items array with the index
  // ItemCount + 1


  // always assign the image after you assign the item. By this way,
  // you will be sure that the item in that index will be created.

  // Create a sepearet picture for each item if you add items in runtime
  Picture := TPicture.Create;
  Picture.Icon.Assign(Image1.Picture.Icon);
  Outlook1.Items.Images[HeaderIdx,ItemIdx] := Picture;

  /// Never forget to call this to see the changes
  Outlook1.RefreshDisplay;
end;

procedure TForm1.Image1DblClick(Sender: TObject);
begin
  if openpicturedialog1.execute then begin
    image1.Hide;
    image1.Picture.LoadFromFile(openpicturedialog1.filename);
    image1.Show
  end;

end;

end.

⌨️ 快捷键说明

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