Вниз
Скачать: CL | DM;

Копирование экрана   Найти похожие ветки 

← →
Asker   (2007-12-10 19:55) [0]

Подскажите почему код описанный тут:
http://www.delphimaster.ru/cgi-bin/faq.pl?look=1&id=16-988625471
дает на одних компах черный прямоугольник, а на других нормально работает??


← →
Palladin ©   (2007-12-10 20:10) [1]

объяснять не хочу, потому что по ссылке все слишком жестоко деформатировано...

type
 TDesktopCanvas = class(TCanvas)
 private
   DC : hDC;
   function     GetWidth:Integer;
   function     GetHeight:Integer;
 public
   constructor  Create;
   destructor   Destroy; override;
 published
   property Width: Integer read GetWidth;
   property Height: Integer read GetHeight;
 end;

function TDesktopCanvas.GetWidth:Integer;
begin
 Result:=GetDeviceCaps(Handle,HORZRES);
end;

function TDesktopCanvas.GetHeight:Integer;
begin
 Result:=GetDeviceCaps(Handle,VERTRES);
end;

constructor TDesktopCanvas.Create;
begin
 inherited Create;
 DC := GetDC(GetDesktopWindow);
 Handle := DC;
end;

destructor TDesktopCanvas.Destroy;
begin
 ReleaseDC(Handle, DC);
 inherited Destroy;
end;

Procedure SaveScreen(Const p_strFileName:String);
Var
 d:TDesktop
 b:TBitmap;
Begin
 b:=TBitmap.Create;
 d:=TDesktopCanvas.Create(Nil);
 b.Width:=d.Width;
 b.Height:=d.Height;
 d.CopyRect(Rect(0,0,d.Width,d.Height),b.Canvas,Rect(0,0,d.Width,d.Height));
 d.Free;
 b.SaveToFile(p_strFileName);
 b.Free;
End;



← →
имя   (2008-01-31 14:36) [2]

Удалено модератором


← →
Style ©   (2008-02-01 16:54) [3]

А по ссылке не работает возможно потому, что палитры в том режиме,в котором работает ОС , просто нет. 32 бита на цвет.

а функция
function CaptureScreenRect(ARect : TRect) : TBitmap;
копирует экран нормально,

только вот потом
Palette:=GetSystemPalette;
палитра сбрасывается в 0, и получается черный квадрат.



Страницы: 1 вся ветка

Скачать: CL | DM;



Память: 0.45 MB
Время: 0.01 c
2-1222452838
programmer90
2008-09-26 22:13
2008.11.02
А что под маской?


1-1202143624
Сергей
2008-02-04 19:47
2008.11.02
Duplicate resource


2-1221827378
Matveih1
2008-09-19 16:29
2008.11.02
Работа с DBGried.


1-1201897002
elserpiente
2008-02-01 23:16
2008.11.02
ListView


15-1220695354
AlexDan
2008-09-06 14:02
2008.11.02
Диски..




   Наверх