一个模式窗口显示时,当鼠标在窗口外点击时,模式窗口自动关闭,FORM上放有全部显示的PANEL组件,现全部分数献上,不够有分时补贴给(现可补贴110分) (20

  • 主题发起人 主题发起人 ryanlee
  • 开始时间 开始时间
R

ryanlee

Unregistered / Unconfirmed
GUEST, unregistred user!
一个模式窗口显示时,当鼠标在窗口外点击时,模式窗口自动关闭,FORM上放有全部显示的PANEL组件,现全部分数献上,不够有分时补贴给(现可补贴110分) (20分)<br />我有一个模式窗口显示在主窗口之上,当鼠标在模式窗口外点击时,模式窗口自动关闭,<br>(FORM上有全部占据显示的PANEL),请高手帮帮忙,谢谢!<br>分数不够以后我有分时加上.<br>我现积有110,可以另外开贴给,请帮帮我,急啊!!!!!!1
 
panel.OnMouseDown中form.close
 
SORYY,我是在模式窗口外点击,如你说的只在窗口内点击有效,而非是在窗口内.<br>谢谢你的回答!
 
以前写的, <br>unit uRSIPopupForm;<br><br>interface<br><br>uses<br>&nbsp; Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br>&nbsp; Dialogs, StdCtrls<br>{$IFDEF DEBUG}<br>&nbsp; , dbugintf<br>{$ENDIF DEBUG}<br>&nbsp; ,Buttons, ExtCtrls, ActnList, Contnrs &nbsp; ;<br><br>const<br>&nbsp; gcs_ActionParam = 'action';<br>&nbsp; gcc_ActionCommand = #3;<br><br><br>type<br>&nbsp; TRSIPopupForm = class(TForm)<br>&nbsp; &nbsp; pan_base: TPanel;<br>&nbsp; &nbsp; Pan_Title: TPanel;<br>&nbsp; &nbsp; btn_Toggle: TSpeedButton;<br>&nbsp; &nbsp; btn_Exit: TSpeedButton;<br>&nbsp; &nbsp; Label1: TLabel;<br>&nbsp; &nbsp; procedure FormCreate(Sender: TObject);<br>&nbsp; &nbsp; procedure FormDestroy(Sender: TObject);<br>&nbsp; &nbsp; procedure Pan_TitleResize(Sender: TObject);<br>&nbsp; &nbsp; procedure btn_ExitClick(Sender: TObject);<br>&nbsp; &nbsp; procedure Pan_TitleMouseDown(Sender: TObject; Button: TMouseButton;<br>&nbsp; &nbsp; &nbsp; Shift: TShiftState; X, Y: Integer);<br>&nbsp; &nbsp; procedure FormShow(Sender: TObject);<br>&nbsp; Private<br>&nbsp; &nbsp; //Capture<br>&nbsp; &nbsp; FFormHandle : THandle;<br>&nbsp; &nbsp; FCapturing : boolean;<br>&nbsp; &nbsp; FNCACTIVATE : boolean;<br>&nbsp; &nbsp; FShowing : boolean ;<br>&nbsp; &nbsp; FTimer : TTimer;<br>&nbsp; &nbsp; FRect : TRECT;<br>&nbsp; &nbsp; FLastHitTestTime : integer;<br>&nbsp; &nbsp; FHandlerList : TObjectList;<br>&nbsp; &nbsp; function InWindows:boolean;<br>&nbsp; &nbsp; function InWinControl:boolean;<br>&nbsp; &nbsp; procedure InitAllControlMessageHandler(pvo_ParentControl : TControl);<br>&nbsp; &nbsp; procedure InitControlMessageHandler(pvo_HandledControl : TControl);<br>&nbsp; &nbsp; procedure FreeControlMessageHandler;<br>&nbsp; &nbsp; procedure ResetNCActivate;<br>&nbsp; &nbsp; procedure TimerOnTimer(Sender: TObject);<br>&nbsp; &nbsp; procedure SetCapturing(Value : boolean) &nbsp;;<br>&nbsp; &nbsp; Property Capturing : boolean read FCapturing write SetCapturing;<br>&nbsp; private<br>&nbsp; &nbsp; FToggle : boolean ;<br>&nbsp; &nbsp; FPopup: boolean;<br>&nbsp; Protected<br>&nbsp; &nbsp; procedure WndProc(var Message: TMessage); override;<br>&nbsp; &nbsp; procedure CreateParams(var Params : TCreateParams); override;<br>&nbsp; &nbsp; procedure ShowFormByName(FormName : string);<br>&nbsp; public<br>&nbsp; &nbsp; { Public declarations }<br>&nbsp; published<br>&nbsp; &nbsp; property Popup : boolean read FPopup write FPopup;<br>&nbsp; &nbsp; property Toggle : boolean read FToggle write FToggle;<br>&nbsp; end;<br><br>&nbsp; TRSIPopupFormClass = Class of TRSIPopupForm;<br><br>&nbsp; TControlMessageHandler = class(TObject)<br>&nbsp; private<br>&nbsp; &nbsp; FParentForm : TRSIPopupForm;<br>&nbsp; &nbsp; FControl : TControl;<br>&nbsp; &nbsp; FOldWindowProc : procedure(var Message: TMessage) of Object;<br>&nbsp; &nbsp; procedure NewWindowProc(var Message: TMessage);<br>&nbsp; end;<br><br><br>var<br>&nbsp; RSIPopupForm: TRSIPopupForm;<br><br>implementation<br>uses<br>&nbsp; ShlObj, ComObj, ActiveX<br>&nbsp; {$IFDEF DEBUG}<br>&nbsp; &nbsp; , DebugDLL<br>&nbsp; {$ENDIF DEBUG}<br>&nbsp; ;<br><br><br>{$R *.dfm}<br>//Mouse message routine<br>procedure TControlMessageHandler.NewWindowProc(var Message: TMessage);<br>begin<br>{$IFDEF DEBUG}<br>&nbsp; if (inttohex(Message.MSG, 4) &lt;&gt; 'B03F') and<br>&nbsp; &nbsp; &nbsp;(inttohex(Message.MSG, 4) &lt;&gt; '0200') and<br>&nbsp; &nbsp; &nbsp;(inttohex(Message.MSG, 4) &lt;&gt; '0020') and<br>&nbsp; &nbsp; &nbsp;(inttohex(Message.MSG, 4) &lt;&gt; '0084') then<br>&nbsp; &nbsp; SetTracemessages(true)<br>&nbsp; else<br>&nbsp; &nbsp; SetTracemessages(false);<br>&nbsp;// &nbsp; DebugMessage('Control ', Message.Msg);<br>{$ENDIF DEBUG}<br>&nbsp; if FParentForm.FPopup then<br>&nbsp; &nbsp; case Message.Msg of &nbsp; &nbsp;//<br>&nbsp; &nbsp; &nbsp; WM_SETCURSOR, CM_HITTEST:<br>&nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; FParentForm.FLastHitTestTime := DateTimeToTimeStamp(now).time;<br>&nbsp; &nbsp; &nbsp; &nbsp; FParentForm.Capturing := false;<br>&nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; &nbsp; WM_MOUSEMOVE:<br>&nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; FParentForm.FLastHitTestTime := DateTimeToTimeStamp(now).time;<br>&nbsp; &nbsp; &nbsp; &nbsp; FParentForm.Capturing := false;<br>&nbsp; &nbsp; &nbsp; &nbsp; if FParentForm.FNCACTIVATE and not FParentForm.Capturing and FParentForm.FShowing then<br>&nbsp; &nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;FParentForm.FNCACTIVATE := false;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;FParentForm.ResetNCActivate;<br>&nbsp; &nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; end; &nbsp; &nbsp;// case<br>&nbsp; FOldWindowProc(Message);<br>end;<br><br>function TRSIPopupForm.InWindows:boolean;<br>var<br>&nbsp; lvo_Pos : TPoint;<br>begin<br>&nbsp; GetCursorPos(lvo_Pos);<br>&nbsp; result := &nbsp;PtInRect(Bounds(FRect.Left, FRect.Top,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FRect.Right - FRect.Left,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FRect.Bottom - FRect.Top),<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lvo_Pos) ;<br>end;<br><br>function TRSIPopupForm.InWinControl:boolean;<br>var<br>&nbsp; lvo_Pos : TPoint;<br>begin<br>&nbsp; result := false;<br>&nbsp; GetCursorPos(lvo_Pos);<br>&nbsp; if not PtInRect(Bounds(FRect.Left, FRect.Top,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FRect.Right - FRect.Left,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FRect.Bottom - FRect.Top),<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lvo_Pos) then exit;<br>&nbsp; result := FindVCLWindow(lvo_Pos) &lt;&gt; self;<br>end;<br><br>procedure &nbsp;TRSIPopupForm.ResetNCActivate;<br>var<br>&nbsp; lvo_pos : TPoint;<br>begin<br>&nbsp; GetCursorPos(lvo_pos);<br>&nbsp; SetCursorPos(FRect.right, FRect.bottom);<br>&nbsp; try<br>&nbsp; &nbsp; mouse_event( MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0 );<br>&nbsp; &nbsp; mouse_event( MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 );<br>&nbsp; finally<br>&nbsp; &nbsp; SetCursorPos(lvo_pos.X, lvo_pos.y);<br>&nbsp; end;<br>end;<br><br><br><br>procedure TRSIPopupForm.WndProc(var Message: TMessage);<br>var<br>&nbsp; lvt_CData: TCopyDataStruct;<br>&nbsp; lvp_MessageContent: PChar;<br>&nbsp; lvs_ActionName : string;<br>&nbsp; i: Integer;<br>&nbsp; lvp_proc: procedure;<br>begin<br><br>{$IFDEF DEBUG}<br>&nbsp; if (inttohex(Message.MSG, 4) &lt;&gt; 'B03F') and<br>&nbsp; &nbsp; &nbsp;(inttohex(Message.MSG, 4) &lt;&gt; '0200') and<br>&nbsp; &nbsp; &nbsp;(inttohex(Message.MSG, 4) &lt;&gt; '0020') and<br>&nbsp; &nbsp; &nbsp;(inttohex(Message.MSG, 4) &lt;&gt; '0084') then<br>&nbsp; &nbsp; SetTracemessages(true)<br>&nbsp; else<br>&nbsp; &nbsp; SetTracemessages(false);<br>{$ENDIF DEBUG}<br>&nbsp; if FPopup then<br>&nbsp; begin<br>&nbsp; &nbsp; case Message.Msg of<br>&nbsp; &nbsp; &nbsp; WM_SETCURSOR, WM_MouseMove:<br>&nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; FLastHitTestTime := DateTimeToTimeStamp(now).time;<br>&nbsp; &nbsp; &nbsp; &nbsp; Capturing := false;<br>&nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; &nbsp; WM_LButtonDown, WM_RButtonDown:<br>&nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; if (getcapture = FFormHandle) then<br>&nbsp; &nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; PostMessage(FFormHandle, WM_CLOSE, 0, 0);<br>&nbsp; &nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; &nbsp; WM_NCActivate &nbsp;:<br>&nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; if not boolean(Message.WParam) &nbsp;then<br>&nbsp; &nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FNCACTIVATE := true;<br>&nbsp; &nbsp; &nbsp; &nbsp; end<br>&nbsp; &nbsp; &nbsp; &nbsp; else<br>&nbsp; &nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FNCACTIVATE := false;<br>&nbsp; &nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; &nbsp; CM_ShowingChanged :<br>&nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; if FShowing then<br>&nbsp; &nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FShowing := false;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Capturing := false;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FTimer.enabled := false;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FNCACTIVATE := false;<br>&nbsp; &nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; &nbsp; WM_ShowWindow :<br>&nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; if boolean(Message.WParam) then<br>&nbsp; &nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FShowing := true ;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FTimer.Enabled := true;<br>&nbsp; &nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; end;<br>&nbsp; end;<br><br>&nbsp; case Message.Msg of<br>&nbsp; &nbsp; WM_WindowPosChanged &nbsp;:<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; GetWindowRect(FFormHandle, FRect);<br>&nbsp; &nbsp; end;<br>&nbsp; &nbsp; WM_CopyData:<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; lvt_CData := TWMCOPYDATA(Message).CopyDataStruct^;<br>&nbsp; &nbsp; &nbsp; lvp_MessageContent := lvt_CData.lpData;<br>&nbsp; &nbsp; &nbsp; if lvp_MessageContent[0] &lt;&gt; gcc_ActionCommand then<br>&nbsp; &nbsp; &nbsp; &nbsp; Exit;<br>&nbsp; &nbsp; &nbsp; i := 1;<br>&nbsp; &nbsp; &nbsp; lvs_ActionName := '';<br>&nbsp; &nbsp; &nbsp; while lvp_MessageContent &lt;&gt; #0 do<br>&nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; lvs_ActionName := lvs_ActionName + lvp_MessageContent;<br>&nbsp; &nbsp; &nbsp; &nbsp; Inc(i);<br>&nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; &nbsp; if lvs_ActionName = '' then<br>&nbsp; &nbsp; &nbsp; &nbsp; exit;<br>&nbsp; &nbsp; &nbsp; lvp_proc := MethodAddress(lvs_ActionName + 'Execute');<br>&nbsp; &nbsp; &nbsp; if Assigned(lvp_proc) then<br>&nbsp; &nbsp; &nbsp; &nbsp; lvp_proc;<br>&nbsp; &nbsp; end;<br>&nbsp; end;<br><br>&nbsp; inherited WndProc(Message);<br>end;<br><br>procedure TRSIPopupForm.InitAllControlMessageHandler(pvo_ParentControl : TControl);<br>var<br>&nbsp; I: Integer;<br>begin<br><br>&nbsp; &nbsp; if pvo_ParentControl.ComponentCount &gt; 0 then<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp;for I := 0 to pvo_ParentControl.ComponentCount -1 &nbsp;do &nbsp; &nbsp;// Iterate<br>&nbsp; &nbsp; &nbsp; &nbsp;begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if not (pvo_ParentControl.Components is TControl) then &nbsp;break;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;InitControlMessageHandler(TControl(pvo_ParentControl.Components));<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;InitAllControlMessageHandler(TControl(pvo_ParentControl.Components));<br>&nbsp; &nbsp; &nbsp; &nbsp;end; &nbsp; &nbsp;// for<br>&nbsp; &nbsp; end; &nbsp; &nbsp;// while<br>end;<br><br>procedure TRSIPopupForm.InitControlMessageHandler(pvo_HandledControl : TControl);<br>var<br>&nbsp; lvo_Handler : TControlMessageHandler &nbsp;;<br>begin<br>&nbsp; lvo_Handler := &nbsp;TControlMessageHandler.create;<br>&nbsp; with lvo_Handler do<br>&nbsp; begin<br>&nbsp; &nbsp; FOldWindowProc := pvo_HandledControl.WindowProc;<br>&nbsp; &nbsp; pvo_HandledControl.WindowProc := NewWindowProc;<br>&nbsp; &nbsp; FControl := &nbsp;pvo_HandledControl;<br>&nbsp; &nbsp; FParentForm := self;<br>&nbsp; end;<br><br>&nbsp; FHandlerList.Add(lvo_Handler);<br>end;<br><br>procedure TRSIPopupForm.FreeControlMessageHandler;<br>var<br>&nbsp; I: Integer;<br>begin<br>&nbsp; for I := FHandlerList.Count-1 downto 0 do &nbsp; &nbsp;// Iterate<br>&nbsp; begin<br>&nbsp; &nbsp; TControlMessageHandler(FHandlerList).FControl.WindowProc := TControlMessageHandler(FHandlerList).FOldWindowProc;<br>&nbsp; &nbsp; TControlMessageHandler(FHandlerList).FOldWindowProc := nil;<br>&nbsp; &nbsp; TControlMessageHandler(FHandlerList).FControl := nil;<br>&nbsp; &nbsp; TControlMessageHandler(FHandlerList).FParentForm := nil;<br>&nbsp; &nbsp; TControlMessageHandler(FHandlerList).free;<br>&nbsp; end; &nbsp; &nbsp;// for<br>end;<br><br>procedure TRSIPopupForm.SetCapturing(Value : boolean);<br>begin<br>&nbsp; &nbsp; <br>&nbsp; if FCapturing = Value then exit;<br>&nbsp; if Value then<br>&nbsp; begin<br>&nbsp; &nbsp; SetCapture(FFormHandle);<br>&nbsp; &nbsp; FCapturing := True;<br>&nbsp; end<br>&nbsp; else<br>&nbsp; begin<br>&nbsp; &nbsp; ReleaseCapture;<br>&nbsp; &nbsp; FCapturing := false;<br>&nbsp; end;<br>end;<br><br>//From routine<br><br>procedure TRSIPopupForm.CreateParams(var Params : TCreateParams);<br>begin<br>&nbsp; inherited CreateParams(Params);<br>&nbsp; Params.Style := WS_POPUP;<br>&nbsp; Params.ExStyle := Params.ExStyle OR &nbsp;WS_EX_TOPMOST ;<br>&nbsp; Params.Style := WS_THICKFRAME OR WS_POPUP OR WS_BORDER ;<br>// &nbsp; Params.ExStyle := Params.ExStyle OR WS_EX_APPWINDOW ;<br>// &nbsp; Params.ExStyle := Params.ExStyle AND NOT WS_CAPTION &nbsp;;<br>// &nbsp; Params.ExStyle := Params.ExStyle OR WS_EX_OVERLAPPEDWINDOW ;<br>// &nbsp; Params.ExStyle := Params.ExStyle OR WS_EX_TRANSPARENT;<br>end;<br><br>procedure TRSIPopupForm.TimerOnTimer(Sender: TObject);<br>begin<br>&nbsp; FTimer.enabled := false;<br>&nbsp; try<br>&nbsp; &nbsp; if (abs(DateTimeToTimeStamp(now).time - FLastHitTestTime) &lt; 150) then<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; Capturing := false;<br>&nbsp; &nbsp; &nbsp; exit;<br>&nbsp; &nbsp; end;<br>&nbsp; &nbsp; if InWindows then exit;<br>&nbsp; &nbsp; Capturing := true;<br>&nbsp; finally<br>&nbsp; &nbsp; FTimer.enabled := true;<br>&nbsp; end;<br>end;<br><br><br>procedure TRSIPopupForm.FormCreate(Sender: TObject);<br>var<br>&nbsp; i: Integer;<br>&nbsp; lvs_ActionName : string;<br>&nbsp; lvp_proc: procedure;<br>begin<br>&nbsp; visible := false;<br>&nbsp; left := screen.Width + 50;<br>&nbsp; <br>&nbsp; FToggle := false;<br>&nbsp; FPopup := true;<br><br>&nbsp; FFormHandle := self.Handle;<br><br>&nbsp; //create timer component<br>&nbsp; FTimer &nbsp;:= TTimer.create(nil);<br>&nbsp; FTimer.interval := 100;<br>&nbsp; FTimer.OnTimer := TimerOnTimer;<br>&nbsp; FLastHitTestTime := DateTimeToTimeStamp(now).time;<br>&nbsp; FTimer.Enabled := Popup;<br><br>&nbsp; //Add mouse handler to all of controls<br>&nbsp; FHandlerList:= TObjectList.create;<br>&nbsp; InitAllControlMessageHandler(self);<br><br>&nbsp; //Checking execution parameter<br>&nbsp; for i := 1 to ParamCount do<br>&nbsp; begin<br>&nbsp; &nbsp; if copy(LowerCase(ParamStr(i)), 2, length(gcs_ActionParam)) = &nbsp;gcs_ActionParam then<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp;lvs_ActionName := trim(copy(LowerCase(ParamStr(i)), length(gcs_ActionParam) + 3, length(ParamStr(i))));<br>&nbsp; &nbsp; &nbsp; &nbsp;break;<br>&nbsp; &nbsp; end;<br>&nbsp; end;<br>&nbsp; if lvs_ActionName = '' then<br>&nbsp; &nbsp; exit;<br><br>&nbsp; //Invoking the action according the execution parameter<br>&nbsp; lvp_proc := MethodAddress(lvs_ActionName + 'Execute');<br>&nbsp; if Assigned(lvp_proc) then<br>&nbsp; &nbsp; lvp_proc;<br>end;<br><br>procedure TRSIPopupForm.FormDestroy(Sender: TObject);<br>begin<br>&nbsp; FreeControlMessageHandler;<br>// &nbsp;FHandlerList.free; &nbsp; &nbsp;//NTC<br>&nbsp; FTimer.free;<br>end;<br><br><br>procedure TRSIPopupForm.ShowFormByName(FormName : string);<br>var<br>&nbsp; lvo_FormClass : TPersistentClass;<br>&nbsp; lvo_Form :TForm;<br>begin<br>&nbsp; try<br>&nbsp; &nbsp; lvo_FormClass := FindClass(FormName) ;<br>&nbsp; except<br>&nbsp; &nbsp; ShowMessage(FormName + ' is not existed');<br>&nbsp; &nbsp; exit;<br>&nbsp; end;<br>&nbsp; if not Assigned(lvo_FormClass) then exit;<br>&nbsp; lvo_Form := TFormClass(lvo_FormClass).Create(Application);<br>&nbsp; lvo_Form.Show;<br>&nbsp; Application.ProcessMessages;<br>&nbsp; PostMessage(FFormHandle, WM_CLOSE, 0, 0);<br>end;<br><br>procedure TRSIPopupForm.Pan_TitleResize(Sender: TObject);<br>begin<br>&nbsp; Btn_Toggle.Left := Pan_Title.Width - 35;<br>&nbsp; Btn_Exit.Left := Pan_Title.Width - 20;<br>end;<br><br>procedure TRSIPopupForm.btn_ExitClick(Sender: TObject);<br>begin<br>&nbsp; PostMessage(FFormHandle, WM_Quit, 0, 0);<br>end;<br><br>procedure TRSIPopupForm.Pan_TitleMouseDown(Sender: TObject;<br>&nbsp; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);<br>begin<br>&nbsp;if Button &lt;&gt; mbRight then<br>&nbsp;begin<br>&nbsp;end;<br>end;<br><br>procedure TRSIPopupForm.FormShow(Sender: TObject);<br>begin<br>&nbsp; btn_Toggle.Visible := &nbsp;FToggle ;<br>end;<br><br>end.<br>
 
接受答案了.
 
后退
顶部