Lower left corner of the pop-up window
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Timer1: TTimer; Button2: TButton; procedure Button1Click(Sender: TObject); procedure Timer1Timer(Sender: TObject); procedure Button2Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; PopForm:TForm; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); begin PopForm:=TForm.Create(self); PopForm.Width:=200; PopForm.Height:=150; PopForm.Name:='PopForm1'; PopForm.Left:=screen.Width-PopForm.Width; PopForm.Top:=screen.Height; PopForm.Show; Timer1.Interval:=200; Timer1.Enabled:=True; end; procedure TForm1.Timer1Timer(Sender: TObject); begin PopForm.Top:=PopForm.Top-10; if PopForm.Top<screen.Height-PopForm.Height then begin Timer1.Enabled:=False; PopForm.Free; end; end; procedure TForm1.Button2Click(Sender: TObject); var i,Tops:Integer; //定義幾個變量 begin PopForm:=TForm.Create(self); PopForm.Width:=200; PopForm.Height:= 150; PopForm.Show; // display message form PopForm.Left: = Screen.WorkAreaWidth; // positioned to the right to the desktop available area PopForm.Top:=Screen.WorkAreaHeight; // positioned to the bottom of the desktop area available Tops : = Screen.WorkAreaHeight - PopForm.Height; // draw the highest message window for I: = 0 to PopForm.Width do the begin // cycle width to whichever message form PopForm.Left: = PopForm.Left- . 1 ; IF PopForm.Top> Tops = the then // if the message is less than the height of the window continues to loop PopForm.Top:=PopForm.Top- . 1 ; Sleep ( . 1 ); Application.ProcessMessages; end; end; end.
Production gradually from the lower right of the screen that pops up a message box
Each Microsoft product, regardless of function or interface design will give us some surprises, such as OfficeXP, Office2003, Messenger interface design, has become the object of many trying to copy the software, Take Messenger, I have seen several sets software video conferencing network have borrowed its interface style. Some time ago because you want to add a shortcut prompt window on the original software, this requires prompt window when displayed more eye-catching appearance can cause the user's attention, does not affect the operation of the user display can be turned off. It is natural to think that the Messenger from the lower right corner of the screen pop-up message prompts gradually form, but I prefer the relative Messenger QQ2004 Olympic version of the color scheme, is going to steal more than just steal it, shortcut keys below the final prompt window effect: this form has the following characteristics: 1 , when the display is gradually from the bottom right corner of the screen that pops up; 2 , it is a non-title form, but it must allow users to move and change size, so use to Untitled form drag resizing technology; 3 , it is an irregular form, mainly circular top left and right lead angle, so as to create a profile form, and when changing the size of the window must be rebuilt; 4 , which has a title and a content display region color gradient, there are a few small dots of the title, using tricky when implementing the method, filled directly screenshot. Of course, the interface can steal the code you have to write honestly, here is the interface design and implementation code: article order: Western Digital - to provide professional domain name registration, web hosting services HTTP: // www.west263.com The above information and the body of the article is an integral part of, if you want to reprint this article, please keep the above information, thank you!
Look to the controls
procedure TForm1.FormCreate(Sender: TObject); begin BorderStyle := bsNone; Brush.Style := bsClear; end; unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, uMlStdCtrl, uMlSkinForm, uMlFormBorder, GR32_Image_ml, uMlSkinCtrls, uMlCustomButton, uMlSkinButton, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Button2: TButton; procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure FormResize(Sender: TObject); private { Private declarations } procedure DoVisible; procedure DoInvisible; public { Public declarations } end; var Form1: TForm1; FullRgn, ClientRgn, CtlRgn : THandle; implementation {$R *.dfm} procedure TForm1.DoInvisible; var AControl : TControl; A, Margin, X, Y, CtlX, CtlY : Integer; begin Margin := ( Width - ClientWidth ) div 2; //First, get form region FullRgn := CreateRectRgn(0, 0, Width, Height); //Find client area region X := Margin; Y := Height - ClientHeight - Margin; ClientRgn := CreateRectRgn( X, Y, X + ClientWidth, Y + ClientHeight ); //'Mask' out all but non-client areas CombineRgn( FullRgn, FullRgn, ClientRgn, RGN_DIFF ); //Now, walk through all the controls on the form and 'OR' them // into the existing Full region. for A := 0 to ControlCount - 1 do begin AControl := Controls[A]; if ( AControl is TWinControl ) or ( AControl is TGraphicControl ) then with AControl do begin if Visible then begin CtlX := X + Left; CtlY := Y + Top; CtlRgn := CreateRectRgn( CtlX, CtlY, CtlX + Width, CtlY + Height ); CombineRgn( FullRgn, FullRgn, CtlRgn, RGN_OR ); end; end; end; //When the region is all ready, put it into effect: SetWindowRgn(Handle, FullRgn, TRUE); end; procedure TForm1.Button1Click(Sender: TObject); begin //This button just toggles between transparent and not trans.. if Button1.Caption = 'Show Form' then begin DoVisible; Button1.Caption := 'Hide Form'; end else begin DoInvisible; Button1.Caption := 'Show Form'; end; end; procedure TForm1.Button2Click(Sender: TObject); begin Application.Terminate; end; procedure TForm1.FormCreate(Sender: TObject); begin DoInvisible; end; procedure TForm1.FormDestroy(Sender: TObject); begin //Clean up the regions we created DeleteObject(ClientRgn); DeleteObject(FullRgn); DeleteObject(CtlRgn); end; procedure TForm1.FormResize(Sender: TObject); begin if Button1.Caption = 'Show Form' then DoInvisible else DoVisible; end; procedure TForm1.DoVisible; begin //To restore complete visibility: FullRgn := CreateRectRgn(0, 0, Width, Height); CombineRgn(FullRgn, FullRgn, FullRgn, RGN_COPY); SetWindowRgn(Handle, FullRgn, TRUE); end; end.