to cequal:
其实就是屏幕图象的反置问题!
给你编了个小程序,你参考一下。
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
ScrollBox1: TScrollBox;
Image1: TImage;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
DeskCanvas :TCanvas;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var
Bmp :TBitmap;
DeskDC :HDC;
begin
DeskDC :=GetDC(0);
DeskCanvas :=TCanvas.Create;
DeskCanvas.Handle :=DeskDC;
Bmp :=TBitmap.Create;
Bmp.PixelFormat :=pf24Bit;
Bmp.Width :=Screen.Width;
Bmp.Height :=Screen.Height;
BitBlt(Bmp.Canvas.Handle,0,0,Bmp.Width,Bmp.Height,DeskCanvas.Handle,0,0,SRCCOPY);
Image1.Picture.Bitmap.Assign(Bmp);
Bmp.Free;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
Bmp1,Bmp2 :TBitmap;
I,J :Integer;
p1,p2
ByteArray;
begin
Bmp1 :=TBitmap.Create;
Bmp1.PixelFormat :=pf24Bit;
Bmp1.Assign(Image1.Picture.Bitmap);
Bmp2 :=TBitmap.Create;
Bmp2.PixelFormat :=pf24Bit;
Bmp2.Assign(Bmp1);
for J :=0 to Bmp1.Height-1 do
begin
p1 :=Bmp1.ScanLine[J];
p2 :=Bmp2.ScanLine[Bmp1.Height-1-J];
for I :=0 to Bmp1.Width-1 do
begin
p2[3*I+2] :=p1[3*I+2];
p2[3*I+1] :=p1[3*I+1];
p2[3*I] :=p1[3*I];
end;
end;
Image1.Picture.Bitmap.Assign(Bmp2);
Bmp1.Free;
Bmp2.Free;
end;
end.