//Each stage of progress causes a few things to occur: //a) Colors all change appropriately for the bottom half of the screen. //b) Panel buttons and labels now change. public void ProgressStage(int stage) { Panel[] outerPanels = { phoneouterPanel, quoteouterPanel, saleouterPanel, policyouterPanel }; Panel[] innerPanels = { phoneinnerPanel, quoteinnerPanel, saleinnerPanel, policyinnerPanel }; Panel[] lines = { line1, line2, line3 }; if (stage < outerPanels.Length) { innerPanels[stage].BackColor = Assets.StagesIcons[stage].BackColor; outerPanels[stage].Paint += (s, pevent) => { var gfx = pevent.Graphics; gfx.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; var brush = new SolidBrush(Assets.StagesIcons[stage].BackColor); gfx.FillEllipse(brush, pevent.ClipRectangle); Pen borderpen = new Pen(Color.White, 5); gfx.DrawEllipse(borderpen, WinformsHelper.ShrinkBorder(pevent.ClipRectangle, 10)); if (stage > 0) { lines[stage - 1].BackColor = Assets.StagesIcons[stage - 1].BackColor; } }; Refresh(); } }
public void InitializeView() { imageinnerPanel.BackColor = Item.IconData.BackColor; imageinnerPanel.BackgroundImage = Item.IconData.Image; imageinnerPanel.BackgroundImageLayout = ImageLayout.Stretch; imageouterPanel.Paint += (s, pevent) => { var gfx = pevent.Graphics; gfx.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; var brush = new SolidBrush(Item.IconData.BackColor); Rectangle square = new Rectangle(pevent.ClipRectangle.X, pevent.ClipRectangle.Y, pevent.ClipRectangle.Height, pevent.ClipRectangle.Height); gfx.FillEllipse(brush, WinformsHelper.ShrinkBorder(square, -1)); }; descriptionTextBox.Text = Item.Description; if (Item.Date > DateTime.Today.Date) { authorLabel.Text = Item.Author + " - " + Item.Date.ToShortTimeString(); } else { authorLabel.Text = Item.Author + " - " + Item.Date.ToShortDateString(); } }
public void MakeIcons(int iconSize, Color borderColor, Color iconColor) { //Great. Now that all the icons have been taken care of. Let's color these suckers up. //Step 1: Replace the generic icon with its proper stage icon. phoneinnerPanel.BackgroundImage = Assets.StagesIcons[0].Image; quoteinnerPanel.BackgroundImage = Assets.StagesIcons[1].Image; policyinnerPanel.BackgroundImage = Assets.StagesIcons[2].Image; saleinnerPanel.BackgroundImage = Assets.StagesIcons[3].Image; Panel[] outerPanels = { phoneouterPanel, quoteouterPanel, saleouterPanel, policyouterPanel }; Panel[] innerPanels = { phoneinnerPanel, quoteinnerPanel, saleinnerPanel, policyinnerPanel }; Panel[] lines = { line1, line2, line3 }; //Draws the background circle for the icons. foreach (var pan in outerPanels) { pan.Size = new Size((int)(iconSize * 1.41), (int)(iconSize * 1.41)); pan.Padding = new Padding(17); pan.Paint += (s, pevent) => { var gfx = pevent.Graphics; gfx.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; var brush = new SolidBrush(iconColor); gfx.FillEllipse(brush, pevent.ClipRectangle); Pen borderpen = new Pen(borderColor, 5); gfx.DrawEllipse(borderpen, WinformsHelper.ShrinkBorder(pevent.ClipRectangle, 10)); }; } foreach (var pan in innerPanels) { pan.Size = new Size(iconSize, iconSize); pan.BackColor = iconColor; } foreach (var line in lines) { line.BackColor = Color.White; } }