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

•  DeLiKaTeS Tetris (Тетрис)  257

•  TDictionary Custom Sort  3 405

•  Fast Watermark Sources  3 158

•  3D Designer  4 917

•  Sik Screen Capture  3 411

•  Patch Maker  3 616

•  Айболит (remote control)  3 817

•  ListBox Drag & Drop  3 079

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

•  Графические эффекты  4 016

•  Рисование по маске  3 314

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

•  Canvas Drawing  2 828

•  Рисование Луны  2 641

•  Поворот изображения  2 252

•  Рисование стержней  2 193

•  Paint on Shape  1 592

•  Генератор кроссвордов  2 273

•  Головоломка Paletto  1 791

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

•  Пазл Numbrix  1 701

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

•  Игра HIP  1 297

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

•  Симулятор лифта  1 494

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

•  Генератор лабиринта  1 567

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

•  HEX View  1 515

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

 
скрыть


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

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