Форум по Delphi программированию

Delphi Sources



Вернуться   Форум по Delphi программированию > Все о Delphi > Компоненты и классы
Ник
Пароль
Регистрация <<         Правила форума         >> FAQ Пользователи Календарь Поиск Сообщения за сегодня Все разделы прочитаны

 
 
Опции темы Поиск в этой теме Опции просмотра
  #1  
Старый 04.10.2011, 16:23
Tom Tom вне форума
Прохожий
 
Регистрация: 17.09.2011
Сообщения: 15
Репутация: 10
По умолчанию Помогите с классами

Код:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
unit Unit1;
 
interface
 
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;
 
type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
 
var
  Form1: TForm1;
 
implementation
 
uses Unit2;
 
{$R *.dfm}
 
procedure TForm1.Button1Click(Sender: TObject);
begin
 Form2:=TForm2.Create(Application);
 form2.listbox1.visible:=false;  
 form2.Button1.Visible:=false;
 form2.Button2.Visible:=false;   
 form2.Button3.Visible:=false;
 Form2.Visible:=true;
 
end;
 
end.
 
 
 
unit Unit2;
 
interface
 
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, inifiles, ShellAPI;
 
type
  TForm2 = class(TForm)
    ListBox1: TListBox;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    ComboBox1: TComboBox;
    Label1: TLabel;
    procedure ComboBox1Change(Sender: TObject);
    procedure ListBox1Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
 
 
  private
    { Private declarations }
  public
    { Public declarations }
  end;
 
var
  Form2: TForm2;
 
implementation
 
{$R *.dfm}
 
procedure TForm2.ComboBox1Change(Sender: TObject);
var
  Ini: Tinifile;
begin
if combobox1.ItemIndex=0 then begin
       Button1.Visible:=false;
       Button2.Visible:=false;
       Button3.Visible:=false;
       // открываем файл myini.ini
      ini:=TiniFile.Create(extractfilepath(paramstr(0))+'MyIni.ini');
      listbox1.Height:=Ini.ReadInteger('Size','Height',100);
      listbox1.Left:=Ini.ReadInteger('Size','Left',10);
      listbox1.Visible:=true;
      end;
if  combobox1.ItemIndex=1 then begin
      listbox1.visible:=false;
      ini:=TiniFile.Create(extractfilepath(paramstr(0))+'MyIni.ini');
      button1.Height:=Ini.ReadInteger('Size1','Height',100);
      button1.Left:=Ini.ReadInteger('Size1','Left',10);
      button1.Visible:=true;
 
      button2.Height:=Ini.ReadInteger('Size2','Height',100);
      button2.Left:=Ini.ReadInteger('Size2','Left',10);
      button2.Top:=ini.ReadInteger('Size2','Top',10);
      button2.Visible:=true;
 
      button3.Height:=Ini.ReadInteger('Size3','Height',100);
      button3.Left:=Ini.ReadInteger('Size3','Left',10);
      button3.Top:=ini.ReadInteger('Size3','Top',10);
      button3.Visible:=true;
      end;
end;
 
 
 
procedure TForm2.ListBox1Click(Sender: TObject);
var
ini:tinifile;
f:string;
begin
if listbox1.ItemIndex=0 then begin
      ini:=TiniFile.Create(extractfilepath(paramstr(0))+'MyIni.ini');
      f:=Ini.ReadString('Paint','Open','Value1');
      
      WinExec(PChar(f),SW_ShowNormal);
      end;
if listbox1.ItemIndex=1 then begin
      ini:=TiniFile.Create(extractfilepath(paramstr(0))+'MyIni.ini');
      f:=Ini.ReadString('WordPad','Open','Value1');
      WinExec(PChar(f),SW_ShowNormal);
      end;
if listbox1.ItemIndex=2 then begin
      ini:=TiniFile.Create(extractfilepath(paramstr(0))+'MyIni.ini');
      f:=Ini.ReadString('Kalc','Open','Value1');
      WinExec(PChar(f),SW_ShowNormal);
      end;
 
end;
 
procedure TForm2.Button1Click(Sender: TObject);
var
ini:tinifile;
f:string;
begin
  ini:=TiniFile.Create(extractfilepath(paramstr(0))+'MyIni.ini');
  f:=Ini.ReadString('Paint','Open','Value1');
  WinExec(PChar(f),SW_ShowNormal);
end;
 
procedure TForm2.Button2Click(Sender: TObject);
var
ini:tinifile;
f:string;
begin
 ini:=TiniFile.Create(extractfilepath(paramstr(0))+'MyIni.ini');
 f:=Ini.ReadString('WordPad','Open','Value1');
 WinExec(PChar(f),SW_ShowNormal);
end;
 
procedure TForm2.Button3Click(Sender: TObject);
var
ini:tinifile;
f:string;
begin
 ini:=TiniFile.Create(extractfilepath(paramstr(0))+'MyIni.ini');
 f:=Ini.ReadString('Kalc','Open','Value1');
 WinExec(PChar(f),SW_ShowNormal);
end;
 
end.
Админ: Пользуемся тегами при оформлении кода!

Последний раз редактировалось Admin, 04.10.2011 в 16:34.
Ответить с цитированием
 


Delphi Sources

Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

Ваши права в разделе
Вы не можете создавать темы
Вы не можете отвечать на сообщения
Вы не можете прикреплять файлы
Вы не можете редактировать сообщения

BB-коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход


Часовой пояс GMT +3, время: 00:47.


 

Сайт

Форум

FAQ

Соглашения

Прочее

 

Copyright © Форум "Delphi Sources" by BrokenByte Software, 2004-2025