protected override void OnMouseLeave(EventArgs e) { base.OnMouseLeave(e); _hlBrIcon = TBorderIcon.biNone; _HighLighted = -1; _CloseHLighted = false; _HlCtl = THighlightedCtl.ctlPage; Invalidate(); }
public static TBorderIcon ConvertBorderIcon(TBorderIcon aVal) { switch (aVal) { case TBorderIcon.biNormalize: case TBorderIcon.biMaximize: return(TBorderIcon.biResize); default: return(aVal); } }
protected void DrawBorderIcon(Graphics aGraph, int aLeft, int aTop, int aWidth, int aHeight, TBorderIcon aIcon) { if (HostForm != null && _MouseDown && borderHelper.IsEqualBorderIcon(_hlBrIcon, aIcon)) { aLeft++; aTop++; } Pen lPen; int lSize = (aWidth < aHeight ? aWidth : aHeight) - 10; int lx = (aWidth - lSize) / 2 + aLeft; int ly = (aHeight - lSize) / 2 + aTop; Color lHlColor = aIcon == TBorderIcon.biClose ? Color.Red : Color.Blue; // Background: (If highlighted) if (borderHelper.IsEqualBorderIcon(_hlBrIcon, aIcon)) { if (!(_MouseDown && borderHelper.IsEqualBorderIcon(_hlBrIcon, aIcon))) { LinearGradientBrush lBrush = new LinearGradientBrush( new Point(aLeft, aTop), new Point(aLeft, aTop + aHeight), Color.FromArgb(0x80, Graph.ColorTools.Darken(40, lHlColor)), Color.FromArgb(0x80, lHlColor) ); Draw.RoundedRect( aGraph, new Rectangle(aLeft + 1, aTop + 1, aWidth - 1, aHeight - 1), 8, null, new SolidBrush(Color.FromArgb(0x80, Color.Black)) ); Draw.RoundedRect( aGraph, new Rectangle(aLeft, aTop, aWidth - 1, aHeight - 1), 8, null, lBrush ); } else { LinearGradientBrush lBrush = new LinearGradientBrush( new Point(aLeft, aTop), new Point(aLeft, aTop + aHeight), Color.FromArgb(0x80, Graph.ColorTools.Darken(40, lHlColor)), Color.FromArgb(0x80, lHlColor) ); Draw.RoundedRect( aGraph, new Rectangle(aLeft, aTop, aWidth - 1, aHeight - 1), 8, null, lBrush ); Draw.RoundedRect( aGraph, new Rectangle(aLeft, aTop, aWidth - 1, aHeight - 1), 8, null, new SolidBrush(Color.FromArgb(0x80, Color.Black)) ); } } // Drawing shape: switch (aIcon) { case TBorderIcon.biClose: lPen = new Pen(Color.FromArgb(0x80, Color.Black), 4); aGraph.DrawLine(lPen, lx + 1, ly + 1, lx + lSize + 1, ly + lSize + 1); aGraph.DrawLine(lPen, lx + 1, ly + lSize + 1, lx + lSize + 1, ly + 1); lPen = new Pen(Color.White, 4); aGraph.DrawLine(lPen, lx, ly, lx + lSize, ly + lSize); aGraph.DrawLine(lPen, lx, ly + lSize, lx + lSize, ly); break; case TBorderIcon.biMinimize: lPen = new Pen(Color.FromArgb(0x80, Color.Black), 4); aGraph.DrawLine(lPen, lx + 1, ly + lSize - 1, lx + lSize + 1, ly + lSize - 1); lPen = new Pen(Color.White, 4); aGraph.DrawLine(lPen, lx, ly + lSize - 2, lx + lSize, ly + lSize - 2); break; case TBorderIcon.biMaximize: lPen = new Pen(Color.FromArgb(0x80, Color.Black), 2); aGraph.DrawRectangle(lPen, new Rectangle(lx + 1, ly + 1, lSize - 1, lSize - 1)); lPen = new Pen(Color.FromArgb(0x80, Color.Black), 4); aGraph.DrawLine(lPen, lx + 1, ly, lx + lSize + 1, ly); lPen = new Pen(Color.White, 2); aGraph.DrawRectangle(lPen, new Rectangle(lx, ly, lSize - 1, lSize - 1)); lPen = new Pen(Color.White, 4); aGraph.DrawLine(lPen, lx, ly, lx + lSize - 1, ly); break; case TBorderIcon.biNormalize: lPen = new Pen(Color.FromArgb(0x80, Color.Black), 2); aGraph.DrawRectangle(lPen, new Rectangle(lx + 1, ly + 5, lSize - 4, lSize - 4)); aGraph.DrawLine(lPen, lx + 3, ly + 1, lx + lSize + 1, ly + 1); aGraph.DrawLine(lPen, lx + lSize + 1, ly + 1, lx + lSize + 1, ly + lSize - 2); lPen = new Pen(Color.FromArgb(0x80, Color.Black), 4); aGraph.DrawLine(lPen, lx + 1, ly + 5, lx + lSize - 3, ly + 5); lPen = new Pen(Color.White, 2); aGraph.DrawRectangle(lPen, new Rectangle(lx, ly + 4, lSize - 4, lSize - 4)); aGraph.DrawLine(lPen, lx + 2, ly, lx + lSize, ly); aGraph.DrawLine(lPen, lx + lSize, ly, lx + lSize, ly + lSize - 3); lPen = new Pen(Color.White, 4); aGraph.DrawLine(lPen, lx, ly + 4, lx + lSize - 4, ly + 4); break; } }
protected void UpdateByCursorPos(Point aLocation) { _HlCtl = THighlightedCtl.ctlPage; _hlBrIcon = TBorderIcon.biNone; // Determine if mouse cursor is over Window control button: if (HostForm != null) { int lLeft = this.Width - (3 * (_BORDERICON_SIZE * 2 + 4)); int lTop = 0; int lWidth = 2 * _BORDERICON_SIZE; int lHeight = _BORDERICON_SIZE; if (aLocation.Y >= lTop && aLocation.Y <= lTop + lHeight && lLeft <= aLocation.X) { int lIndex = (aLocation.X - lLeft) / (lWidth + 4); lIndex = ((lIndex + 1) * (lWidth + 4)) - 4 >= aLocation.X - lLeft ? lIndex : -1; if (lIndex == 0) { _hlBrIcon = TBorderIcon.biMinimize; } else if (lIndex == 1) { _hlBrIcon = TBorderIcon.biResize; } else if (lIndex == 2) { _hlBrIcon = TBorderIcon.biClose; } } } if (aLocation.Y < this.Height - _PageHeight) { _HighLighted = -1; return; } _HighLighted = getPageAtPoint(aLocation); // Determine if mouse cursor is over prev/next button if (aLocation.X > this.ClientSize.Width - (_ARCRAD + 8)) { _HlCtl = THighlightedCtl.ctlPrev; if (aLocation.X > this.ClientSize.Width - (_ARCRAD / 2 + 4)) { _HlCtl = THighlightedCtl.ctlNext; } } // Determine if close is highlighted: if (_HighLighted > -1 && _HighLighted < _Pages.Count) { CPageSelectorPage lPage = (CPageSelectorPage)(_Pages[_HighLighted]); int lClLeft = lPage.CurrentLeft + getVisibleWidth(lPage) - _PageHeight; _CloseHLighted = (aLocation.X > lClLeft) && (aLocation.X < (lPage.CurrentLeft + getVisibleWidth(lPage))); } else { _CloseHLighted = false; } Invalidate(); }
public static bool IsEqualBorderIcon(TBorderIcon aVal1, TBorderIcon aVal2) { return(ConvertBorderIcon(aVal1) == ConvertBorderIcon(aVal2)); }
public static bool IsEqualBorderIcon(TBorderIcon aVal1, TBorderIcon aVal2) { return ConvertBorderIcon(aVal1) == ConvertBorderIcon(aVal2); }
public static TBorderIcon ConvertBorderIcon(TBorderIcon aVal) { switch (aVal) { case TBorderIcon.biNormalize: case TBorderIcon.biMaximize: return TBorderIcon.biResize; default: return aVal; } }
protected void UpdateByCursorPos(Point aLocation) { _HlCtl = THighlightedCtl.ctlPage; _hlBrIcon = TBorderIcon.biNone; // Determine if mouse cursor is over Window control button: if (HostForm != null) { int lLeft = this.Width - (3 * (_BORDERICON_SIZE * 2 + 4)); int lTop = 0; int lWidth = 2 * _BORDERICON_SIZE; int lHeight = _BORDERICON_SIZE; if (aLocation.Y >= lTop && aLocation.Y <= lTop + lHeight && lLeft <= aLocation.X) { int lIndex = (aLocation.X - lLeft) / (lWidth + 4); lIndex = ((lIndex + 1) * (lWidth + 4)) - 4 >= aLocation.X - lLeft ? lIndex : -1; if (lIndex == 0) _hlBrIcon = TBorderIcon.biMinimize; else if (lIndex == 1) _hlBrIcon = TBorderIcon.biResize; else if (lIndex == 2) _hlBrIcon = TBorderIcon.biClose; } } if (aLocation.Y < this.Height - _PageHeight) { _HighLighted = -1; return; } _HighLighted = getPageAtPoint(aLocation); // Determine if mouse cursor is over prev/next button if (aLocation.X > this.ClientSize.Width - (_ARCRAD + 8)) { _HlCtl = THighlightedCtl.ctlPrev; if (aLocation.X > this.ClientSize.Width - (_ARCRAD / 2 + 4)) _HlCtl = THighlightedCtl.ctlNext; } // Determine if close is highlighted: if (_HighLighted > -1 && _HighLighted < _Pages.Count) { CPageSelectorPage lPage = (CPageSelectorPage)(_Pages[_HighLighted]); int lClLeft = lPage.CurrentLeft + getVisibleWidth(lPage) - _PageHeight; _CloseHLighted = (aLocation.X > lClLeft) && (aLocation.X < (lPage.CurrentLeft + getVisibleWidth(lPage))); } else _CloseHLighted = false; Invalidate(); }