// public BeforeAfterImage() { DoubleBuffered = true; _moveIcon = SvgPath8x8Mgr.Get("M3 1.5l-3 2.5 3 2.5v-2h2v2l3-2.5-3-2.5v2h-2v-2z", 4, Brushes.Black); _separatePen = new Pen(Color.FromArgb(128, Color.Black)); }
// public TitleBar() { // control button setup _minimizeEnable = true; _maximizeEnable = true; // img setup _normalImg = SvgPath8x8Mgr.Get(SvgPathBx8Constants.ControlButtons.Normal, 2, Brushes.Black, SmoothingMode.Default); _maximizeImg = SvgPath8x8Mgr.Get(SvgPathBx8Constants.ControlButtons.Maximized, 2, Brushes.Black, SmoothingMode.Default); _minimizeButton = new TitleBarControlButton { Image = SvgPath8x8Mgr.Get(SvgPathBx8Constants.ControlButtons.Minimize, 2, Brushes.Black, SmoothingMode.Default) }; _maximizeButton = new TitleBarControlButton { Image = _normalImg }; _closeButton = new TitleBarControlButton { Image = SvgPath8x8Mgr.Get(SvgPathBx8Constants.ControlButtons.Close, 2, Brushes.Black, SmoothingMode.Default) }; _textBrush = BrushCreator.CreateSolidBrush(); _hoverBrush = BrushCreator.CreateSolidBrush("#FFF0F0F0"); _controlButtonPen = PenCreator.Create(); DoubleBuffered = true; }
// protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); var g = e.Graphics; g.SmoothingMode = SmoothingMode.AntiAlias; // using for design visual if (DesignMode) { _itemImage = Image.FromFile(@"D:\Image\cgi\noragami_by_guweiz-d9x26b7.jpg"); this.Content = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."; } // draw item image if (ItemImage != null) { g.SetClip(ComputeGraphisPath(_imageBoundary)); g.DrawImage(ItemImage, _imageBoundary); g.SetClip(this.ClientRectangle); } if (_isOpenning) { g.FillEllipse(Brushes.Gray, _closeIconBoundary); g.DrawImage(SvgPath8x8Mgr.Get(SvgPathBx8Constants.XThin, 10, Brushes.White), _closeIconBoundary.AdjustSize(-8, -8).AdjustXY(4, 4)); if (this.Content != null) { TextRenderer.DrawText(e.Graphics, this.Content, this.Font, _contentBounds, Color.Black, _contentFormatFlag); } } }
public MediaController() { InitializeComponent(); tbDuration.MaxValue = 100; tbDuration.Value = 20; tbDuration.MinValue = 1; var sm = System.Drawing.Drawing2D.SmoothingMode.Default; fbShuffle.IconImage = SvgPath8x8Mgr.Get(SvgPathBx8Constants.Random, 4, Brushes.Black, sm); fbBack.IconImage = SvgPath8x8Mgr.Get(SvgPathBx8Constants.MediaStepBackward, 4, Brushes.Black, sm); fbPlayPause.IconImage = SvgPath8x8Mgr.Get(SvgPathBx8Constants.MediaPlay, 4, Brushes.Black, sm); fbNext.IconImage = SvgPath8x8Mgr.Get(SvgPathBx8Constants.MediaStepForward, 4, Brushes.Black, sm); fbLoop.IconImage = SvgPath8x8Mgr.Get(SvgPathBx8Constants.Loop, 4, Brushes.Black, sm); }
public ImageSlide() { DoubleBuffered = true; imgs = new List <Image>(); currentIndex = -1; newIndex = -1; prevNavRect = new Rectangle(20, 0, NAV_SIZE, NAV_SIZE); prevNavImage = SvgPath8x8Mgr.Get(SvgPathBx8Constants.ArrowCircleLeft, 10, Brushes.White); nextNavRect = new Rectangle(0, 0, NAV_SIZE, NAV_SIZE); nextNavImage = SvgPath8x8Mgr.Get(SvgPathBx8Constants.ArrowCircleRight, 10, Brushes.White); opacityBrush = new SolidBrush(Color.Black); SetupFlyinAnim(); SetupFlyoutAnim(); }
// public NavigationBar() { _enableHighlightReveal = false; // _navBarItems = new List <NavBarItemWrapper>(); // // add collapse button _collapsingImage = SvgPath8x8Mgr.Get("M5 1v2h-5v2h5v2l3-3.03-3-2.97z" /*=>*/, 4, Brushes.Black, SmoothingMode.HighQuality); _expadingImage = SvgPath8x8Mgr.Get("M3 1l-3 3.03 3 2.97v-2h5v-2h-5v-2z" /*<=*/, 4, Brushes.Black, SmoothingMode.HighQuality); _collapseExpandItem = new NavBarItemWrapper(new NavBarItem { Icon = _expadingImage, Clicked = (s, e) => { _collapsing = !_collapsing; _collapseExpandItem.Icon = _collapsing ? _collapsingImage : _expadingImage; this.Width = _collapsing ? _itemHeight : _expandedWidth; UpdatePosition(); if (OnCollapseExpandStateChanged != null) { OnCollapseExpandStateChanged(this, EventArgs.Empty); } } }); _expandedWidth = 200; // _navBackgroundBrush = BrushCreator.CreateSolidBrush(); _navItemBackgroundBrush = BrushCreator.CreateSolidBrush(); _navClickedItemBrush = BrushCreator.CreateSolidBrush(); _navItemTextBrush = BrushCreator.CreateSolidBrush("255, 0, 0, 0"); _navItemBorderPen = PenCreator.Create(); DoubleBuffered = true; SetStyle(ControlStyles.SupportsTransparentBackColor, true); }
private void SetupNavBar() { #region Setup menu item Func <string, EventHandler> itemClick = (msg) => (s, e) => label1.Text = msg; var home = new NavBarItem() { Text = "Home", Icon = SvgPath8x8Mgr.Get(SvgPathBx8Constants.Home, 4, Brushes.Black), Clicked = itemClick("Home"), }; var bg = new NavBarItem() { Text = "Background", Icon = SvgPath8x8Mgr.Get(SvgPathBx8Constants.Monitor, 4, Brushes.Black), Clicked = itemClick("Background"), Items = new List <NavBarItem> { new NavBarItem() { Text = "Colors", Icon = SvgPath8x8Mgr.Get(SvgPathBx8Constants.Brush, 4, Brushes.Black), Clicked = itemClick("Colors"), }, new NavBarItem() { Text = "Lock screen", Icon = SvgPath8x8Mgr.Get(SvgPathBx8Constants.LockLocked, 4, Brushes.Black), Clicked = itemClick("Lock screen"), }, new NavBarItem() { Text = "Themes", Icon = SvgPath8x8Mgr.Get(SvgPathBx8Constants.Contrast, 4, Brushes.Black), Clicked = itemClick("Themes"), } } }; var fonts = new NavBarItem() { Text = "Fonts", Icon = SvgPath8x8Mgr.Get(SvgPathBx8Constants.Text, 4, Brushes.Black), Clicked = itemClick("Fonts"), }; var start = new NavBarItem() { Text = "Start", Icon = SvgPath8x8Mgr.Get(SvgPathBx8Constants.Box, 4, Brushes.Black), Clicked = itemClick("Start"), }; var taskbar = new NavBarItem() { Text = "Taskbar", Icon = SvgPath8x8Mgr.Get(SvgPathBx8Constants.List, 4, Brushes.Black), Clicked = itemClick("Taskbar"), }; navBar.Initialize(home, bg, fonts, start, taskbar); #endregion navBar.OnCollapseExpandStateChanged += (s, e) => { int widthChanged = navBar.ExpanedWidth - navBar.CollapsedWidth; if (!navBar.IsCollapsing) { widthChanged = -widthChanged; } pnContent.Width += widthChanged; pnContent.Left = navBar.Right; }; }
private void PaintItem(NavBarItemWrapper item, Graphics g) { if (item != _collapseExpandItem && (item.IsHovered || item.IsClicked)) { _navItemBackgroundBrush.Color = ExColorTranslator.Get("128, 128, 128, 128"); _navItemBorderPen.Color = ExColorTranslator.Get("128, 93, 93, 93"); g.FillRectangle(_navItemBackgroundBrush, item.Boundary); g.DrawRectangle(_navItemBorderPen, new Rectangle(-1, item.Boundary.Y, this.Width, item.Boundary.Height)); } if (item.IsClicked) { g.FillRectangle(_navClickedItemBrush, new Rectangle(0, item.Boundary.Y + 1, 3 /*px*/, item.Boundary.Height - 1)); } // Draw reveal highlight if (item.IsHovered && item != _collapseExpandItem) { if (_enableHighlightReveal) { int halfRebelSize = 100; // TODO: // Brush created everytime so render performance will be decreased // Replace with Translate matrix stuff if (_navLeftRevealHighlightBrush != null) { _navLeftRevealHighlightBrush.Dispose(); _navLeftRevealHighlightBrush = null; } if (_navRightRevealHighlightBrush != null) { _navRightRevealHighlightBrush.Dispose(); _navRightRevealHighlightBrush = null; } Rectangle leftRevealHighlightRect = new Rectangle(_mouseLocation.X - halfRebelSize, item.Boundary.Y, halfRebelSize, item.Boundary.Height + 1); Rectangle rightRevealHighlightRect = new Rectangle(_mouseLocation.X, item.Boundary.Y, halfRebelSize, item.Boundary.Height + 1); _navLeftRevealHighlightBrush = new LinearGradientBrush( leftRevealHighlightRect, ExColorTranslator.Get("0, 200, 200, 200"), ExColorTranslator.Get("100, 255, 255, 255"), 0f); _navRightRevealHighlightBrush = new LinearGradientBrush( rightRevealHighlightRect, ExColorTranslator.Get("100, 255, 255, 255"), ExColorTranslator.Get("0, 200, 200, 200"), 0f); g.FillRectangle(_navLeftRevealHighlightBrush, leftRevealHighlightRect); g.FillRectangle(_navRightRevealHighlightBrush, rightRevealHighlightRect); } } if (item.Icon != null) { g.DrawImage(item.Icon, item.IconBoundary); } if (item != _collapseExpandItem) { g.DrawString(item.Text, Font, _navItemTextBrush, item.TextPosition); } // draw arrow and child item if needed if (item != _collapseExpandItem && item.Items != null) { if (item.IsExpanded) { // Draw dropdown arrow only mouse enter nav bar if (_isMouseIn && !_collapsing) { g.DrawImage(SvgPath8x8Mgr.Get("M0,0H8L4,8z", 1, Brushes.Black), item.DropDownButtonBoundary); } foreach (var childItem in item.Items) { PaintItem(childItem, g); } } else { // Draw dropdown arrow only mouse enter nav bar if (_isMouseIn && !_collapsing) { g.DrawImage(SvgPath8x8Mgr.Get("M0,8H8L4,0z", 1, Brushes.Black), item.DropDownButtonBoundary); } } } }