1 //1. Defining Messages2 procedureMyhidemessage (varmsg:tagmsg;varHandled:boolean);3 4 //2. Execute the message5 procedureTform2.myhidemessage (varmsg:tagmsg;varHandled:boolean);6 var7 Pt:tpoint;8 Bit:tbitmap;9 beginTen CaseMSG.message of OneWm_lbuttondown://left mouse button Press to display the virtual form A begin - //copy a picture of a main form -bit: = Tbitmap.Create; theBit. Width: =Width; -Bit. Height: =Height; -BITBLT (bit. Canvas.handle,0,0, Width, Height, GETWINDOWDC (Handle),0,0, srccopy); - //virtual Form Load Picture + Form1.Image1.Picture.Assign (bit); - //I'm here to make it easy for everyone to see the code is not used in try, everyone note when writing + bit. Free; A //set the size of a virtual form atform1.height:=Form2.height; -form1.width:=Form2.width; -form1.image1.align:=alclient; -form1.borderstyle:=Bsnone; - //Show Virtual Forms - form1.show; in //Set Transparency -form1.alphablend:=True; toform1.alphablendvalue:= -; + End; -Wm_mousemove://Mouse moves the virtual form root to move the begin * //Remove the mouse position $ GetCursorPos (PT);Panax Notoginsengcaption:='x coordinate:'+inttostr (Pt. X) +'y-coordinate:'+IntToStr (Pt. Y); - //set the location of a virtual form theform1.top:=Pt. Y; +form1.left:=Pt. X; A End; theWm_lbuttonup://left mouse button to jump from virtual form to hide + begin - form1.hide; $ End; $ End; - End;
Mouse Drag Phantom effect