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

•  DeLiKaTeS Tetris (Тетрис)  3 821

•  TDictionary Custom Sort  5 923

•  Fast Watermark Sources  5 727

•  3D Designer  8 514

•  Sik Screen Capture  6 064

•  Patch Maker  6 504

•  Айболит (remote control)  6 496

•  ListBox Drag & Drop  5 355

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

•  Графические эффекты  6 702

•  Рисование по маске  5 837

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

•  Canvas Drawing  5 253

•  Рисование Луны  4 976

•  Поворот изображения  4 523

•  Рисование стержней  3 205

•  Paint on Shape  2 447

•  Генератор кроссвордов  3 323

•  Головоломка Paletto  2 631

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

•  Пазл Numbrix  2 258

•  Заборы и коммивояжеры  2 919

•  Игра HIP  1 887

•  Игра Go (Го)  1 805

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

•  Программа укладки плитки  1 869

•  Генератор лабиринта  2 311

•  Проверка числового ввода  1 995

•  HEX View  2 306

•  Физический маятник  1 965

 
скрыть

  Форум  

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-2025 "Delphi Sources" by BrokenByte Software. Delphi World FAQ

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