2022年8月17日 星期三
擴展QuckReport報表內容
報表內容過多過長, Report礙於報表的設計空間,開發階段不容易將報表元件放置到適當的位置。可以在Form上,放置多個QuickRep報表元件,在不同的QuickRep元件中利用ChildBand來設計,再用程式碼控制將ChildBand併到主報表裡做預覽。
uses QRPrntr;
type TQRPrintableExt=class(TQRPrintable);
procedure TForm1.pr_Reset_ParentReport(AChildBand:TQRChildBand; AParentBand:TQRCustomBand);
var i:Integer;
begin
AChildBand.Parent := AParentBand.ParentReport;
AChildBand.ParentBand := AParentBand;
for i := 0 to AChildBand.ControlCount-1 do
TQRPrintableExt(AChildBand.Controls[i]).ParentReport := AChildBand.ParentReport;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
pr_Reset_ParentReport(ChildBand1, DetailBand1);
pr_Reset_ParentReport(QRChildBand1, ChildBand1);
QuickRep1.Preview;
end;
2022年8月10日 星期三
TCategoryPanelGroup - MouseWheel : Not functional ?
//---------------
//Form MouseWheel
//---------------
procedure TForm.FormMouseWheel(Sender: TObject; Shift: TShiftState;
WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
begin
if PtInRect(CategoryPanelGroup1.BoundsRect, ScreenToClient(Mouse.CursorPos)) then
CategoryPanelGroup1MouseWheel(Sender, Shift, WheelDelta, MousePos, Handled);
end;
//Form MouseWheel
//---------------
procedure TForm.FormMouseWheel(Sender: TObject; Shift: TShiftState;
WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
begin
if PtInRect(CategoryPanelGroup1.BoundsRect, ScreenToClient(Mouse.CursorPos)) then
CategoryPanelGroup1MouseWheel(Sender, Shift, WheelDelta, MousePos, Handled);
end;
//-----------------------------
//CategoryPanelGroup MouseWheel
//-----------------------------
procedure TForm.CategoryPanelGroup1MouseWheel(Sender: TObject;
Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint;
var Handled: Boolean);
var
msg: Cardinal;
code: Cardinal;
i, n: Integer;
begin // Thanks to *Peter Below* for this code (adapted here)
Handled := true;
if ssShift in Shift then
msg := WM_HSCROLL
else
msg := WM_VSCROLL;
if WheelDelta > 0 then
code := SB_LINEUP
else
code := SB_LINEDOWN;
n:= Mouse.WheelScrollLines;
for i:= 1 to n do
CategoryPanelGroup1.Perform(msg, code, 0);
CategoryPanelGroup1.Perform(msg, SB_ENDSCROLL, 0);
end;
2022年8月2日 星期二
Excel Class Workbook 的 SaveAs 方法失敗
訂閱:
文章 (Atom)