📄 baservfrm.pas
字号:
teb.ModalResult := ModalResult;
if Self.Components[i] is TBitBtn then
teb.Glyph := TBitBtn(Self.Components[i]).Glyph;
teb.Hint := Hint;
teb.ShowHint := ShowHint;
teb.Enabled := Enabled;
ATabOrder := TabOrder;
teb.Default := Default;
teb.Cancel := Cancel;
teb.Parent := Parent;
OnCreateThemedControl(TControl(Self.Components[i]), teb);
Free;
teb.Loaded;
teb.TabOrder := ATabOrder;
end
else if Components[i].ClassName= 'TRadioButton' then
with TRadioButton(Components[i]) do begin
terb := TTeRadioButton.Create(Self);
terb.SetBounds(Left,Top,Width,Height);
terb.Caption := _GetWideString(Caption);
terb.Enabled := Enabled;
terb.Visible := Visible;
terb.Checked := Checked;
terb.OnClick := OnClick;
terb.Hint := Hint;
terb.ShowHint := ShowHint;
ATabOrder := TabOrder;
terb.Parent := Parent;
OnCreateThemedControl(TControl(Self.Components[i]), terb);
Free;
terb.Loaded;
terb.TabOrder := ATabOrder;
end
else if Components[i] is TCheckBox then
with TCheckBox(Components[i]) do begin
tecb := TTeCheckBox.Create(Self);
tecb.SetBounds(Left,Top,Width,Height);
tecb.Caption := _GetWideString(Caption);
tecb.Enabled := Enabled;
tecb.Visible := Visible;
tecb.State := TTeCheckBoxState(State);
tecb.OnClick := OnClick;
tecb.Hint := Hint;
tecb.ShowHint := ShowHint;
ATabOrder := TabOrder;
tecb.Parent := Parent;
OnCreateThemedControl(TControl(Self.Components[i]), tecb);
Free;
tecb.Loaded;
tecb.TabOrder := ATabOrder;
end
else if Components[i].ClassName='TEdit' then
with TEdit(Components[i]) do begin
tetxt := TTeEdit.Create(Self);
tetxt.SetBounds(Left,Top,Width,Height);
tetxt.Text := _GetWideString(Text);
tetxt.Enabled := Enabled;
tetxt.Visible := Visible;
tetxt.OnChange := OnChange;
tetxt.OnExit := OnExit;
tetxt.OnKeyPress := OnKeyPress;
tetxt.Hint := Hint;
tetxt.ShowHint := ShowHint;
ATabOrder := TabOrder;
tetxt.Parent := Parent;
OnCreateThemedControl(TControl(Self.Components[i]), tetxt);
Free;
tetxt.Loaded;
tetxt.TabOrder := ATabOrder;
end
else if (Components[i].ClassName='TComboBox') and (TComboBox(Components[i]).Style<>csSimple) then
with TComboBox(Components[i]) do begin
tecmb := TTeComboBox.Create(Self);
tecmb.SetBounds(Left,Top,Width,Height);
tecmb.Enabled := Enabled;
tecmb.Visible := Visible;
tecmb.Items := Items;
tecmb.ItemIndex := ItemIndex;
tecmb.Hint := Hint;
tecmb.ShowHint := ShowHint;
ATabOrder := TabOrder;
tecmb.Parent := Parent;
tecmb.DropDownCount := DropDownCount;
case Style of
csDropDown:
tecmb.ComboStyle := kcsDropDown;
csDropDownList:
tecmb.ComboStyle := kcsDropDownList;
csOwnerDrawFixed:
begin
tecmb.ComboStyle := kcsDropDownList;
tecmb.ListStyle := lbOwnerDrawFixed;
tecmb.ItemHeight := ItemHeight;
tecmb.Height := ItemHeight+2;
end;
end;
tecmb.OnChange := OnClick;
OnCreateThemedControl(TControl(Self.Components[i]), tecmb);
Free;
tecmb.Loaded;
tecmb.TabOrder := ATabOrder;
end
else if (Components[i] is TGroupBox) then
with TGroupBox(Components[i]) do begin
tegb := TTeGroupBox.Create(Self);
tegb.SetBounds(Left,Top,Width,Height);
tegb.Caption := _GetWideString(Caption);
tegb.Enabled := Enabled;
tegb.Visible := Visible;
ATabOrder := TabOrder;
tegb.Parent := Parent;
MoveChildren(TWinControl(Self.Components[i]), tegb);
OnCreateThemedControl(TControl(Self.Components[i]), tegb);
Free;
tegb.Loaded;
tegb.TabOrder := ATabOrder;
end
else if (Components[i] is TRadioGroup) then
with TRadioGroup(Components[i]) do begin
terg := TTeRadioGroup.Create(Self);
terg.SetBounds(Left,Top,Width,Height);
terg.Caption := _GetWideString(Caption);
terg.Enabled := Enabled;
terg.Visible := Visible;
ATabOrder := TabOrder;
terg.Parent := Parent;
terg.Columns := Columns;
for j := 0 to Items.Count-1 do
terg.Items.Add({_GetWideString}(Items[j]));
terg.ItemIndex := ItemIndex;
terg.OnClick := OnClick;
OnCreateThemedControl(TControl(Self.Components[i]), terg);
Free;
terg.Loaded;
terg.TabOrder := ATabOrder;
end
else if (Components[i] is TListBox) then
with TListBox(Components[i]) do begin
telst := TTeListBox.Create(Self);
telst.SetBounds(Left,Top,Width,Height);
telst.Enabled := Enabled;
telst.Visible := Visible;
ATabOrder := TabOrder;
telst.Parent := Parent;
for j := 0 to Items.Count-1 do
telst.Items.Add({_GetWideString}(Items[j]));
telst.ItemIndex := ItemIndex;
telst.OnClick := OnClick;
telst.OnDblClick := OnDblClick;
OnCreateThemedControl(TControl(Self.Components[i]), telst);
Free;
telst.Loaded;
telst.TabOrder := ATabOrder;
end
else if Components[i] is TLabel then
with TLabel(Components[i]) do begin
telbl := TTeLabel.Create(Self);
telbl.SetBounds(Left,Top,Width,Height);
telbl.Caption := _GetWideString(Caption);
telbl.Enabled := Enabled;
telbl.Visible := Visible;
telbl.FocusControl := FocusControl;
telbl.WordWrap := WordWrap;
telbl.Parent := Parent;
OnCreateThemedControl(TControl(Self.Components[i]), telbl);
telbl.Loaded;
Free;
end
else if (Components[i] is TComboBox) or
(Components[i] is TRVScroller) then begin
if ScrollAdapter=nil then
ScrollAdapter := TTeaScrollAdapter.Create(Self);
ScrollAdapter.AddControl(Components[i].Name);
end
else if Components[i] is TNoteBook then begin
if GetThemeLink(nil)<>nil then
TNoteBook(Components[i]).Color := GetThemeLink(nil).SysColors[TNoteBook(Components[i]).Color];
end
else if Components[i] is TPanel then begin
if GetThemeLink(nil)<>nil then
TPanel(Components[i]).Color := GetThemeLink(nil).SysColors[TPanel(Components[i]).Color];
end
else if Components[i] is TPageControl then
with TPageControl(Components[i]) do begin
tepc := TTePageControl.Create(Self);
tepc.SetBounds(Left,Top,Width,Height);
ATabOrder := TabOrder;
tepc.Parent := Parent;
for j := 0 to PageCount-1 do begin
tets := TTeTabSheet.Create(tepc);
tepc.AddPage(tets);
tets.PageIndex := Pages[j].PageIndex;
tets.Caption := Pages[j].Caption;
MoveChildren(Pages[j], tets);
end;
tepc.OnChange := OnChange;
OnCreateThemedControl(TControl(Self.Components[i]), tepc);
Free;
tepc.Loaded;
tepc.TabOrder := ATabOrder;
end;
end;
end;
{$ENDIF}
{$IFDEF USERVTNT}
procedure TfrmRVBase.ApplyTntControls;
var tntb: TTntButton;
tntbb: TTntBitBtn;
tntsb: TTntSpeedButton;
tntrb: TTntRadioButton;
tntcb: TTntCheckBox;
tntgb: TTntGroupBox;
tntcmb: TTntComboBox;
tnttxt: TTntEdit;
tntpc: TTntPageControl;
tntts: TTntTabSheet;
tntlbl: TTntLabel;
tntrg: TTntRadioGroup;
tntlst: TTntListBox;
i, j: Integer;
ATabOrder: Integer;
begin
for i := ComponentCount-1 downto 0 do begin
if not IsThemeAllowedFor(Components[i]) then
continue;
if Components[i] is TBitBtn then
with TBitBtn(Components[i]) do begin
tntbb := TTntBitBtn.Create(Self);
tntbb.SetBounds(Left,Top,Width,Height);
tntbb.Caption := _GetWideString(Caption);
tntbb.OnClick := OnClick;
tntbb.ModalResult := ModalResult;
tntbb.Glyph := Glyph;
tntbb.Hint := _GetWideString(Hint);
tntbb.ShowHint := ShowHint;
tntbb.Enabled := Enabled;
ATabOrder := TabOrder;
tntbb.Default := Default;
tntbb.Cancel := Cancel;
tntbb.Parent := Parent;
OnCreateThemedControl(TControl(Self.Components[i]), tntbb);
Free;
tntbb.TabOrder := ATabOrder;
end
else if Components[i] is TSpeedButton then
with TSpeedButton(Components[i]) do begin
tntsb := TTntSpeedButton.Create(Self);
tntsb.SetBounds(Left,Top,Width,Height);
tntsb.Caption := _GetWideString(Caption);
tntsb.OnClick := OnClick;
tntsb.Action := Action;
tntsb.Glyph := Glyph;
tntsb.Hint := _GetWideString(Hint);
tntsb.ShowHint := ShowHint;
tntsb.Enabled := Enabled;
tntsb.Flat := Flat;
tntsb.Parent := Parent;
OnCreateThemedControl(TControl(Self.Components[i]), tntsb);
Free;
end
else if Components[i] is TButton then
with TButton(Components[i]) do begin
tntb := TTntButton.Create(Self);
tntb.SetBounds(Left,Top,Width,Height);
tntb.Caption := _GetWideString(Caption);
tntb.OnClick := OnClick;
tntb.ModalResult := ModalResult;
tntb.Hint := _GetWideString(Hint);
tntb.ShowHint := ShowHint;
tntb.Enabled := Enabled;
ATabOrder := TabOrder;
tntb.Default := Default;
tntb.Cancel := Cancel;
tntb.Parent := Parent;
OnCreateThemedControl(TControl(Self.Components[i]), tntb);
Free;
tntb.TabOrder := ATabOrder;
end
else if Components[i].ClassName= 'TRadioButton' then
with TRadioButton(Components[i]) do begin
tntrb := TTntRadioButton.Create(Self);
tntrb.SetBounds(Left,Top,Width,Height);
tntrb.Caption := _GetWideString(Caption);
tntrb.Enabled := Enabled;
tntrb.Visible := Visible;
tntrb.Checked := Checked;
tntrb.OnClick := OnClick;
tntrb.Hint := _GetWideString(Hint);
tntrb.ShowHint := ShowHint;
ATabOrder := TabOrder;
tntrb.Parent := Parent;
OnCreateThemedControl(TControl(Self.Components[i]), tntrb);
Free;
tntrb.TabOrder := ATabOrder;
end
else if Components[i] is TCheckBox then
with TCheckBox(Components[i]) do begin
tntcb := TTntCheckBox.Create(Self);
tntcb.SetBounds(Left,Top,Width,Height);
tntcb.Caption := _GetWideString(Caption);
tntcb.Enabled := Enabled;
tntcb.Visible := Visible;
tntcb.State := State;
tntcb.OnClick := OnClick;
tntcb.Hint := _GetWideString(Hint);
tntcb.ShowHint := ShowHint;
ATabOrder := TabOrder;
tntcb.Parent := Parent;
OnCreateThemedControl(TControl(Self.Components[i]), tntcb);
Free;
tntcb.TabOrder := ATabOrder;
end
else if Components[i].ClassName='TEdit' then
with TEdit(Components[i]) do begin
tnttxt := TTntEdit.Create(Self);
tnttxt.SetBounds(Left,Top,Width,Height);
tnttxt.Text := _GetWideString(Text);
tnttxt.Enabled := Enabled;
tnttxt.Visible := Visible;
tnttxt.OnChange := OnChange;
tnttxt.OnExit := OnExit;
tnttxt.OnKeyPress := OnKeyPress;
tnttxt.Hint := _GetWideString(Hint);
tnttxt.ShowHint := ShowHint;
ATabOrder := TabOrder;
tnttxt.Parent := Parent;
OnCreateThemedControl(TControl(Self.Components[i]), tnttxt);
Free;
tnttxt.TabOrder := ATabOrder;
end
else if (Components[i].ClassName='TComboBox') then
with TComboBox(Components[i]) do begin
tntcmb := TTntComboBox.Create(Self);
tntcmb.SetBounds(Left,Top,Width,Height);
tntcmb.Enabled := Enabled;
tntcmb.Visible := Visible;
tntcmb.Parent := Parent;
for j := 0 to Items.Count-1 do
tntcmb.Items.Add(_GetWideString(Items[j]));
tntcmb.ItemIndex := ItemIndex;
tntcmb.Hint := _GetWideString(Hint);
tntcmb.ShowHint := ShowHint;
ATabOrder := TabOrder;
tntcmb.DropDownCount := DropDownCount;
tntcmb.Style := Style;
if Style = csOwnerDrawFixed then begin
tntcmb.ItemHeight := ItemHeight;
tntcmb.OnDrawItem := OnDrawItem;
end;
tntcmb.OnChange := OnClick;
tntcmb.OnExit := OnExit;
tntcmb.OnKeyDown := OnKeyDown;
OnCreateThemedControl(TControl(Self.Components[i]), tntcmb);
Free;
tntcmb.TabOrder := ATabOrder;
end
else if (Components[i] is TGroupBox) then
with TGroupBox(Components[i]) do begin
tntgb := TTntGroupBox.Create(Self);
tntgb.SetBounds(Left,Top,Width,Height);
tntgb.Caption := _GetWideString(Caption);
tntgb.Enabled := Enabled;
tntgb.Visible := Visible;
ATabOrder := TabOrder;
tntgb.Parent := Parent;
MoveChildren(TWinControl(Self.Components[i]), tntgb);
OnCreateThemedControl(TControl(Self.Components[i]), tntgb);
Free;
tntgb.TabOrder := ATabOrder;
end
else if (Components[i] is TRadioGroup) then
with TRadioGroup(Components[i]) do begin
tntrg := TTntRadioGroup.Create(Self);
tntrg.SetBounds(Left,Top,Width,Height);
tntrg.Caption := _GetWideString(Caption);
tntrg.Enabled := Enabled;
tntrg.Visible := Visible;
ATabOrder := TabOrder;
tntrg.Parent := Parent;
tntrg.Columns := Columns;
for j := 0 to Items.Count-1 do
tntrg.Items.Add(_GetWideString(Items[j]));
tntrg.ItemIndex := ItemIndex;
tntrg.OnClick := OnClick;
OnCreateThemedControl(TControl(Self.Components[i]), tntrg);
Free;
tntrg.TabOrder := ATabOrder;
end
else if (Components[i] is TListBox) then
with TListBox(Components[i]) do begin
tntlst := TTntListBox.Create(Self);
tntlst.SetBounds(Left,Top,Width,Height);
tntlst.Enabled := Enabled;
tntlst.Visible := Visible;
ATabOrder := TabOrder;
tntlst.Parent := Parent;
for j := 0 to Items.Count-1 do
tntlst.Items.Add(_GetWideString(Items[j]));
tntlst.ItemIndex := ItemIndex;
tntlst.OnClick := OnClick;
tntlst.OnDblClick := OnDblClick;
OnCreateThemedControl(TControl(Self.Components[i]), tntlst);
Free;
tntlst.TabOrder := ATabOrder;
end
else if Components[i] is TLabel then
with TLabel(Components[i]) do begin
tntlbl := TTntLabel.Create(Self);
tntlbl.WordWrap := WordWrap;
tntlbl.SetBounds(Left,Top,Width,Height);
tntlbl.Caption := _GetWideString(Caption);
tntlbl.Enabled := Enabled;
tntlbl.Visible := Visible;
tntlbl.FocusControl := FocusControl;
tntlbl.Parent := Parent;
OnCreateThemedControl(TControl(Self.Components[i]), tntlbl);
Free;
end
else if Components[i] is TPageControl then
with TPageControl(Components[i]) do begin
tntpc := TTntPageControl.Create(Self);
tntpc.SetBounds(Left,Top,Width,Height);
ATabOrder := TabOrder;
tntpc.Parent := Parent;
for j := 0 to PageCount-1 do begin
tntts := TTntTabSheet.Create(tntpc);
tntts.PageControl := tntpc;
tntts.PageIndex := Pages[j].PageIndex;
tntts.Caption := _GetWideString(Pages[j].Caption);
MoveChildren(Pages[j], tntts);
end;
tntpc.OnChange := OnChange;
OnCreateThemedControl(TControl(Self.Components[i]), tntpc);
Free;
tntpc.TabOrder := ATabOrder;
end;
end;
end;
{$ENDIF}
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -