除了自增EDIT控件,还有通过两个Radiobutton来控制所有自增的Edit控件的Readonly属性,拜托高手们替我这个菜鸟解答,不甚感激
解决方案 »
- 我知道这样的问题100分是太少了,十万火急:兄弟们帮帮想想,我感觉是个十分困难的问题,与服务器的连接......
- 怎样加个不闪的背景图
- 请教!如何将TDBLOOKUPCOMBOBOX的对象的datasource赋成空值?
- Access用语句创建表,如何同时创建字段说明
- 怎样注册delphi7才能进入borland那个该死的downloads for registered users区?
- 如何将XML内容示显示在DBGRID上
- delphi控制word中的一个小问题
- 300分求教动态创建 webbrowser 高难度问题!
- 请问ComPort控件接收到串口数据时,为什么会把数据分成好几段来读取?
- 奇怪的问题!!!
- 帮我算算 我得多久才可以升个星啊~
- 如果在网页上判断电脑上是否安装了我的软件
setlength(Et,200);
for k := 1 to 7 do
begin
for j := 0 to 12 do
begin
Et[k + 7*j] := TEdit.Create(self);
Et[k + 7*j].Parent := self.GroupBox1;
Eh := 21;
Ew := 80;
Et[k + 7*j].Width := 80;
Et[k + 7*j].Left := 2 + 80*(k-1);
Et[k + 7*j].Top := 34 + j*Eh;
end;
end;
我放了两个radiobutton共用一个onclick事件如下:
procedure TForm1.RadioButton1Click(Sender: TObject);
var
m : integer;
begin
if RadioButton1.Checked = true then
begin
for m := 1 to Et[m].ComponentCount - 1 do
begin
Et[m].ReadOnly := true;
end;
end;
end;
var
m : integer;
begin
for m := 0 to self.ComponentCount - 1 do
if self.Components[i] is TEdit then
TEdit(self.Components[i]).ReadOnly := RadioButton1.Checked;
end;
var
m : integer;
begin
{for m := 0 to self.ComponentCount - 1 do
if self.Components[m] is TEdit then
TEdit(self.Components[m]).ReadOnly := RadioButton1.Checked;
}
for m := 0 to GroupBox1.ControlCount - 1 do
begin
if GroupBox1.Controls[m] is TEdit then
begin
TEdit(GroupBox1.Controls[m]).ReadOnly := RadioButton1.Checked;
end;
end;
end;
,看这样可以吗?我想问下两者的不同之处啊?
var
m : integer;
begin
for m := 0 to self.ComponentCount - 1 do
if (self.Components[i] is TEdit) and (self.Components[i].parent=groupbox1) then
TEdit(self.Components[i]).ReadOnly := RadioButton1.Checked;
end;
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons;type
TForm1 = class(TForm)
GroupBox1: TGroupBox;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
BitBtn3: TBitBtn;
BitBtn4: TBitBtn;
BitBtn5: TBitBtn;
BitBtn6: TBitBtn;
BitBtn7: TBitBtn;
GroupBox2: TGroupBox;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
procedure FormCreate(Sender: TObject);
procedure RadioButton1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;
Et : array of TEdit;implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
var
j, Eh, Ew ,k ,m : integer;
begin
setlength(Et,200); {for k := 1 to 7 do
begin
for j := 0 to 12 do
begin
Et[k + 7*j] := TEdit.Create(self);
Et[k + 7*j].Parent := self.GroupBox1;
Eh := 21;
Ew := 80;
Et[k + 7*j].Width := 80;
Et[k + 7*j].Left := 2 + 80*(k-1);
Et[k + 7*j].Top := 34 + j*Eh;
end;
end;}
for j := 0 to 12 do
begin
Et[1 + 7*j] := TEdit.Create(self);
Et[1 + 7*j].Parent := self.GroupBox1;
Et[1 + 7*j].ReadOnly := true;
Eh := 21;
Et[1 + 7*j].Width := 143;
Et[1 + 7*j].Left := 2;
Et[1 + 7*j].Top := 34 + j*Eh;
end;
for j := 0 to 12 do
begin
Et[2 + 7*j] := TEdit.Create(self);
Et[2 + 7*j].Parent := self.GroupBox1;
Eh := 21;
Et[2 + 7*j].Width := 109;
Et[2 + 7*j].Left := 145;
Et[2 + 7*j].Top := 34 + j*Eh;
end;
for k := 3 to 6 do
begin
for j := 0 to 12 do
begin
Et[k + 7*j] := TEdit.Create(self);
Et[k + 7*j].Parent := self.GroupBox1;
Eh := 21;
Ew := 75;
Et[k + 7*j].Width := 75;
Et[k + 7*j].Left := 254 + 75*(k-3);
Et[k + 7*j].Top := 34 + j*Eh;
end;
end;end;
procedure TForm1.RadioButton1Click(Sender: TObject);
var
m : integer;
begin
if RadioButton1.Checked = true then
begin
for m := 1 to Et[m].ComponentCount - 1 do
begin
Et[m].ReadOnly := true;
end;
end;
end;
if (self.Components[i] is TEdit) and (Tedit(self.Components[i].parent)=groupbox1) then