I am using a picture box in my application to display a bitmap. However on a radio button it should clear the contents of the bitmap.
I have been trying for ages to find a way to clear the contents.
However im not getting anywhere.
My app is kinda like mouse spy so I copy the contents under the mouse to the box. So you should think there would be a command to clear the contents but I cant find any documentation for visual c++ on the stupid picture box control
Hi,
you need to set the picture property of picture box to nothing.
in VB i use the following.try similar statement in VC as well.it should work.
Set Picture1.Picture = Nothing
Yeah VB makes super light work of this,
However can you think of the command I need to send to the control?
There must be something.
did you try "Picture1.Picture=null;" ? this would be the corresponding command to the vb one.
i donīt know that much about windows/c but in delphi i use:
Picture1.Bitmap.Free();
Picture1.Bitmap:=new TBitmap();
you should be able to find the corresponding commands for c.
did this help?
Well you say set picture1 = null etc but in c its does not seem anywhere near as easy :-(
I have implemented a slight workaround which is to have 2 bitmaps one which never changes and one which shows the bitmap, I just toggle the visible state. Its not great but it works fine.
Unless someone actually has any C code to set the picturebox control back to nothing (ie show the button face colour again).
Thanks though
does my second suggestion not work? it should...
you destroy the old bitmap (free the memory) and just create a new one. let me try to translate the lines to c: