kevinward66
asked on
screen
how can i flip the screen vertically, horizontally and return it back to normal?
ASKER
this is EXCELLENT, but PLEASE let me explain more, i am sorry, i should have given you more detail at the start of the question
this is what i would ideally like, if its possible!
button 1 = flip screen horizontally
button 2 = flip screen vertically
button 3 = return screen to normal
ONCE AGAIN I AM SORRY, FOR NOT GIVING MORE DETAIL AT THE START!!! :-(
this is what i would ideally like, if its possible!
button 1 = flip screen horizontally
button 2 = flip screen vertically
button 3 = return screen to normal
ONCE AGAIN I AM SORRY, FOR NOT GIVING MORE DETAIL AT THE START!!! :-(
you can not use button after you flip the screen but only to click on a mouse.
ASKER
ok, well can you provide the code that flips the screen BOTH horizontally & vertically
as the current code only flips it one way
as the current code only flips it one way
you can not use button after you flip the screen but only to click on a mouse.
verticaly and hor
look at the start button there it is it should be in upper right corner
look at the start button there it is it should be in upper right corner
i meant my code already flips the screen vertically and horizontally
if it works give me the points
hello kevinward66 , , your question and explanation are not clear to me, you ask to flip the screen in your question and then you say
button 1 = flip screen horizontally
button 2 = flip screen vertically
button 3 = return screen to normal
but you don't say what buttons you are refering to. . you can flip an Image of the screen but it is Only an Image, it is NOT a working Desktop screen where you can click the flipped program's buttons and have them work, however you could use the onClick event to do all the flips and then close the app. Here is some code for that
unit Flip1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormClick(Sender: TObject);
private
{ Private declarations }
FlipNum: Byte;
Rect1: TRect;
ScreenBmp: TBitmap;
procedure WMEraseBkgnd (var Msg : TMessage); message WM_ERASEBKGND;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
begin
FlipNum := 0;
Top := 0;
Left := 0;
Width := Screen.Width;
Height := Screen.Height;
BorderStyle := bsNone;
Rect1 := Rect(0,0,Width,Height);
ScreenBmp := TBitmap.Create;
ScreenBmp.Width := Width;
ScreenBmp.Height := Height;
end;
procedure TForm1.FormClick(Sender: TObject);
begin
{each click of the screen increases FlipNum
and flips the screen and then Closes the app}
case FlipNum of
0: begin
{I use BitBlt because it is faster but you can use CopyRect}
BitBlt(ScreenBmp.Canvas.Ha ndle, 0, 0, Width, Height,
Form1.Canvas.Handle, 0, 0, SRCCOPY);
Canvas.CopyRect(rect(0,Hei ght,Width, 0),ScreenB mp.Canvas, rect1);
Inc(FlipNum);
end;
1: begin
Canvas.CopyRect(rect(Width ,0,0,Heigh t),ScreenB mp.Canvas, rect1);
Inc(FlipNum);
end;
2: begin
Canvas.CopyRect(rect1,Scre enBmp.Canv as,rect1);
Inc(FlipNum);;
end;
3: Close;
else Close;
end;
end;
procedure TForm1.WMEraseBkGnd;
begin
{this prevents this app from erasing the screen}
Msg.Result := 0;
end;
end.
- - - - - - - - - - - - - - - - - - - - - - - -
if you want to use buttons, I can also do that with a timer, let me know.
button 1 = flip screen horizontally
button 2 = flip screen vertically
button 3 = return screen to normal
but you don't say what buttons you are refering to. . you can flip an Image of the screen but it is Only an Image, it is NOT a working Desktop screen where you can click the flipped program's buttons and have them work, however you could use the onClick event to do all the flips and then close the app. Here is some code for that
unit Flip1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormClick(Sender: TObject);
private
{ Private declarations }
FlipNum: Byte;
Rect1: TRect;
ScreenBmp: TBitmap;
procedure WMEraseBkgnd (var Msg : TMessage); message WM_ERASEBKGND;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
begin
FlipNum := 0;
Top := 0;
Left := 0;
Width := Screen.Width;
Height := Screen.Height;
BorderStyle := bsNone;
Rect1 := Rect(0,0,Width,Height);
ScreenBmp := TBitmap.Create;
ScreenBmp.Width := Width;
ScreenBmp.Height := Height;
end;
procedure TForm1.FormClick(Sender: TObject);
begin
{each click of the screen increases FlipNum
and flips the screen and then Closes the app}
case FlipNum of
0: begin
{I use BitBlt because it is faster but you can use CopyRect}
BitBlt(ScreenBmp.Canvas.Ha
Form1.Canvas.Handle, 0, 0, SRCCOPY);
Canvas.CopyRect(rect(0,Hei
Inc(FlipNum);
end;
1: begin
Canvas.CopyRect(rect(Width
Inc(FlipNum);
end;
2: begin
Canvas.CopyRect(rect1,Scre
Inc(FlipNum);;
end;
3: Close;
else Close;
end;
end;
procedure TForm1.WMEraseBkGnd;
begin
{this prevents this app from erasing the screen}
Msg.Result := 0;
end;
end.
- - - - - - - - - - - - - - - - - - - - - - - -
if you want to use buttons, I can also do that with a timer, let me know.
Oh, I forgot to add this
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
FreeAndNil(ScreenBmp);
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
FreeAndNil(ScreenBmp);
end;
ASKER
i will try this and get back to you, thanks for your help
ASKER
this code is EXCELLENT, but instead of clicking on the screen each time to get the screen to move to the different positions, can you put each screen movement into a button click procedure.
thanks, SORRY to mess u around!!! :-(
thanks, SORRY to mess u around!!! :-(
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Listening...
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, jpeg;
type
TForm1 = class(TForm)
Image1: TImage;
Image2: TImage;
procedure FormShow(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Image1Click(Sender: TObject);
private
{ Private declarations }
public
can:Tcanvas;
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.FormShow(Sender: TObject);
var
y:integer;
begin
y:=0;
for y:=0 to can.ClipRect.bottom do
begin
image1.Canvas.CopyRect(rec
end;
with(image1)do
for y:=0 to Canvas.ClipRect.Right do
begin
image2.Canvas.CopyRect(rec
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
borderstyle:=bsnone;
formstyle:=fsstayontop;
image1.Align:=alclient;
image2.Align:=alclient;
left:=0;
top:=0;
height:=screen.height;
width:=screen.width;
can:=Tcanvas.create;
can.handle:=getdc(0);
end;
procedure TForm1.Image2Click(Sender:
begin
close;
end;
end.