aoutlsed.pas
来自「delphi编程控件」· PAS 代码 · 共 548 行 · 第 1/2 页
PAS
548 行
EItemHint.Enabled := EItemCaption.Enabled;
SILImage.Enabled := EItemCaption.Enabled And (SILImage.ImageList <> NIl);
SISImage.Enabled := EItemCaption.Enabled And (SISImage.ImageList <> NIl);
if(ActiveItem <> Nil) then begin
EItemCaption.Text := ActiveItem.Caption;
EItemHint.Text := ActiveItem.Hint;
SILImage.ItemIndex := ActiveItem.LargeImage;
SISImage.ItemIndex := ActiveItem.SmallImage;
end else begin
EItemCaption.Text := '';
EItemHint.Text := '';
SILImage.ItemIndex := -1;
SISImage.ItemIndex := -1;
end;
if (csDesigning in Store.ComponentState) And (Sender <> Nil) then begin
if(ActiveItem <> Nil) then
AComponent := ActiveItem
else AComponent := Store;
{$IFDEF DELPHI4}IFormDesigner{$ELSE}TFormDesigner{$ENDIF}(TForm(Store.Owner).Designer).SelectComponent(AComponent);
end;
end;
procedure TFAutoOutLookBarStoreEditor.BGMoveUpClick(Sender: TObject);
Var
Index : Integer;
begin
if(ListBox.ItemIndex > 0) then begin
Index := ListBox.ItemIndex;
ListBox.Items.Exchange(Index, Index - 1);
Store.Categories.Exchange(Index, Index - 1);
ListBox.ItemIndex := Index - 1;
ListBoxClick(Sender);
end;
end;
procedure TFAutoOutLookBarStoreEditor.BGMoveDownClick(Sender: TObject);
Var
Index : Integer;
begin
if(ListBox.ItemIndex < ListBox.Items.Count - 1) then begin
Index := ListBox.ItemIndex;
ListBox.Items.Exchange(Index, Index + 1);
Store.Categories.Exchange(Index, Index + 1);
ListBox.ItemIndex := Index + 1;
ListBoxClick(Sender);
end;
end;
procedure TFAutoOutLookBarStoreEditor.EItemCaptionExit(Sender: TObject);
Var
Index : Integer;
begin
if(ActiveItem <> Nil) then begin
ActiveItem.Caption := EItemCaption.Text;
Index := ImageListBox.ItemIndex;
ImageListBox.Items[ImageListBox.ItemIndex] := EItemCaption.Text;
ImageListBox.ItemIndex := Index;
if (csDesigning in Store.ComponentState) then
{$IFDEF DELPHI4}IFormDesigner{$ELSE}TFormDesigner{$ENDIF}(TForm(Store.Owner).Designer).SelectComponent(Store);
end;
end;
procedure TFAutoOutLookBarStoreEditor.SIImageChange(Sender: TObject;
ItemIndex: Integer);
begin
if(ActiveItem <> Nil) then begin
ActiveItem.LargeImage := ItemIndex;
ImageListBox.ImageIndexes[ImageListBox.ItemIndex] := ItemIndex;
if (csDesigning in Store.ComponentState) then
{$IFDEF DELPHI4}IFormDesigner{$ELSE}TFormDesigner{$ENDIF}(TForm(Store.Owner).Designer).SelectComponent(Store);
end;
end;
procedure TFAutoOutLookBarStoreEditor.BIDeleteClick(Sender: TObject);
var
Index : Integer;
begin
if(ActiveItem <> Nil) then begin
Index := ImageListBox.ItemIndex;
ActiveItem.Free;
ImageListBox.Items.Delete(Index);
if(Index >= ImageListBox.Items.Count) then
Dec(Index);
ImageListBox.ItemIndex := Index;
ImageListBoxClick(Sender);
end;
end;
procedure TFAutoOutLookBarStoreEditor.BIClearClick(Sender: TObject);
Var
List : TList;
i : Integer;
item : TAutoOutLookStoredItem;
begin
ImageListBox.Items.Clear;
if(ListBox.ItemIndex > -1) then begin
List := TList.Create;
Store.GetItemsByCategory(ListBox.Items[ListBox.ItemIndex], List);
for i := 0 to List.Count - 1 do begin
Item := TAutoOutLookStoredItem(List[i]);
Item.Free;
end;
List.Free;
end;
ImageListBoxClick(Sender);
end;
procedure TFAutoOutLookBarStoreEditor.BIMoveUpClick(Sender: TObject);
Var
Index : Integer;
Item1, Item2 : TAutoOutLookStoredItem;
begin
if(ImageListBox.ItemIndex > 0) then begin
Index := ImageListBox.ItemIndex;
Item1 := Store.GetItemByCategory(
ListBox.Items[ListBox.ItemIndex], Index);
Item2 := Store.GetItemByCategory(
ListBox.Items[ListBox.ItemIndex], Index - 1);
ImageListBox.ExchangeItems(Index, Index - 1);
Store.ExchangeItems(Item1, Item2);
ImageListBox.ItemIndex := Index - 1;
ImageListBoxClick(Sender);
end;
end;
procedure TFAutoOutLookBarStoreEditor.BIMoveDownClick(Sender: TObject);
Var
Index : Integer;
Item1, Item2 : TAutoOutLookStoredItem;
begin
if(ImageListBox.ItemIndex < ImageListBox.Items.Count - 1) then begin
Index := ImageListBox.ItemIndex;
Item1 := Store.GetItemByCategory(
ListBox.Items[ListBox.ItemIndex], Index);
Item2 := Store.GetItemByCategory(
ListBox.Items[ListBox.ItemIndex], Index + 1);
ImageListBox.ExchangeItems(Index, Index + 1);
Store.ExchangeItems(Item1, Item2);
ImageListBox.ItemIndex := Index + 1;
ImageListBoxClick(Sender);
end;
end;
procedure TFAutoOutLookBarStoreEditor.FormCreate(Sender: TObject);
begin
BClose.Caption := LoadStr(ACB_CLOSE);
BHelp.Caption := LoadStr(ACB_HELP);
BGAdd.Caption := LoadStr(ACB_ADDEX);
BGInsert.Caption := LoadStr(ACB_INSERTEX);
BGDelete.Caption := LoadStr(ACB_DELETE);
BGRename.Caption := LoadStr(ACB_RENAMEEX);
BGMoveup.Caption := LoadStr(ACB_MOVEUP);
BGMoveDown.Caption := LoadStr(ACB_MOVEDOWN);
BIAdd.Caption := LoadStr(ACB_ADD);
BIDelete.Caption := LoadStr(ACB_DELETE);
BIClear.Caption := LoadStr(ACB_CLEAR);
BIMoveup.Caption := LoadStr(ACB_MOVEUP);
BIMoveDown.Caption := LoadStr(ACB_MOVEDOWN);
GBGroups.Caption := LoadStr(AEL_CATEGORIES);
GBItems.Caption := LoadStr(AEL_STOREDITEMS);
LItemCaption.Caption := LoadStr(AEL_CAPTION);
LLImage.Caption := LoadStr(AEL_LARGEIMAGE);
LSImage.Caption := LoadStr(AEL_SMALLIMAGE);
LItemCaption.Caption := LoadStr(AEL_CAPTION);
LItemHint.Caption := LoadStr(AEL_HINT);
ReStoreAutoFormsInformtion(self);
end;
procedure TFAutoOutLookBarStoreEditor.ImageListBoxDragOver(Sender,
Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
Var
p : TPoint;
item : Integer;
begin
if ImageListBox.ItemIndex = -1 then exit;
Accept := False;
p.x := X;
p.y := Y;
item := ImageListBox.ItemAtPos(p, True);
if(item > -1) And (item < ImageListBox.Items.Count) then
Accept := Not ImageListBox.Selected[Item];
end;
procedure TFAutoOutLookBarStoreEditor.ListBoxDragOver(Sender,
Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
Var
p : TPoint;
item : Integer;
begin
if ImageListBox.ItemIndex = -1 then exit;
Accept := False;
p.x := X;
p.y := Y;
item := ListBox.ItemAtPos(p, True);
if(item > -1) And (item < ListBox.Items.Count) then
Accept := Not ListBox.Selected[Item];
end;
procedure TFAutoOutLookBarStoreEditor.ImageListBoxEndDrag(Sender,
Target: TObject; X, Y: Integer);
Var
p : TPoint;
item : Integer;
Index : Integer;
Item1, Item2 : TAutoOutLookStoredItem;
begin
if ImageListBox.ItemIndex = -1 then exit;
p.x := X;
p.y := Y;
if(Target = ListBox) then begin
item := ListBox.ItemAtPos(p, True);
if(item > -1) And (item < ListBox.Items.Count)
And Not ListBox.Selected[Item] then begin
Item1 := Store.GetItemByCategory(
ListBox.Items[ListBox.ItemIndex], ImageListBox.ItemIndex);
Item1.Category := item;
ListBoxClick(Sender);
end;
end;
if(Target = ImageListBox) then begin
item := ImageListBox.ItemAtPos(p, True);
if(item > -1) And (item < ImageListBox.Items.Count)
And Not ImageListBox.Selected[Item] then begin
Index := ImageListBox.ItemIndex;
Item1 := Store.GetItemByCategory(
ListBox.Items[ListBox.ItemIndex], Index);
Item2 := Store.GetItemByCategory(
ListBox.Items[ListBox.ItemIndex], Item);
ImageListBox.ExchangeItems(Index, Item);
Store.ExchangeItems(Item1, Item2);
ImageListBox.ItemIndex := Item;
ImageListBoxClick(Sender);
end;
end;
end;
procedure TFAutoOutLookBarStoreEditor.SISImageChange(Sender: TObject;
ItemIndex: Integer);
begin
if(ActiveItem <> Nil) then begin
ActiveItem.SmallImage := ItemIndex;
if (csDesigning in Store.ComponentState) then
{$IFDEF DELPHI4}IFormDesigner{$ELSE}TFormDesigner{$ENDIF}(TForm(Store.Owner).Designer).SelectComponent(Store);
end;
end;
procedure TFAutoOutLookBarStoreEditor.BCloseClick(Sender: TObject);
begin
Close;
end;
procedure TFAutoOutLookBarStoreEditor.BHelpClick(Sender: TObject);
begin
Application.HelpFile := 'aob_ps.hlp';
Application.HelpContext(10005);
end;
procedure TFAutoOutLookBarStoreEditor.EItemHintExit(Sender: TObject);
begin
if(ActiveItem <> Nil) then begin
ActiveItem.Hint := EItemHint.Text;
if (csDesigning in Store.ComponentState) then
{$IFDEF DELPHI4}IFormDesigner{$ELSE}TFormDesigner{$ENDIF}(TForm(Store.Owner).Designer).SelectComponent(Store);
end;
end;
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?