void FormSplashScreen_Paint(object sender, PaintEventArgs e) { if (Natives.CanUseAero) { Natives.FillBlackRegion(e.Graphics, ClientRectangle); e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; var gDevPath = new GraphicsPath(); var gLogPath = new GraphicsPath(); var brush = new SolidBrush(Color.FromArgb(0x99, Color.Black)); gDevPath.AddString(_devList, DrawingFont.FontFamily, (int)FontStyle.Regular, Constants.DEV_TEXT_SIZE, new Point(Constants.LOGO_WIDTH + Constants.PADDING, Constants.TEXT_HEIGHT + Constants.PADDING), StringFormat.GenericDefault); gLogPath.AddString(LogMessage, DrawingFont.FontFamily, (int)FontStyle.Bold, Constants.LOG_TEXT_SIZE, new Point(Constants.PADDING, Height - 65 - Constants.PADDING), StringFormat.GenericDefault); e.Graphics.DrawImage(HammerBitmap, Constants.PADDING, Constants.PADDING, Constants.LOGO_WIDTH, Constants.LOGO_HEIGHT); e.Graphics.DrawImage(MCForgeBitmap, Constants.LOGO_WIDTH + Constants.PADDING, Constants.PADDING, Constants.TEXT_WIDTH, Constants.TEXT_HEIGHT); e.Graphics.FillPath(brush, gDevPath); e.Graphics.FillPath(brush, gLogPath); gDevPath.Dispose(); gLogPath.Dispose(); brush.Dispose(); } }
protected override void OnPaint(PaintEventArgs e) { if (!Natives.CanUseAero) { base.OnPaint(e); return; } e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixelGridFit; int contentLength = 2; for (int i = 0; i < Items.Count; i++) { var item = Items[i]; contentLength += item.Width + 2; } var brush = new LinearGradientBrush(new PointF(), new Point(0, Height), ColorTop, ColorBottom); var penInner = new Pen(ColorOutlineInner); var penOuter = new Pen(ColorOutlineOuter); //Rectangles of all sorts of shapes and sizes var rectInner = new RectangleF { X = ClientRectangle.X + 5, Y = ClientRectangle.Y + 2, Width = contentLength, Height = ClientRectangle.Height + 1 }; var rectOuter = new RectangleF { X = ClientRectangle.X + 4.5f, Y = ClientRectangle.Y + 1.5f, Width = contentLength + 1f, Height = ClientRectangle.Height + 2f }; if (DesignMode) { e.Graphics.Clear(Color.FromArgb(0xD7, 0xE4, 0xF2)); } else { Natives.FillBlackRegion(e.Graphics, ClientRectangle); } e.Graphics.DrawRoundedRectangle(penOuter, rectOuter, 5f); e.Graphics.DrawRoundedRectangle(penInner, rectInner, 5f); e.Graphics.FillRoundedRectangle(brush, rectInner, 5f); penInner.Dispose(); penOuter.Dispose(); brush.Dispose(); base.OnPaint(e); }
/// <summary> /// Prepares the glass for rendering. /// </summary> /// <param name="graphics">The graphics canvas.</param> /// <param name="margs">The margins.</param> public void PrepareGlass(Graphics graphics, Margins margs) { if (DesignMode) { return; } if (!margs.IsEmpty && Natives.CanUseAero) { Natives.FillBlackRegion(graphics, margs); } }