C# Aeonhack Net Seal Theme Progress Bar Wont Update - Ponzi - Feb 9, 2014
OK I have used themes for a while and edited some, I am currently using AeonHack NetSeal Converted in C#. The progress bar wont show any progress until it reaches 100%. I am not using the default theme background and edited the colors but what is wrong with it?
Current code for progressbar
PHP Code
<?php class NSProgressBar : Control {
private int _Minimum; public int Minimum { get { return _Minimum; } set { if (value < 0) { throw new Exception("Property value is not valid."); }
_Minimum = value; if (value > _Value) _Value = value; if (value > _Maximum) _Maximum = value; Invalidate(); } }
private int _Maximum = 100; public int Maximum { get { return _Maximum; } set { if (value < 0) { throw new Exception("Property value is not valid."); }
_Maximum = value; if (value < _Value) _Value = value; if (value < _Minimum) _Minimum = value; Invalidate(); } }
private int _Value; public int Value { get { return _Value; } set { if (value > _Maximum || value < _Minimum) { throw new Exception("Property value is not valid."); }
_Value = value; Invalidate(); } }
private void Increment(int amount) { Value += amount; }
public NSProgressBar() { SetStyle((ControlStyles)139286, true); SetStyle(ControlStyles.Selectable, false);
P1 = new Pen(Color.FromArgb(225,225,225)); P2 = new Pen(Color.FromArgb(238,238,238)); B1 = new SolidBrush(Color.FromArgb(100, 100, 200)); }
private GraphicsPath GP1; private GraphicsPath GP2;
private GraphicsPath GP3; private Rectangle R1;
private Rectangle R2; private Pen P1; private Pen P2; private SolidBrush B1; private LinearGradientBrush GB1;
private LinearGradientBrush GB2;
private int I1; private Graphics G;
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { G = e.Graphics;
G.Clear(BackColor); G.SmoothingMode = SmoothingMode.AntiAlias;
GP1 = ThemeModule.CreateRound(0, 0, Width - 1, Height - 1, 7); GP2 = ThemeModule.CreateRound(1, 1, Width - 3, Height - 3, 7);
R1 = new Rectangle(0, 2, Width - 1, Height - 1); GB1 = new LinearGradientBrush(R1, Color.FromArgb(255,255,255), Color.FromArgb(238,238,238), 90f);
G.SetClip(GP1); G.FillRectangle(GB1, R1);
I1 = Convert.ToInt32((_Value - _Minimum) / (_Maximum - _Minimum) * (Width - 3));
if (I1 > 1) { GP3 = ThemeModule.CreateRound(1, 1, I1, Height - 3, 7);
R2 = new Rectangle(1, 1, I1, Height - 3); GB2 = new LinearGradientBrush(R2, Color.FromArgb(100,100,200), Color.FromArgb(100,100,155), 90f);
G.FillPath(GB2, GP3); G.DrawPath(P1, GP3);
G.SetClip(GP3); G.SmoothingMode = SmoothingMode.None;
G.FillRectangle(B1, R2.X, R2.Y + 1, R2.Width, R2.Height / 2);
G.SmoothingMode = SmoothingMode.AntiAlias; G.ResetClip(); }
G.DrawPath(P2, GP1); G.DrawPath(P1, GP2); }
}
* - Only3 - Feb 10, 2014
u need the theme base most of them if not all depend on it
or learn how to convert it to control
* - xSonoro - Feb 13, 2014
(Feb 9, 2014 07:29 PM)Ponzi Wrote: OK I have used themes for a while and edited some, I am currently using AeonHack NetSeal Converted in C#. The progress bar wont show any progress until it reaches 100%. I am not using the default theme background and edited the colors but what is wrong with it?
Current code for progressbar
PHP Code
<?php class NSProgressBar : Control {
private int _Minimum; public int Minimum { get { return _Minimum; } set { if (value < 0) { throw new Exception("Property value is not valid."); }
_Minimum = value; if (value > _Value) _Value = value; if (value > _Maximum) _Maximum = value; Invalidate(); } }
private int _Maximum = 100; public int Maximum { get { return _Maximum; } set { if (value < 0) { throw new Exception("Property value is not valid."); }
_Maximum = value; if (value < _Value) _Value = value; if (value < _Minimum) _Minimum = value; Invalidate(); } }
private int _Value; public int Value { get { return _Value; } set { if (value > _Maximum || value < _Minimum) { throw new Exception("Property value is not valid."); }
_Value = value; Invalidate(); } }
private void Increment(int amount) { Value += amount; }
public NSProgressBar() { SetStyle((ControlStyles)139286, true); SetStyle(ControlStyles.Selectable, false);
P1 = new Pen(Color.FromArgb(225,225,225)); P2 = new Pen(Color.FromArgb(238,238,238)); B1 = new SolidBrush(Color.FromArgb(100, 100, 200)); }
private GraphicsPath GP1; private GraphicsPath GP2;
private GraphicsPath GP3; private Rectangle R1;
private Rectangle R2; private Pen P1; private Pen P2; private SolidBrush B1; private LinearGradientBrush GB1;
private LinearGradientBrush GB2;
private int I1; private Graphics G;
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { G = e.Graphics;
G.Clear(BackColor); G.SmoothingMode = SmoothingMode.AntiAlias;
GP1 = ThemeModule.CreateRound(0, 0, Width - 1, Height - 1, 7); GP2 = ThemeModule.CreateRound(1, 1, Width - 3, Height - 3, 7);
R1 = new Rectangle(0, 2, Width - 1, Height - 1); GB1 = new LinearGradientBrush(R1, Color.FromArgb(255,255,255), Color.FromArgb(238,238,238), 90f);
G.SetClip(GP1); G.FillRectangle(GB1, R1);
I1 = Convert.ToInt32((_Value - _Minimum) / (_Maximum - _Minimum) * (Width - 3));
if (I1 > 1) { GP3 = ThemeModule.CreateRound(1, 1, I1, Height - 3, 7);
R2 = new Rectangle(1, 1, I1, Height - 3); GB2 = new LinearGradientBrush(R2, Color.FromArgb(100,100,200), Color.FromArgb(100,100,155), 90f);
G.FillPath(GB2, GP3); G.DrawPath(P1, GP3);
G.SetClip(GP3); G.SmoothingMode = SmoothingMode.None;
G.FillRectangle(B1, R2.X, R2.Y + 1, R2.Width, R2.Height / 2);
G.SmoothingMode = SmoothingMode.AntiAlias; G.ResetClip(); }
G.DrawPath(P2, GP1); G.DrawPath(P1, GP2); }
}
You might use
everytime the value changes.
|