I have a problem. Im working with a picturebox and a combobox. I have an image on a picturebox and then i create graphics over a picturebox depends on the combobox item selected. When the selected combobox item change needs to clear the graphics of the picturebox but the image need to still there and create a diferent graphics.

You should save the default image of the picturebox and then use that image every time you draw graphics. I mean like this:

// Class-level variables
Image defaultImage, gImage;

public Form1()
    defaultImage = pictureBox.Image;

private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
    // This will use the picturebox's default image which has no graphics
    gImage = (Image)defaultImage.Clone();

    Graphics g = Graphics.FromImage(gImage);
    // ............
    // ............

    pictureBox.Image = gImage;

Hope that helps.


Thanks for your fast reply. L already checked and Its exactly that I need. 1000 thanks

Be happy

This question has already been answered. Start a new discussion instead.