Programalama > DELPHI

Etiketler: image, zoom

Ort. 0
Puan ver:
// variables
var Srect,Drect,PosForme:TRect;
    iWidth,iHeight,DmX,DmY:Integer;
    iTmpX,iTmpY:Real;
    C:TCanvas;
    hDesktop: Hwnd;
    Kursor:TPoint;
// Magnify screen iff app is not iconic
If not IsIconic(Application.Handle) then begin
// Get cursor coordinates
  GetCursorPos(Kursor);
  hDesktop:= GetDesktopWindow;
// PosForm represents the rectangle with the
// Form (image control) coordinates.
  PosForme:=Rect(Form1.Left,
                 Form1.Top,
                 Form1.Left+Form1.Width,
                 Form1.Top+Form1.Height);

//Show magnified screen //if cursor is outside the form.
  If not PtInRect(PosForme,Kursor) then begin

// Code below is used to magnify selected
// portion of the screen. With a few
// modifications you could use
// it to shrink the screen
  iWidth:=Image1.Width;
  iHeight:=Image1.Height;
  Drect:=Bounds(0,0,iWidth,iHeight);
  iTmpX:=iWidth / (Slider.Position * 4);
  iTmpY:=iHeight / (Slider.Position * 4);
  Srect:=
   Rect(Kursor.x,Kursor.y,Kursor.x,Kursor.y);
  InflateRect(Srect,Round(iTmpX),Round(iTmpY));

//Retrieve a handle of a desktop window.
  C:=TCanvas.Create;
  try
   C.Handle:=GetDC(GetDesktopWindow);
//Transfer part of the screen image on TImage.
   Image1.Canvas.CopyRect(Drect,C,Srect);
  finally
    ReleaseDC(hDesktop, C.Handle);
    C.Free;
  end;

  end;

// Be sure to process all Windows messages.
  Application.ProcessMessages;

end; // IsIconic



Yorumlar                 Yorum Yaz
Bu hazır kod'a ilk yorumu siz yapın!
KATEGORİLER
ASP - 240
ASP.NET - 24
C# - 75
C++ - 174
CGI - 8
DELPHI - 247
FLASH - 49
HTML - 536
PASCAL - 246
PERL - 11
PHP - 160
WML - 9
XML - 2
Copyright © 2002 - 2024 Hazır Kod - Tüm Hakları Saklıdır.
Siteden yararlanırken gizlilik ilkelerini okumanızı tavsiye ederiz.
hazirkod.com bir İSOBİL projesidir.