Autor Beitrag
Flamefire
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1207
Erhaltene Danke: 31

Win 10
Delphi 2009 Pro, C++ (Visual Studio)
BeitragVerfasst: Mo 14.05.07 11:17 
1.) wie kann ich einen teil des aktuellen screens in eine TBitmap umwandeln?
2.) wie kann ich eine JPG laden und in eine TBitmap umwandeln?

Danke
Horst_H
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1654
Erhaltene Danke: 244

WIN10,PuppyLinux
FreePascal,Lazarus
BeitragVerfasst: Mo 14.05.07 15:49 
Hallo,

Wegen screenshot:
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
procedure MakeScreenShot(const ATarget: TBitmap);
var
  DesktopDC: HDC;
begin
  DesktopDC := CreateDC('DISPLAY', nil, nil, nil);
  try
    ATarget.PixelFormat := pf32bit;
    ATarget.Width := Screen.Width;
    ATarget.Height := Screen.Height;
    with Atarget do
      BitBlt(Canvas.Handle, 0, 0, Width, Height, DesktopDC, 0, 0, SRCCOPY);
  finally
    DeleteDC(DesktopDC);
  end;
end;

procedure MakeFormShot(const ATarget: TBitmap);
begin
  ATarget.PixelFormat := pf32bit;
  ATarget.Width := Form1.Width;
  ATarget.Height := Form1.Height;
  with Atarget do
    BitBlt(Canvas.Handle, 0, 0, Width, Height, Form1.Canvas.Handle, 0, 0, SRCCOPY);
end;

procedure MakeMemoshot(const ATarget: TBitmap);
begin
  ATarget.PixelFormat := pf32bit;
  ATarget.Width := Form1.Memo1.Width;
  ATarget.Height := Form1.Memo1.Height;
  with Atarget do
    BitBlt(Canvas.Handle, 0, 0, Width, Height, Form1.Canvas.Handle, Form1.Memo1.Left, Form1.Memo1.Top, SRCCOPY);
end;


Die Massangaben in BitBlt kennst Du sicher , um auch nur Teile zu kopieren siehe MakeMemoshot(const ATarget: TBitmap);

Für jpg muß jemand anderes etwas zum besten geben. EIDT:
www.wlsoft.de/delphi/index_0007.html

Gruß Horst

Moderiert von user profile iconraziel: Code- durch Delphi-Tags ersetzt
Flamefire Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1207
Erhaltene Danke: 31

Win 10
Delphi 2009 Pro, C++ (Visual Studio)
BeitragVerfasst: Mo 14.05.07 16:17 
Kannste kurz genauer erklären was deine Prozedur wo macht?
ich will einen ausschnitt aus dem aktuellem Bildschirm (nicht uas dem Formular) als Bitmap haben...
wie mach ich das mit deiner Prozedur? sry seh ne durch