[RESOLVED] PictureBox Shows Above Frame
I'm maintaining VB6 app that is having some UI troubles. A timer ticks in the background and when some conditions are met, it uses a 3rd party API to take a picture.
The app doesn't use forms for windows. When the user clicks a button that would normally open a window, it just make a frame visible and centers that frame. So if the frame is visible while the picture is taken, the picturebox on the form appears above the frame.
Anyone have any ideas on how I can fix this issue? I've tried a bunch of things already. The strange thing is, if I close the frame (which just changes the visible property to false) and then open it again, everything is fine. So I put a button on that frame that does that.
Code:
frame.Visible = False
frame.Visible = True
But the application crashes immediately. No idea why. There's an issue with my debug environment, so I can't debug it right now.
Re: PictureBox Shows Above Frame
What do you mean by "The app doesn't use forms for windows." Where are the button and frame located?
Can you post your code.
Re: PictureBox Shows Above Frame
Quote:
Originally Posted by
SamOscarBrown
Can you post your code.
There's no relevant code for this. But no, I couldn't.
Quote:
What do you mean by "The app doesn't use forms for windows."
You know when you'd make a button to open a window for settings or something similar? It doesn't use a form to open that window. Instead, it uses a frame. The frame is pre-made and resides out of the form's bounds. When it is called, it is placed in the middle of the form and is turned visible.
Quote:
Where are the button and frame located?
The button to open the frame is on the form. The button to close the frame is on the frame.
Re: PictureBox Shows Above Frame
On your button click event that centers the frame...put this in:
Frame1.ZOrder 0
Re: PictureBox Shows Above Frame
Quote:
Originally Posted by
SamOscarBrown
On your button click event that centers the frame...put this in:
Frame1.ZOrder 0
Forgot to mention that I tried that. Didn't work.
I fixed it though. Well, sort of. Changing the frame visible property to false and then to true was crashing it via button press. But that was a test to see if that would fix the issue. Not idea why it was crashing the app, but I decided just to put that code in the timer and see if it worked. It did. There's a flash of course, but it works for now. I'll be converting the app to C# soon anyway, so it doesn't need to be pretty.