I want to make a Life bar.
I can make a basic one in Form1, no problem -see the code below.
But I want now to make a Class that is holding some properties for this Life bar, like value,position, size, color, isfull, ishalf, isalmostdead,is dead, but the most important, I want it to be drawn in a paint event too.
and in Form1_Paint to paint it from that Class... somehow.
--------
in pseudocode it should look like this:
private void Form1_Paint(object sender, PaintEventArgs e)
{
Class1.PaintLifeBar(); //and thats it!
//(or something similar) here i give you an idea how it should look.)
}
--------
It is possible?
If yes, how?
What I have tried:
private void Form1_Paint(object sender, PaintEventArgs e)
{
e.Graphics.FillRectangle(new SolidBrush(Color.LawnGreen), new Rectangle(10, 10, 55, 5));
}