Hi I hope someone can help me with this as I am a total newbie (no programming experience at all) I got a copy of delphi 7 personal and decided to build a cd cover prog, everthing seems to work good except for one problem the covers all print at 100 mm * 100 mm,instesd of the original size,I have included the code for you to look at, thanks in advance
Jim
-----------------------------------------------------------------------
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, LMDControl, LMDBaseControl, LMDBaseGraphicControl, LMDBaseLabel,
LMDInformationLabel, WinSkinData, WinSkinForm, LMDGraphicControl,
LMDBaseImage, LMDCustomLImage, LMDLImage, ExtCtrls, LMDCustomLabel,
LMDLabel, LMDScrollText, LMDBaseGraphicButton, LMDCustomShapeButton,
LMDShapeButton, LMDBaseShape, LMDRepeatedShape, Menus, jpeg,
LMDCustomControl, LMDCustomPanel, LMDCustomBevelPanel,
LMDCustomParentPanel, LMDBackPanel, LMDCustomComponent,
LMDContainerComponent, LMDBaseDialog, LMDTipDlg, ExtDlgs;
type
TForm1 = class(TForm)
WinSkinForm1: TWinSkinForm;
SkinData1: TSkinData;
LMDShapeButton1: TLMDShapeButton;
LMDShapeButton2: TLMDShapeButton;
Image1: TImage;
Image2: TImage;
LMDBackPanel1: TLMDBackPanel;
PrintDialog1: TPrintDialog;
OpenPictureDialog1: TOpenPictureDialog;
procedure LMDShapeButton1Click(Sender: TObject);
procedure Image1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
uses
Printers;
procedure TForm1.LMDShapeButton1Click(Sender: TObject);
Var
ScaleX, ScaleY: Integer;
RR: TRect;
begin
with Printer do
begin
BeginDoc;
try
ScaleX := GetDeviceCaps(Handle, logPixelsX) div PixelsPerInch;
ScaleY := GetDeviceCaps(Handle, logPixelsY) div PixelsPerInch;
RR := Rect(0, 0, Image1.picture.Width * scaleX, Image1.Picture.Height * ScaleY);
Canvas.StretchDraw(RR, Image1.Picture.Graphic);
finally
EndDoc;
end;
end;
end;
procedure TForm1.Image1Click(Sender: TObject);
begin
if OpenPictureDialog1.Execute then
try
Image1.Picture.LoadFromFile(OpenPictureDialog1.FileName);
except end;
end;
end.
Jim
-----------------------------------------------------------------------
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, LMDControl, LMDBaseControl, LMDBaseGraphicControl, LMDBaseLabel,
LMDInformationLabel, WinSkinData, WinSkinForm, LMDGraphicControl,
LMDBaseImage, LMDCustomLImage, LMDLImage, ExtCtrls, LMDCustomLabel,
LMDLabel, LMDScrollText, LMDBaseGraphicButton, LMDCustomShapeButton,
LMDShapeButton, LMDBaseShape, LMDRepeatedShape, Menus, jpeg,
LMDCustomControl, LMDCustomPanel, LMDCustomBevelPanel,
LMDCustomParentPanel, LMDBackPanel, LMDCustomComponent,
LMDContainerComponent, LMDBaseDialog, LMDTipDlg, ExtDlgs;
type
TForm1 = class(TForm)
WinSkinForm1: TWinSkinForm;
SkinData1: TSkinData;
LMDShapeButton1: TLMDShapeButton;
LMDShapeButton2: TLMDShapeButton;
Image1: TImage;
Image2: TImage;
LMDBackPanel1: TLMDBackPanel;
PrintDialog1: TPrintDialog;
OpenPictureDialog1: TOpenPictureDialog;
procedure LMDShapeButton1Click(Sender: TObject);
procedure Image1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
uses
Printers;
procedure TForm1.LMDShapeButton1Click(Sender: TObject);
Var
ScaleX, ScaleY: Integer;
RR: TRect;
begin
with Printer do
begin
BeginDoc;
try
ScaleX := GetDeviceCaps(Handle, logPixelsX) div PixelsPerInch;
ScaleY := GetDeviceCaps(Handle, logPixelsY) div PixelsPerInch;
RR := Rect(0, 0, Image1.picture.Width * scaleX, Image1.Picture.Height * ScaleY);
Canvas.StretchDraw(RR, Image1.Picture.Graphic);
finally
EndDoc;
end;
end;
end;
procedure TForm1.Image1Click(Sender: TObject);
begin
if OpenPictureDialog1.Execute then
try
Image1.Picture.LoadFromFile(OpenPictureDialog1.FileName);
except end;
end;
end.