uses QRPrev, XPMenu;
Screen.OnActiveFormChange := FormColorControl;
procedure TMainForm.FormColorControl(Sender: TObject);
var
i, mycount: integer;
xp: TXPMenu;
begin
begin
if Screen.ActiveForm = nil then
exit;
with Screen.ActiveFormdo
begin
for i := 0 to ComponentCount - 1do
begin
if Components is TXPMenu then
exit;
end;
if Screen.ActiveForm is TQRStandardPreview then
begin
with TQRStandardPreview(Screen.ActiveForm)do
begin
Caption := self.Caption + ' —— 打印预览';
ZoomFit.Hint:='整页';
ZoomToWidth.Hint:='页面宽度';
ExitButton.Caption := '退出';
FirstPage.Hint := '第一页';
PreviousPage.Hint := '上一页';
ToolButton2.Hint := '下一页';
LastPage.Hint := '最后一页';
PrintSetup.Hint := '设置打印机';
Print.Hint := '打印';
SaveReport.hint := '保存报告';
LoadReport.hint := '读取报告';
xp := TXPMenu.Create(Screen.ActiveCustomForm);
xp.XPControls := [xcPopupMenu, xcToolbar];
xp.AutoDetect := false;
xp.Active := true;
end;
end
else
begin
xp := TXPMenu.Create(Screen.ActiveCustomForm);
xp.XPControls:=[xcMainMenu, xcPopupMenu, xcCheckBox, xcRadioButton, xcButton, xcBitBtn, xcSpeedButton];
xp.AutoDetect := false;
xp.Active := true;
end;
end;
end;
end;