public bool PreFilterMessage(ref Message m) { if (m.Msg == WM_LBUTTONDOWN && ControlsToMove.Contains(Control.FromHandle(m.HWnd))) { ReleaseCapture(); SendMessage(this.Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0); return(true); } return(false); }
public bool PreFilterMessage(ref Message m) { if (m.Msg == (int)KxSharpLib.Win32.WM.LBUTTONDOWN && ControlsToMove.Contains(FromHandle(m.HWnd))) { KxSharpLib.Win32.ReleaseCapture(); KxSharpLib.Win32.SendMessage(Instance.Handle, (int)KxSharpLib.Win32.WM.NCLBUTTONDOWN, (int)KxSharpLib.Win32.HT.CAPTION, 0); return(true); } return(false); }
/// <summary> /// /// </summary> /// <param name="e"></param> protected override void OnHandleCreated(EventArgs e) { base.OnHandleCreated(e); /// /// btnMaximize /// btnMaximize.Hide(); /// /// pCompanyImg /// pCompanyImg.BackgroundImageLayout = ImageLayout.Center; pCompanyImg.BackgroundImage = Icon.ToBitmap().ResizeImage(25, 25); /// /// pForeImg /// pForeImg.BackgroundImageLayout = ImageLayout.Center; pForeImg.BackgroundImage = MattimonAgentApplication.Properties.Resources.mattimon_banner_resize.ResizeImage(200, 35); pForeImg.Width = 200; /// /// fpControls /// fpControls.BringToFront(); /// /// pImgCaption /// pImgCaption.Dock = DockStyle.Fill; /// /// lblTitle /// lblTitle.Location = new Point(lblTitle.Location.X, ((pImgCaption.Height - lblTitle.Height) / 2) + 1); lblTitle.Size = new Size(pImgCaption.Width - lblTitle.Location.X - fpControls.DisplayRectangle.Width, lblTitle.Height); /// /// Form Delta Event Handlers /// Resize += (s, r) => { bool ellipsis = lblTitle.PreferredWidth > lblTitle.Width; /* handle caption label ellipsis if needed */ }; /// /// tabControl1 /// tabControl1.Appearance = TabAppearance.FlatButtons; tabControl1.ItemSize = new Size(0, 1); tabControl1.SizeMode = TabSizeMode.Fixed; tabControl1.Margin = new Padding(0); tabControl1.BringToFront(); /// /// Controls that will handle form dragging (Requires Application.AddMessageFilter(this)) /// ControlsToMove.Add(pForeImg); ControlsToMove.Add(pImgCaption); ControlsToMove.Add(lblTitle); ControlsToMove.Add(pTop); ControlsToMove.Add(statusStrip); /// /// Initialize default Label text here /// lblTitle.Text = MattimonFramework.Core.ApplicationManager.GetApplicationTitle() + " - " + MattimonFramework.Core.ApplicationManager.GetComputerName(); lbl_about_cversion.Text = ApplicationProjectAssemblyAtrributes.GetAssemblyVersion().ToString(); lbl_about_cdeviceid.Text = GetDeviceID().ToString(); /// /// Apply extra layout fixes here if needed /// ucMattimonServicesGrid1.Width = pPageTitleHolder.Width; ucsqlServerInstanceGrid1.Width = pSqlSrvTitleHolder.Width; /// /// Next /// }
public MapBuilder() { InitializeComponent(); Application.AddMessageFilter(this); ControlsToMove.Add(this); }