?? topview.pas
字號:
unit TopView;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ComCtrls, StdCtrls, CoreData, LeftView, Account, ImgList;
type
TfrmTop = class(TFrame)
tabAccount: TTabControl;
lsvEmail: TListView;
imlEmail: TImageList;
procedure FrameResize(Sender: TObject);
procedure lsvEmailClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure AddToMailList(lst : TList); overload; // 將 lst 中的郵件添加到ListView中
procedure AddToMailList(email : TEmailInfo); overload; // 將 email 添加到 ListView 中
end;
implementation
{$R *.dfm}
procedure TfrmTop.FrameResize(Sender: TObject);
begin
if Boolean(tabAccount.Handle) then
begin
tabAccount.Left := 0;
tabAccount.Top := 0;
tabAccount.Width := self.Width;
tabAccount.Height := self.Height;
lsvEmail.Left := -4;
lsvEmail.Top := 0;
lsvEmail.Width := self.Width - 4;
lsvEmail.Height := self.Height - 8;
end;
end;
//
// 將 lst 中的郵件添加到 ListView 中
//
procedure TfrmTop.AddToMailList(lst: TList);
var
i : integer;
pEmail : ^TEmailInfo;
item : TListItem;
begin
if lst = nil then
exit;
for i := 0 to lst.Count - 1 do
begin
pEmail := lst.Items[i];
item := lsvEmail.Items.Add();
with pEmail^ do
begin
item.Caption := m_From;
item.SubItems.Clear();
item.SubItems.Add(m_Subject);
item.SubItems.Add(m_Size);
item.SubItems.Add(m_Date);
if m_IsNew then
Item.ImageIndex := 0
else
Item.ImageIndex := 1;
end;
end;// finished all the new email
end;
//
// 將 email 加入到 ListView 中
//
procedure TfrmTop.AddToMailList(email: TEmailInfo);
var
item : TListItem;
begin
item := lsvEmail.Items.Add();
with email do
begin
item.Caption := m_From;
item.SubItems.Clear();
item.SubItems.Add(m_Subject);
item.SubItems.Add(m_Size);
item.SubItems.Add(m_Date);
if m_IsNew then
Item.ImageIndex := 0
else
Item.ImageIndex := 1;
end;
end;
//
// 郵件列表框選定項發改變觸發此事件
//
procedure TfrmTop.lsvEmailClick(Sender: TObject);
var
pAccount : ^TAccountInfo;
pEmail : ^TEmailInfo;
begin
if lsvEmail.Selected = nil then
exit;
if Account.m_lstAccount = nil then
exit;
pAccount := Account.m_lstAccount.Items[self.tabAccount.TabIndex];
if pAccount^.m_lstEmail = nil then
exit;
pEmail := pAccount^.m_lstEmail.Items[lsvEmail.Selected.index];
pEmail^.m_IsNew := False;
lsvEmail.Selected.ImageIndex := 1;
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -