从实作标题栏按钮开始浅谈组件的制作 Repaint; SetCapture(FForm.Handle); end; end; WM_NCRBUTTONDOWN,WM_NCRBUTTONDBLCLK: begin if WParam = 888 then begin if Assigned(FPopup) then begin p.x := FForm.Left + BoundsRect.Left; p.y := FForm.Top + BoundsRect.Bottom; FPopup.Popup(p.x,p.y); end; end else Result:=CallWindowProc(FOldWndProc,FForm.Handle,Msg,WParam,LParam); end; WM_NCLBUTTONUP,WM_LBUTTONUP : begin if FButtonDown then begin FButtonDown := False; RePaint; ReleaseCapture; if Assigned(FOnClick) then FOnClick(self); end else Result:=CallWindowProc(FOldWndProc,FForm.Handle,Msg,WParam,LParam); end; else Result := CallWindowProc(FOldWndProc,FForm.Handle,Msg,WParam,LParam); end; end else Result := CallWindowProc(FOldWndProc,FForm.Handle,Msg,WParam,LParam); end; end; procedure TTitleBarButton.SetGlyph(const Value: TBitmap); begin FGlyph.Assign(Value); SendMessage(FForm.Handle,WM_NCACTIVATE,0,0); end; procedure TTitleBarButton.SetRightMargin(const Value: Cardinal); begin FRightMargin := Value; SendMessage(FForm.Handle,WM_NCACTIVATE,0,0); end; procedure TTitleBarButton.SetVisible(const Value: Boolean); begin FVisible := Value; SendMessage(FForm.Handle,WM_NCACTIVATE,0,0); end; procedure TTitleBarButton.Notification(Component: TComponent; Operation: TOperation); begin inherited; if (Operation = opRemove) and (Component = FPopup) then FPopup := nil; end; function TTitleBarButton.GetBoundsRect: TRect; var Rec: TRect; FrameThick: Integer; //窗体框架厚度 BtnWidth,BtnHeight: Integer; //标题栏按钮的宽度和高度 begin GetWindowRect(FForm.Handle,Rec); //得到窗体边界矩形,相对于屏幕左上角
上一篇:“98五笔字型输入法”大批量造词 下一篇:如何把数据库的内容写入到Word文档中? 更多相关文章
|
推荐文章
精彩文章
|