1. Виндоуз ХР, Виндоуз 7.
2. Выложить форму сложно, т.к. формы создаются динамически, список компонентов формы лежит в БД где описаны размеры, положение и прочие параметры компонент.
Компоненты объявлены как:
- Код: Выделить всё
TMyEdit=Class(TControl)
private { Private declarations }
aTp:Word;
ne:TTriaNumEdit;
ed:TEdit;
me:TTriaEdit;//TEditButton;
mo:TMemo;
dt:TTriaDateEdit;
Кусок кода по созданию компонет:
- Код: Выделить всё
Case NewTp of
2:begin
If not Assigned(ne) Then begin
ne:=TTriaNumEdit.Create(Owner);
ne.Visible:=False; ne.Parent:=Pointer(Owner);
//ne.ButtonWidth:=0;
ne.OnExit:=self.OnExit;
ne.AutoSize:=False;
ne.OnKeyDown:=KeyDown;
end;
NewCnt:=ne;
end;
3:begin
If Assigned(RecvZn)and(RecvZn.pTypeRecv.NoLength)Then begin
If not Assigned(mo) Then begin
mo:=TMemo.Create(Owner);
mo.Visible:=False; mo.Parent:=Pointer(Owner);
mo.OnExit:=self.OnExit; mo.OnKeyDown:=KeyDown;
end;
NewCnt:=mo;
end
Else begin
If not Assigned(ed) Then begin
ed:=TEdit.Create(Owner);
ed.Visible:=False; ed.Parent:=Pointer(Owner);
ed.OnExit:=self.OnExit;
ed.OnKeyDown:=KeyDown;
end;
NewCnt:=ed;
end;
end;
Задание шрифта контролам:
- Код: Выделить всё
f:=GetFont(Obj);
If Trim(vr.FontAtr.FontName)='' Then f.Name:=_DefFontAtr.FontName
Else f.Name:=vr.FontAtr.FontName;
If vr.FontAtr.FontSize=0 Then f.Size:=_DefFontAtr.FontSize
Else f.Size:=vr.FontAtr.FontSize;
f.Style:=vr.FontAtr.FontStyle;//(fsBold, fsItalic, fsUnderline, fsStrikeOut)
//If vr.FontAtr.FontColor<>0 Then f.Color:=vr.FontAtr.FontColor;
f.Color:=vr.FontAtr.FontColor;
f.CharSet:=DEFAULT_CHARSET;
Где GetFont:
- Код: Выделить всё
Function GetFont(Obj:TObject):TFont;
begin
Result:=Nil;
If Obj is TTriaEditButton Then Result:=(Obj as TTriaEditButton).Font
Else If Obj is TEdit Then Result:=(Obj as TEdit).Font
Else If Obj is TLabel Then Result:=(Obj as TLabel).Font
Else If Obj is TTriaLabel Then Result:=(Obj as TTriaLabel).Font
Else If Obj is TTriaGroupBox Then Result:=(Obj as TTriaGroupBox).Font
Else If Obj is TCheckBox Then Result:=(Obj as TCheckBox).Font
Else If Obj is TComboBox Then Result:=(Obj as TComboBox).Font
Else If Obj is TMyEdit Then Result:=(Obj as TMyEdit).Font
Else ShowMessage('GetFont Result:=nil');
end;