Hi,
I needed to use flood fill on a map program, I have a picture box that displays a map, each country has a label control on it. I found the code which worked ok. I added it to my program, on running the program all the label controls on the map went White - no text was visible, another label control on the form also went White and the menu strip went White, none of the menu options were visible.
One of my techniques to find errors is to reduce, so I started a new project put a picture box and a label and a button and a menu strip on the form. Made the picture box image my Map. Put the label control on the map, and added the flood fill code. The code in the button calls the flood fill code to colour the map at the label controls location. On running the program again the label and the menu strip turned White, the flood fill worked.
I reduced this again, I started a new project, added a Picture box, label and a menu strip and the following code:
In Declarations
My Bitmap as Bitmap
In FORM_LOAD
MyBitmap = New Bitmap(Picturebox.Image)
Label1.Parent = Picturebox
Label1.Location = NewPoint(300,300)
In Picturebox PAINT_EVENT
Picturebox.Image = myBitmap
The only other code is what vb adds when the project is created.
Again when running the program the label and the menu strip turned White. I put some code in the label Click event to change its colour, when clicked nothing happened, I put a breakpoint in the label click event to see if the code ran it did but the colour did not change. Next I rem'd out the code from the Picturebox PaintEvent, now the label and the menu strip do not change and when I click the label it's colour changes.
So my problem appears to be Picturebox.Image = myBitmap. Can anyone tell me what's wrong, I can understand the label in the picture box being altered, but how come the menu strip is changed?
Thanks for any suggestions, ToastyJones
I needed to use flood fill on a map program, I have a picture box that displays a map, each country has a label control on it. I found the code which worked ok. I added it to my program, on running the program all the label controls on the map went White - no text was visible, another label control on the form also went White and the menu strip went White, none of the menu options were visible.
One of my techniques to find errors is to reduce, so I started a new project put a picture box and a label and a button and a menu strip on the form. Made the picture box image my Map. Put the label control on the map, and added the flood fill code. The code in the button calls the flood fill code to colour the map at the label controls location. On running the program again the label and the menu strip turned White, the flood fill worked.
I reduced this again, I started a new project, added a Picture box, label and a menu strip and the following code:
In Declarations
My Bitmap as Bitmap
In FORM_LOAD
MyBitmap = New Bitmap(Picturebox.Image)
Label1.Parent = Picturebox
Label1.Location = NewPoint(300,300)
In Picturebox PAINT_EVENT
Picturebox.Image = myBitmap
The only other code is what vb adds when the project is created.
Again when running the program the label and the menu strip turned White. I put some code in the label Click event to change its colour, when clicked nothing happened, I put a breakpoint in the label click event to see if the code ran it did but the colour did not change. Next I rem'd out the code from the Picturebox PaintEvent, now the label and the menu strip do not change and when I click the label it's colour changes.
So my problem appears to be Picturebox.Image = myBitmap. Can anyone tell me what's wrong, I can understand the label in the picture box being altered, but how come the menu strip is changed?
Thanks for any suggestions, ToastyJones