/// <summary> /// Draws an inset or raised line connecting the two points specified by /// the coordinate pairs. This method draws only horizontal or vertical /// lines. If the line is not horizontal or vertical, this method throws an /// ArgumentException. If the line is horizontal, the pixels are /// drawn just below the specified grid line. If the line is /// vertical, the pixels are drawn just to the right of the /// the specified grid line. /// </summary> /// <param name="x1">x coordinate of the first grid point.</param> /// <param name="y1">y coordinate of the first grid point.</param> /// <param name="x2">x coordinate of the second grid point.</param> /// <param name="y2">y coordinate of the second grid point.</param> /// <param name="style">Specifies the raised or inset style.</param> /// <param name="depth">Specifies the depth of the raised or inset line or rectangle. /// Valid values are 1 and 2.</param> public void Draw3DLine(int x1, int y1, int x2, int y2, KrbTabControl.ThreeDStyle style, int depth) { Draw3DLine(new Point(x1, y1), new Point(x2, y2), style, depth); }
/// <summary> /// Draws an inset or raised line connecting the two points specified by /// the coordinate pairs. This method draws only horizontal or vertical /// lines. If the line is not horizontal or vertical, this method throws an /// ArgumentException. If the line is horizontal, the pixels are /// drawn just below the specified grid line. If the line is /// vertical, the pixels are drawn just to the right of the /// the specified grid line. /// </summary> /// <param name="p1">Point structure that specifies the first grid point to connect.</param> /// <param name="p2">Point structure that specifies the second grid point to connect.</param> /// <param name="style">Specifies the raised or inset style.</param> /// <param name="depth">Specifies the depth of the raised or inset line or rectangle. /// Valid values are 1 and 2.</param> public void Draw3DLine(Point p1, Point p2, KrbTabControl.ThreeDStyle style, int depth) { if (p1.X != p2.X && p1.Y != p2.Y) throw new ArgumentException(); if (depth != 1 && depth != 2) throw new ArgumentException(); if (depth == 1) { switch (style) { case KrbTabControl.ThreeDStyle.Inset: case KrbTabControl.ThreeDStyle.Groove: if (p1.Y == p2.Y) { DrawLine(SystemPens.ControlDark, p1, p2); Point pl1 = new Point(p1.X, p1.Y + 1); Point pl2 = new Point(p2.X, p2.Y + 1); DrawLine(SystemPens.ControlLightLight, pl1, pl2); } else { DrawLine(SystemPens.ControlDark, p1, p2); Point pl1 = new Point(p1.X + 1, p1.Y); Point pl2 = new Point(p2.X + 1, p2.Y); DrawLine(SystemPens.ControlLightLight, pl1, pl2); } break; case KrbTabControl.ThreeDStyle.Raised: case KrbTabControl.ThreeDStyle.Ridge: if (p1.Y == p2.Y) { DrawLine(SystemPens.ControlLightLight, p1, p2); Point pd1 = new Point(p1.X, p1.Y + 1); Point pd2 = new Point(p2.X, p2.Y + 1); DrawLine(SystemPens.ControlDark, pd1, pd2); } else { DrawLine(SystemPens.ControlLightLight, p1, p2); Point pd1 = new Point(p1.X + 1, p1.Y); Point pd2 = new Point(p2.X + 1, p2.Y); DrawLine(SystemPens.ControlDark, pd1, pd2); } break; } } else if (depth == 2) { switch (style) { case KrbTabControl.ThreeDStyle.Inset: case KrbTabControl.ThreeDStyle.Groove: if (p1.Y == p2.Y) { DrawLine(SystemPens.ControlDarkDark, p1, p2); Point pp1 = new Point(p1.X, p1.Y + 1); Point pp2 = new Point(p2.X, p2.Y + 1); DrawLine(SystemPens.ControlDark, pp1, pp2); pp1.Y++; pp2.Y++; DrawLine(SystemPens.ControlLight, pp1, pp2); pp1.Y++; pp2.Y++; DrawLine(SystemPens.ControlLightLight, pp1, pp2); } else { DrawLine(SystemPens.ControlDarkDark, p1, p2); Point pp1 = new Point(p1.X + 1, p1.Y); Point pp2 = new Point(p2.X + 1, p2.Y); DrawLine(SystemPens.ControlDark, pp1, pp2); pp1.X++; pp2.X++; DrawLine(SystemPens.ControlLight, pp1, pp2); pp1.X++; pp2.X++; DrawLine(SystemPens.ControlLightLight, pp1, pp2); } break; case KrbTabControl.ThreeDStyle.Raised: case KrbTabControl.ThreeDStyle.Ridge: if (p1.Y == p2.Y) { DrawLine(SystemPens.ControlLightLight, p1, p2); Point pp1 = new Point(p1.X, p1.Y + 1); Point pp2 = new Point(p2.X, p2.Y + 1); DrawLine(SystemPens.ControlLight, pp1, pp2); pp1.Y++; pp2.Y++; DrawLine(SystemPens.ControlDark, pp1, pp2); pp1.Y++; pp2.Y++; DrawLine(SystemPens.ControlDarkDark, pp1, pp2); } else { DrawLine(SystemPens.ControlLightLight, p1, p2); Point pp1 = new Point(p1.X + 1, p1.Y); Point pp2 = new Point(p2.X + 1, p2.Y); DrawLine(SystemPens.ControlLight, pp1, pp2); pp1.X++; pp2.X++; DrawLine(SystemPens.ControlDark, pp1, pp2); pp1.X++; pp2.X++; DrawLine(SystemPens.ControlDarkDark, pp1, pp2); } break; } } }
public Scroller(KrbTabControl.UpDown32Style upDownStyle) : this() { _leftScroller = new RolloverUpDown(true); _rightScroller = new RolloverUpDown(true); switch (upDownStyle) { case KrbTabControl.UpDown32Style.BlackGlass: _leftScroller.NormalImage = Resources.LeftNormalBlackGlass; _leftScroller.HoverImage = Resources.LeftHoverBlackGlass; _leftScroller.DownImage = Resources.LeftDownBlackGlass; _rightScroller.NormalImage = Resources.RightNormalBlackGlass; _rightScroller.HoverImage = Resources.RightHoverBlackGlass; _rightScroller.DownImage = Resources.RightDownBlackGlass; break; case KrbTabControl.UpDown32Style.KrbBlue: _leftScroller.NormalImage = Resources.LeftNormalKRBBlue; _leftScroller.HoverImage = Resources.LeftHoverKRBBlue; _leftScroller.DownImage = Resources.LeftDownKRBBlue; _rightScroller.NormalImage = Resources.RightNormalKRBBlue; _rightScroller.HoverImage = Resources.RightHoverKRBBlue; _rightScroller.DownImage = Resources.RightDownKRBBlue; break; case KrbTabControl.UpDown32Style.OfficeBlue: _leftScroller.NormalImage = Resources.LeftNormalOfficeBlue; _leftScroller.HoverImage = Resources.LeftHoverOfficeBlue; _leftScroller.DownImage = Resources.LeftDownOfficeBlue; _rightScroller.NormalImage = Resources.RightNormalOfficeBlue; _rightScroller.HoverImage = Resources.RightHoverOfficeBlue; _rightScroller.DownImage = Resources.RightDownOfficeBlue; break; case KrbTabControl.UpDown32Style.OfficeOlive: _leftScroller.NormalImage = Resources.LeftNormalOfficeOlive; _leftScroller.HoverImage = Resources.LeftHoverOfficeOlive; _leftScroller.DownImage = Resources.LeftDownOfficeOlive; _rightScroller.NormalImage = Resources.RightNormalOfficeOlive; _rightScroller.HoverImage = Resources.RightHoverOfficeOlive; _rightScroller.DownImage = Resources.RightDownOfficeOlive; break; case KrbTabControl.UpDown32Style.OfficeSilver: _leftScroller.NormalImage = Resources.LeftNormalOfficeSilver; _leftScroller.HoverImage = Resources.LeftHoverOfficeSilver; _leftScroller.DownImage = Resources.LeftDownOfficeSilver; _rightScroller.NormalImage = Resources.RightNormalOfficeSilver; _rightScroller.HoverImage = Resources.RightHoverOfficeSilver; _rightScroller.DownImage = Resources.RightDownOfficeSilver; break; default: _leftScroller.NormalImage = Resources.leftArrow; _leftScroller.HoverImage = Resources.leftArrowHover; _leftScroller.DownImage = Resources.leftArrowDown; _rightScroller.NormalImage = Resources.RightArrow; _rightScroller.HoverImage = Resources.RightArrowHover; _rightScroller.DownImage = Resources.RightArrowDown; break; } Size = new Size() { Width = _leftScroller.NormalImage.Width * 2 + 1, Height = _leftScroller.NormalImage.Height }; _leftScroller.Location = new Point(0, 0); _rightScroller.Location = new Point(Width / 2 + 1, 0); _leftScroller.MouseDown += new MouseEventHandler(OnLeftScroll); _rightScroller.MouseDown += new MouseEventHandler(OnRightScroll); Controls.Add(_leftScroller); Controls.Add(_rightScroller); }