private bool DepressButton(Rectangle btnrect, ThemeCaptionButton btn) { bool result = false; try { this.Capture = true; btn.SetDownFadeType(FadeType.In); bool done = false; while (!done) { Message m = new Message(); if (NativeMethods.PeekMessage(ref m, IntPtr.Zero, (int)NativeMethods.WindowMessages.WM_MOUSEFIRST, (int)NativeMethods.WindowMessages.WM_MOUSELAST, (int)NativeMethods.PeekMessageOptions.PM_REMOVE)) { switch (m.Msg) { case (int)NativeMethods.WindowMessages.WM_LBUTTONUP: { btn.SetDownFadeType(FadeType.Out); Point pt = PointToWindow(PointToScreen(new Point(m.LParam.ToInt32()))); result = btnrect.Contains(pt); done = true; break; } case (int)NativeMethods.WindowMessages.WM_MOUSEMOVE: { Point clientPoint = PointToWindow(PointToScreen(new Point(m.LParam.ToInt32()))); if (btnrect.Contains(clientPoint)) { btn.SetDownFadeType(FadeType.In); } else { btn.SetDownFadeType(FadeType.Out); } break; } } } } } finally { this.Capture = false; } return(result); }
public ThemeTabBar(ThemeTabControl parent) { this.parent = parent; this.Margin = new Padding(0, 0, 0, 0); btnclose = new ThemeCaptionButton(ThemeCaptionButton.CapBtnType.Close, this); btnclose.Parent = this; btnclose.Visible = false; btnmax = new ThemeCaptionButton(ThemeCaptionButton.CapBtnType.Maximize, this); btnmax.Parent = this; btnmax.Visible = false; btnmin = new ThemeCaptionButton(ThemeCaptionButton.CapBtnType.Minimize, this); btnmin.Parent = this; btnmin.Visible = false; navbtnbackoverfadeid = FadeScheduler.CreateFade(new EventHandler <FadeEventArgs>(this.FadeChanged), 1f, 0f, 1f); navbtnfwdoverfadeid = FadeScheduler.CreateFade(new EventHandler <FadeEventArgs>(this.FadeChanged), 1f, 0f, 1f); }
public ThemeForm() { this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor, true); controlstyledictionaries = new Dictionary <Type, Dictionary <string, object> >(); base.TopBorderHeight = 30; btnclose = new ThemeCaptionButton(ThemeCaptionButton.CapBtnType.Close, this); btnclose.ownerform = this; btnclose.Visible = false; btnmin = new ThemeCaptionButton(ThemeCaptionButton.CapBtnType.Minimize, this); btnmin.ownerform = this; btnmin.Visible = false; btnmax = new ThemeCaptionButton(ThemeCaptionButton.CapBtnType.Maximize, this); btnmax.ownerform = this; btnmax.Visible = false; ThemeKit.forms.Add(this); }