protected override void OnPaint(PaintEventArgs e) { int x = 5; if (!reverse) { x = (int)(this.Width - 10 - this.Text.Length * this.Font.Size); } if (centerText) { x = (int)(this.Width / 2); } SummaryForm.RenderText(e.Graphics, this.Text, x, Color.Empty, StyleManager.NotificationTextColor, Color.FromArgb(0, 0, 0), this.Height, 4, this.Font, true, System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor, backColor == StyleManager.TransparencyKey ? System.Drawing.Drawing2D.SmoothingMode.None : System.Drawing.Drawing2D.SmoothingMode.HighQuality); }
public static void ShowSummaryForm(string command, string screenshot_path = "") { SummaryForm f = new SummaryForm(); ShowNotification(f, command, screenshot_path); }
private void RefreshHUD(double lifePercentage, double manaPercentage) { lifePercentage = lifePercentage.ClampPercentage(); manaPercentage = manaPercentage.ClampPercentage(); Bitmap bitmap = new Bitmap(pictureBox.Size.Width, pictureBox.Size.Height); int width = bitmap.Width; int height = bitmap.Height; using (Graphics gr = Graphics.FromImage(bitmap)) { // we set the interpolation mode to nearest neighbor because other interpolation modes modify the colors // which causes the transparency key to appear around the edges of the object gr.Clear(StyleManager.BlendTransparencyKey); Rectangle lifeRectangle = new Rectangle(); lifeRectangle.X = (int)(height * 0.7); lifeRectangle.Y = (int)(height * 0.15) - 2; lifeRectangle.Width = width - lifeRectangle.X; lifeRectangle.Height = (int)(height * 0.2) + 4; gr.FillRectangle(Brushes.Black, lifeRectangle); lifeRectangle.Y += 2; lifeRectangle.Height -= 4; lifeRectangle.Width = (int)(lifeRectangle.Width * lifePercentage) - 2; using (Brush brush = new SolidBrush(StyleManager.GetHealthColor(lifePercentage))) { gr.FillRectangle(brush, lifeRectangle); } Rectangle manaRectangle = new Rectangle(); manaRectangle.X = (int)(height * 0.7); manaRectangle.Y = (int)(height * 0.15) - 2 + lifeRectangle.Height + 2; manaRectangle.Width = (int)((width - lifeRectangle.X) * 0.95); manaRectangle.Height = (int)(height * 0.2) + 4; gr.FillRectangle(Brushes.Black, manaRectangle); manaRectangle.Y += 2; manaRectangle.Height -= 4; manaRectangle.Width = (int)(manaRectangle.Width * manaPercentage) - 2; using (Brush brush = new SolidBrush(StyleManager.ManaColor)) { gr.FillRectangle(brush, manaRectangle); } int backgroundSize = (int)(height * backgroundScale / 100.0); int backgroundBaseOffset = (height - backgroundSize) / 2; int centerSize = (int)(height * centerScale / 100.0); int centerBaseOffset = (height - centerSize) / 2; SummaryForm.RenderImageResized(gr, backgroundImage, new Rectangle(backgroundBaseOffset + backgroundOffset.X, backgroundBaseOffset + backgroundOffset.Y, backgroundSize, backgroundSize)); SummaryForm.RenderImageResized(gr, centerImage, new Rectangle(centerBaseOffset + centerOffset.X, centerBaseOffset + centerOffset.Y, centerSize, centerSize)); Rectangle levelRect = new Rectangle((int)(height * 0.7), (int)(height * 0.6), (int)(height * 0.35), (int)(height * 0.35)); using (Brush brush = new SolidBrush(StyleManager.MainFormButtonColor)) { gr.FillEllipse(brush, levelRect); } using (Pen pen = new Pen(StyleManager.MainFormButtonForeColor, 2)) { gr.DrawEllipse(pen, levelRect); } using (Brush brush = new SolidBrush(StyleManager.MainFormButtonForeColor)) { string level = MemoryReader.Level.ToString(); gr.DrawString(level, StyleManager.MainFormLabelFont, brush, new PointF(height * (0.725f + (3 - level.Length) * 0.0375f), height * 0.7f)); } } bitmap.MakeTransparent(StyleManager.TransparencyKey); Image oldImage = pictureBox.Image; pictureBox.Image = bitmap; if (oldImage != null) { lock (oldImage) { oldImage.Dispose(); } } }
private void RefreshHUD() { float life = lifePercentage.ClampPercentage(); float mana = manaPercentage.ClampPercentage(); Bitmap bitmap = new Bitmap(pictureBox.Size.Width, pictureBox.Size.Height); int width = bitmap.Width; int height = bitmap.Height; using (Graphics gr = Graphics.FromImage(bitmap)) { // we set the interpolation mode to nearest neighbor because other interpolation modes modify the colors // which causes the transparency key to appear around the edges of the object gr.Clear(StyleManager.BlendTransparencyKey); Rectangle lifeRectangle = new Rectangle(); lifeRectangle.X = (int)(height * 0.7); lifeRectangle.Y = (int)(height * 0.15) - 2; lifeRectangle.Width = width - lifeRectangle.X; lifeRectangle.Height = (int)(height * 0.2) + 4; gr.FillRectangle(Brushes.Black, lifeRectangle); lifeRectangle.Y += 2; lifeRectangle.Height -= 4; lifeRectangle.Width = (int)(lifeRectangle.Width * life) - 2; using (Brush brush = new SolidBrush(StyleManager.GetHealthColor(life))) { gr.FillRectangle(brush, lifeRectangle); } Rectangle manaRectangle = new Rectangle(); manaRectangle.X = (int)(height * 0.7); manaRectangle.Y = (int)(height * 0.15) - 2 + lifeRectangle.Height + 2; manaRectangle.Width = (int)((width - lifeRectangle.X) * 0.95); manaRectangle.Height = (int)(height * 0.2) + 4; gr.FillRectangle(Brushes.Black, manaRectangle); manaRectangle.Y += 2; manaRectangle.Height -= 4; manaRectangle.Width = (int)(manaRectangle.Width * mana) - 2; using (Brush brush = new SolidBrush(StyleManager.ManaColor)) { gr.FillRectangle(brush, manaRectangle); } int backgroundSize = (int)(height * backgroundScale / 100.0); int backgroundBaseOffset = (height - backgroundSize) / 2; int centerSize = (int)(height * centerScale / 100.0); int centerBaseOffset = (height - centerSize) / 2; using (Brush brush = new SolidBrush(this.TransparencyKey)) { gr.FillEllipse(brush, new Rectangle(backgroundBaseOffset + backgroundOffset.X, backgroundBaseOffset + backgroundOffset.Y, backgroundSize, backgroundSize)); } using (Pen pen = new Pen(Color.Black, 5)) { gr.DrawEllipse(pen, new Rectangle(backgroundBaseOffset + backgroundOffset.X, backgroundBaseOffset + backgroundOffset.Y, backgroundSize, backgroundSize)); } //SummaryForm.RenderImageResized(gr, backgroundImage, new Rectangle(backgroundBaseOffset + backgroundOffset.X, backgroundBaseOffset + backgroundOffset.Y, backgroundSize, backgroundSize)); SummaryForm.RenderImageResized(gr, centerImage, new Rectangle(centerBaseOffset + centerOffset.X, centerBaseOffset + centerOffset.Y, centerSize, centerSize)); } bitmap.MakeTransparent(StyleManager.TransparencyKey); Image oldImage = pictureBox.Image; pictureBox.Image = bitmap; if (oldImage != null) { lock (oldImage) { oldImage.Dispose(); } } }
protected override void OnPaint(PaintEventArgs e) { SummaryForm.RenderText(e.Graphics, this.Text, 5, Color.Empty, StyleManager.NotificationTextColor, Color.FromArgb(64, 64, 64), this.Height, 4, this.Font, true, System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor, backColor == StyleManager.TransparencyKey ? System.Drawing.Drawing2D.SmoothingMode.None : System.Drawing.Drawing2D.SmoothingMode.HighQuality); }
public static void ShowSummaryForm(string command) { SummaryForm f = new SummaryForm(); ShowNotification(f, command); }