среда, 28 октября 2009 г.

emf

-    pOut->SetWinOrg( Point( FRound( ( (double) rclFrame.Left() * nPixX ) / ( nMillX * 100.0 ) ),
  -                                FRound( ( (double) rclFrame.Top() * nPixY ) / ( nMillY * 100.0 ) ) ) );
  -    Size aRefSize( FRound( ( (double)rclFrame.GetWidth() * nPixX ) / ( nMillX * 100.0 ) ),
  -                            FRound( ( (double) rclFrame.GetHeight() * nPixY ) / ( nMillY * 100.0 ) ) );


' Get the screen width / height in pixels
  ScreenWidth = GetDeviceCaps(hScreenDC, HORZRES)
  ScreenHeight = GetDeviceCaps(hScreenDC, VERTRES)
 
  ' Get the physical width / height of the screen in millimeters
  TempH = GetDeviceCaps(hScreenDC, VERTSIZE)
  TempW = GetDeviceCaps(hScreenDC, HORZSIZE)
 
  ' Get the TwipsPerPixelX & TwipsPerPixelY (There are 56.7 twips per millimeter)
  TwipsX = CSng((56.7 * TempW) / ScreenWidth)
  TwipsY = CSng((56.7 * TempH) / ScreenHeight)


pOut->SetWinOrg( Point( FRound( ( (double) rclFrame.Left() * nPixX ) / ( nMillX * 100.0 ) ),
  -                                FRound( ( (double) rclFrame.Top() * nPixY ) / ( nMillY * 100.0 ) ) ) );
  -    Size aRefSize( FRound( ( (double)rclFrame.GetWidth() * nPixX ) / ( nMillX * 100.0 ) ),
  -                            FRound( ( (double) rclFrame.GetHeight() * nPixY ) / ( nMillY * 100.0 ) ) );
***************************************************************************************
http://www.delphimaster.ru/cgi-bin/forum.pl?id=1212651799&n=7&toprint=1

??? ???? ??? ???????:
     begin     { convert 0.01mm units to referenceDC device pixels }
       GetEnhMetaFileHeader(FHandle, Sizeof(EMFHeader), @EMFHeader);
       Result := MulDiv(FWidth,                      { metafile width in 0.01mm }
         EMFHeader.szlDevice.cx,                      { device width in pixels }
         EMFHeader.szlMillimeters.cx*100);            { device width in 0.01mm }
     end
FWidth/FHeight ?????????? ?? EMFHeader.rclFrame.
****************************************************************************************

Procedure TForm1.GetPrinterInfo; { ???????? ?????????? ? ???????? }
begin
  PixelsX:=GetDeviceCaps(printer.Handle,LogPixelsX);
  PixelsY:=GetDeviceCaps(printer.Handle,LogPixelsY);
end;

Function TForm1.PrinterCoordX(x:integer):integer; { ????????? ?????????? ?? ?? ? ??????? }
begin
 PrinterCoordX:=round(PixelsX/25.4*x);
end;

Function TForm1.PrinterCoordY(Y:integer):integer; { ????????? ?????????? ?? ?? ? ??????? }
begin
 PrinterCoordY:=round(PixelsY/25.4*Y);
end;

Комментариев нет:

Отправить комментарий