Update bitmap on button click

110 views Asked by At

I am drawing a box with certain measurements and updating the angle at which it is viewed which I set as a double 'offset'. I am trying to get the view to change as I click a button to increase its offset. How would I update the bitmap to reflect the button click.

"

    public void Form1_Load(object sender, EventArgs e)
    {
        myBitmap = new Bitmap(this.ClientRectangle.Width,
            this.ClientRectangle.Height);

        graphicsObj = Graphics.FromImage(myBitmap);
        Pen linePen = new Pen(Color.Red, 3);
        graphicsObj.Drawline(linePen, 50, 50, 100, 50);

    public void Form1_Paint(object sender, PaintEventArgs e)
    {
        Graphics graphicsObj = e.Graphics;
        graphicsObj.DrawImage(myBitmap, 0, 0, myBitmap.Width, myBitmap.Height);
     }

    public void button1_Click(object sender, EventArgs e)
    {
        offsetButton = offsetButton + .10;
        **call or update bitmap**
    }

"

0

There are 0 answers