Недавно добавленные исходники

•  Animation Loaders  807

•  DeLiKaTeS Tetris (Тетрис)  5 773

•  TDictionary Custom Sort  7 729

•  Fast Watermark Sources  7 408

•  3D Designer  10 630

•  Sik Screen Capture  7 943

•  Patch Maker  8 162

•  Айболит (remote control)  8 212

•  ListBox Drag & Drop  7 017

•  Доска для игры Реверси  100 389

•  Графические эффекты  8 286

•  Рисование по маске  7 661

•  Перетаскивание изображений  6 267

•  Canvas Drawing  6 641

•  Рисование Луны  6 564

•  Поворот изображения  5 721

•  Рисование стержней  4 660

•  Paint on Shape  3 362

•  Генератор кроссвордов  4 331

•  Головоломка Paletto  3 489

•  Теорема Монжа об окружностях  4 304

•  Пазл Numbrix  2 782

•  Заборы и коммивояжеры  3 711

•  Игра HIP  2 503

•  Игра Go (Го)  2 495

•  Симулятор лифта  2 890

•  Программа укладки плитки  2 323

•  Генератор лабиринта  3 049

•  Проверка числового ввода  2 554

•  HEX View  2 958

 
скрыть

  Форум  

Delphi FAQ - Часто задаваемые вопросы

| Базы данных | Графика и Игры | Интернет и Сети | Компоненты и Классы | Мультимедиа |
| ОС и Железо | Программа и Интерфейс | Рабочий стол | Синтаксис | Технологии | Файловая система |



Delphi Sources

Распечатать TImage




{1.}
uses 
  printers; 

procedure TForm1.Button1Click(Sender: TObject); 
var  
  ScaleX, ScaleY: Integer; 
  RR: TRect; 
begin 
  with Printer do 
  begin 
    BeginDoc; 
    // Mit BeginDoc wird ein Druckauftrag initiiert. 
    // The StartDoc function starts a print job. 
    try 
      ScaleX := GetDeviceCaps(Handle, logPixelsX) div PixelsPerInch; 
      ScaleY := GetDeviceCaps(Handle, logPixelsY) div PixelsPerInch; 
      // Informationen uber die Auflosung 
      // Retrieves information about the Pixels per Inch of the Printer. 
      RR := Rect(0, 0, Image1.picture.Width * scaleX, Image1.Picture.Height * ScaleY); 
      Canvas.StretchDraw(RR, Image1.Picture.Graphic); 
      // An die Auflosung anpassen 
      // Stretch to fit 

    finally 
      EndDoc;   //Methode EndDoc beendet den aktuellen Druckauftrag und schlie?t die 
      // Textdatei-Variable. 
      // Steht in finally - um auch bei Abbruch des Druckauftrages Papierausgabe 
      // sicherzustellen 
    end; 
  end; 
end;


{2.} 

// Based on posting to borland.public.delphi.winapi by Rodney E Geraghty, 8/8/97. 


procedure PrintBitmap(Canvas: TCanvas; DestRect: TRect; Bitmap: TBitmap); 
var 
  BitmapHeader: pBitmapInfo; 
  BitmapImage: Pointer; 
  HeaderSize: DWORD; 
  ImageSize: DWORD; 
begin 
  GetDIBSizes(Bitmap.Handle, HeaderSize, ImageSize); 
  GetMem(BitmapHeader, HeaderSize); 
  GetMem(BitmapImage, ImageSize); 
  try 
    GetDIB(Bitmap.Handle, Bitmap.Palette, BitmapHeader^, BitmapImage^); 
    StretchDIBits(Canvas.Handle, 
      DestRect.Left, DestRect.Top,    // Destination Origin 
      DestRect.Right - DestRect.Left, // Destination Width 
      DestRect.Bottom - DestRect.Top, // Destination Height 
      0, 0,                           // Source Origin 
      Bitmap.Width, Bitmap.Height,    // Source Width & Height 
      BitmapImage, 
      TBitmapInfo(BitmapHeader^), 
      DIB_RGB_COLORS, 
      SRCCOPY) 
  finally 
    FreeMem(BitmapHeader); 
    FreeMem(BitmapImage) 
  end 
end {PrintBitmap};








Copyright © 2004-2026 "Delphi Sources" by «SiteAnalyzer». Delphi World FAQ

Группа ВКонтакте