Hirdetés
- Sony MILC fényképezőgépcsalád
- Steam Deck
- AMD K6-III, és minden ami RETRO - Oldschool tuning
- Mini PC
- Pánik a memóriapiacon
- Apple MacBook
- Szeretne nagyobb versenyt a Microsoft, de nem szeretne túl sok gyártót a piacon
- Milyen videókártyát?
- Azonnali fotós kérdések órája
- AMD Ryzen 9 / 7 / 5 9***(X) "Zen 5" (AM5)
Új hozzászólás Aktív témák
-
tusi74
őstag
Eddig én is eljutottam, csak nem jövök, rá, melyik kódot hová kell
copy-paste-zni, hogy működjön.
Eddig, ha így szereztem kódot, akkor egyértelmű volt, hogy melyik eseményhez
melyik eljárást kell írni. De most pl. Van külön type stb, és nem tudom beilleszteni
az én programomba.
type
TrecPrintStrGrid = Record
PrCanvas : TCanvas; //Printer or PaintBox Canvas
sGrid: TStringGrid; //StringGrid containing data
sTitle: String; //Title of document
bPrintFlag : Boolean; //Print if True
ptXYOffset : TPoint; //Left and Top margins
ftTitleFont : TFont; //Font for Title
ftHeadingFont : TFont; //Font for Heading row
ftDataFont : TFont; //Font for Data
bBorderFlag : Boolean //Print border if True
end;
var
recPrintStrGrid : TrecPrintStrGrid;
procedure PrintGrid(ArecPrintStrGrid : TrecPrintStrGrid);
var
iX1, iX2, iY1, iY2, iY3, iTmp , iLoop, iWd : Integer;
trTextRect : TRect;
begin
iWd := 0;
with ArecPrintStrGrid, PrCanvas do
begin
//Calculate Total Width of String Grid
Font := ftHeadingFont;
for iLoop := 0 to sGrid.ColCount-1 do
begin
if (TextWidth(sGrid.Cells[iLoop, 0])+5) < sGrid.ColWidths[iLoop] then
iWd := iWd + sGrid.ColWidths[iLoop]
else
iWd := iWd + TextWidth(sGrid.Cells[iLoop, 0])+5;
end; // for sGrid.ColCount
//Initialize Printer
if bPrintFlag then
begin
Printer.Title := sTitle;
Printer.BeginDoc;
end;
//Output Title
Pen.Color := clBlack;
Font := ftTitleFont;
TextOut(((iWd Div 2) - (TextWidth(sTitle) Div 2)), ptXYOffset.Y, sTitle);
//Output Column Data
for iLoop := 0 to sGrid.ColCount-1 do
begin
Font := ftHeadingFont;
iX1 := ptXYOffset.X;
for iTmp := 0 to (iLoop-1) do
if (TextWidth(sGrid.Cells[iTmp, 0])+5) < (sGrid.ColWidths[iTmp]) then
iX1 := iX1 + (sGrid.ColWidths[iTmp])
else
iX1 := iX1 + TextWidth(sGrid.Cells[iTmp, 0])+5;
iY1 := ptXYOffset.Y + ((TextHeight('Ag')+5) * 2);
iX2 := ptXYOffset.X;
for iTmp := 0 to iLoop do
if (TextWidth(sGrid.Cells[iTmp, 0])+5) < (sGrid.ColWidths[iTmp]) then
iX2 := iX2 + (sGrid.ColWidths[iTmp])
else
iX2 := iX2 + TextWidth(sGrid.Cells[iTmp, 0])+5;
iY2 := iY1 + TextHeight('Ag');
trTextRect := Rect(iX1, iY1, iX2, iY2);
TextRect(trTextRect, trTextRect.Left+5, trTextRect.Top+3, sGrid.Cells[iLoop, 0]);
Brush.Color := clWhite;
if bBorderFlag then FrameRect(trTextRect);
Brush.Style := bsClear;
//Output Row Data
Font := ftDataFont;
iY1 := iY2;
iY3 := TextHeight('Ag')+5;
for iTmp := 1 to sGrid.RowCount-1 do
begin
iY2 := iY1 + iY3;
trTextRect := Rect(iX1, iY1, iX2, iY2);
TextRect(trTextRect, trTextRect.Left+5, trTextRect.Top+3, sGrid.Cells[iLoop, iTmp]);
Brush.Color := clBlack;
if bBorderFlag then FrameRect(trTextRect);
Brush.Style := bsClear;
iY1 := iY1 + iY3;
end; // for sGrid.RowCount-1 do
end; // for sGrid.ColCount-1
if bPrintFlag then Printer.EndDoc;
end; // with ArecPrintStrGrid, prCanvas
end; { PrintGrid }
procedure TfrmSamp.buPrintClick(Sender: TObject);
begin
with recPrintStrGrid do
begin
PrCanvas := pbPreview.Canvas;
sGrid := stgData;
sTitle := 'Print of String Grid';
bPrintFlag := False;
ptXYOffset.X := 10;
ptXYOffset.Y := 100;
ftTitleFont := TFont.Create;
with ftTitleFont do
begin
Name := 'Arial';
Style := [fsBold, fsItalic, fsUnderLine];
Size := 14;
end;
ftHeadingFont := TFont.Create;
with ftHeadingFont do
begin
Name := 'Arial';
Style := [fsBold];
Size := 12;
end;
ftDataFont := TFont.Create;
with ftDataFont do
begin
Name := 'Arial';
Style := [];
Size := 10;
end;
bBorderFlag := True;
end; //with recPrintStrGrid do
PrintGrid(recPrintStrGrid);
end;
Új hozzászólás Aktív témák
- Hivatalos a OnePlus 13 startdátuma
- Sütés, főzés és konyhai praktikák
- Háztartási gépek
- V.Milán: Lapdiffúzor nyomáseloszlása: gondoltad volna?
- Gurulunk, WAZE?!
- Sony MILC fényképezőgépcsalád
- Villanyszerelés
- PlayStation 5
- Diablo II: Classic és Resurrected
- Álláskeresés, interjú, önéletrajz
- További aktív témák...
- Xiaomi Redmi 15 128GB, Kártyafüggetlen, 1 Év Garanciával
- Samsung,Dell,iiyama,LG,BenQ,AOC monitorok,garancia,számla,22-24",IPS,TN,W-LED,HD,FHD,FHD+
- Samsung Galaxy A56 5G 256GB, Kártyafüggetlen, 1 Év Garanciával
- GIGABYTE AORUS FO32U2 Monitor(oled,4k,240hz)+ monitor arm
- 27% - MSI RTX 4060 Ti VENTUS 3X OC 8GB GDDR6X Videokártya!
- BESZÁMÍTÁS! ASRock Fatal1ty Z97 Killer alaplap garanciával hibátlan működéssel
- ÁRCSÖKKENTÉS Menő retró konfig: Q9550, Gigabyte P43, 4GB RAM, ASUS GT730
- Bomba ár! Dell Latitude 5490 - i5-8GEN I 16GB I 256GB SSD I 14" FHD I HDMI I Cam I W10 I Gari!
- LG 27UN880-B - 27" IPS ERGO - 3840x2160 4K - 60Hz - DisplayHDR 400 - USB Type-C - AMD FreeSync - Mac
- AKCIÓ! Apple Mac Studio M1 MAX 2022 32GB 512GB számítógép garanciával, hibátlan működéssel
Állásajánlatok
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest
Cég: Laptopműhely Bt.
Város: Budapest


