Draw bitmap on top
-
Hi, I want to draw a bitmap on my form, on top of the other controls, however I try to do it, it always gets drawn before the rest of the form and its controls. Does anyone know how to draw it on top? Thanks.
“If I had asked people what they wanted, they would have said faster horses.” ― Henry Ford
-
Hi, I want to draw a bitmap on my form, on top of the other controls, however I try to do it, it always gets drawn before the rest of the form and its controls. Does anyone know how to draw it on top? Thanks.
“If I had asked people what they wanted, they would have said faster horses.” ― Henry Ford
Put a Panel on the form and call BringToFront on it, then your bitmap image on the Panel. If you draw a bitmap on the form itself, it's gets drawn on the surface of the form, which sits behind all controls on the form.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak -
Put a Panel on the form and call BringToFront on it, then your bitmap image on the Panel. If you draw a bitmap on the form itself, it's gets drawn on the surface of the form, which sits behind all controls on the form.
A guide to posting questions on CodeProject[^]
Dave Kreskowiakinteraction with the Form's Controls may become a bit difficult... He'll be back with more questions! :)
Luc Pattyn [My Articles] Nil Volentibus Arduum
Fed up by FireFox memory leaks I switched to Opera and now CP doesn't perform its paste magic, so links will not be offered. Sorry.
-
interaction with the Form's Controls may become a bit difficult... He'll be back with more questions! :)
Luc Pattyn [My Articles] Nil Volentibus Arduum
Fed up by FireFox memory leaks I switched to Opera and now CP doesn't perform its paste magic, so links will not be offered. Sorry.
Yeah, I was thinking about that, then said to myself, "What do I care if the design sounds fishy? It's not my app!" :-D
A guide to posting questions on CodeProject[^]
Dave Kreskowiak -
Put a Panel on the form and call BringToFront on it, then your bitmap image on the Panel. If you draw a bitmap on the form itself, it's gets drawn on the surface of the form, which sits behind all controls on the form.
A guide to posting questions on CodeProject[^]
Dave KreskowiakThanks Dave, Using a pannel is basicaly the same a using a picture control, either way the bitmap is not shown with a transparent background so the controls cannot be seen. I probably should have mentioned this requirement. - John
“If I had asked people what they wanted, they would have said faster horses.” ― Henry Ford
-
Thanks Dave, Using a pannel is basicaly the same a using a picture control, either way the bitmap is not shown with a transparent background so the controls cannot be seen. I probably should have mentioned this requirement. - John
“If I had asked people what they wanted, they would have said faster horses.” ― Henry Ford
-
Thanks Dave, Using a pannel is basicaly the same a using a picture control, either way the bitmap is not shown with a transparent background so the controls cannot be seen. I probably should have mentioned this requirement. - John
“If I had asked people what they wanted, they would have said faster horses.” ― Henry Ford
"Transparent" is not transparent in Windows Forms. You cannot set the Backcolor of a control to Transparent and expect to see through the control. It doesn't work that way. Transparent tells the control to take on the background properties of the control that contains it. So, if you set the Backcolor of a Form to Black and the the Backcolor of a Button to Transparent, the Button will be Black, but not because you can now see through the Button. You cannot see controls "through" another control. Why? Because, in Windows Forms, window elements do not waste time painting regions of themselves where another control is obscurring them. Hence, you can't see any controls through the "transparent" regions of an image. The image may be transparent, but the control painting it is not, no matter what the Backcolor property says. Now, WPF is very different. It's not Windows Forms and doesn't have the same limitations. WPF can do what you want, but the learning curve for it is very steep.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak -
"Transparent" is not transparent in Windows Forms. You cannot set the Backcolor of a control to Transparent and expect to see through the control. It doesn't work that way. Transparent tells the control to take on the background properties of the control that contains it. So, if you set the Backcolor of a Form to Black and the the Backcolor of a Button to Transparent, the Button will be Black, but not because you can now see through the Button. You cannot see controls "through" another control. Why? Because, in Windows Forms, window elements do not waste time painting regions of themselves where another control is obscurring them. Hence, you can't see any controls through the "transparent" regions of an image. The image may be transparent, but the control painting it is not, no matter what the Backcolor property says. Now, WPF is very different. It's not Windows Forms and doesn't have the same limitations. WPF can do what you want, but the learning curve for it is very steep.
A guide to posting questions on CodeProject[^]
Dave KreskowiakHi Dave, Thanks for the info. I am not looking for a tranaparent control. I am drawing the image with Graphics.DrawImage(). I just need to draw it after the the forms controls are drawn so that it is on top. The framework is forcing me to draw it before the rest of the form, I was hoping there might be some way around this. - John
“If I had asked people what they wanted, they would have said faster horses.” ― Henry Ford