
24.06.2014, 23:57
|
 |
Гуру
|
|
Регистрация: 09.03.2009
Адрес: На курорте, из окна вижу теплое Баренцево море. Бррр.
Сообщения: 4,723
Репутация: 52347
|
|
Код:
unit Unit28;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus, StdCtrls;
type
TForm28 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure PopupMenuItemClick(Sender: TObject);
end;
var
Form28: TForm28;
implementation
Uses IniFiles, Clipbrd;
{$R *.dfm}
procedure TForm28.FormCreate(Sender: TObject);
Var
IniFile: TIniFile;
IniSection: TStringList;
SubMenu: TMenuItem;
i: Integer;
begin
PopupMenu := TPopupMenu.Create(Self);
PopupMenu.AutoHotkeys := maManual;
PopupMenu.Items.Add(TMenuItem.Create(Self));
SubMenu := PopupMenu.Items[PopupMenu.Items.Count - 1];
SubMenu.Caption := 'Text';
IniSection := TStringList.Create;
IniFile := TIniFile.Create(ExtractFilePath(ParamStr(0)) + 'IniFile.ini');
IniFile.ReadSection('Text', IniSection);
for i := 0 to IniSection.Count - 1
do begin
SubMenu.Add(TMenuItem.Create(Self));
SubMenu.Items[SubMenu.Count - 1].Caption := IniFile.ReadString('Text', IniSection.Strings[i], '');
SubMenu.Items[SubMenu.Count - 1].OnClick := PopupMenuItemClick;
end;
IniSection.Free;
IniFile.Free;
end;
procedure TForm28.PopupMenuItemClick(Sender: TObject);
begin
Clipboard.Open;
Clipboard.AsText := TMenuItem(Sender).Caption;
Clipboard.Close;
end;
end.
__________________
Жизнь такова какова она есть и больше никакова.
Помогаю за спасибо.
|