A
AC
This is the description of my problems.
I used three ways to develop irregular-shaped WinForms :
1. Firstly I set the form's FormBorderStyle property to None.
I set the form's BackColor property to Color.Black and the
Transparent key property to the same color, then I drew the form's
background using Graphics.DrawImage Method.
2. Like Method 1, I first set the form's FormBorderStyle property to
None, then I changed the form's Region property. I built the region by
building a GraphicsPath Object from a background Bitmap I used in the
application and stored it in my assembly to use it in the future.
3. I used a different way to draw the window. I drew the background
image by using Win32 Function UpdateLayeredWindow and set the form's
style to LayeredWindow.
I got different results on them but none of them satisfied our
requirements.
a. By using the first method, I could draw the form fast but there was
black margin around the shape and when I change the background Bitmap
in runtime the screen would flicker even though I had used
DoubleBuffer.
b. For the second method, the flickering shrinks a lot, but the
process of dragging the window cost a lot of system resources and
there was still a black margin around the Bitmap object.
c. The last method maybe the best of all, and the margin disappeared ,
the problem of resource consumption did not exist, the window didn't
flicker any more. But there was a big problem on it : the controls on
the form just "disappeared" but still could be used when I click the
controls' region(or area), the system just ignored the images of
the controls.
The last solution seems fit us well and I want to know if there is
some
way to eliminate the problem of the last solution and make my controls
visible. Or if can not, how can I do to improve the performance of
solution 1 and 2?
That's it. Great thanks.
I used three ways to develop irregular-shaped WinForms :
1. Firstly I set the form's FormBorderStyle property to None.
I set the form's BackColor property to Color.Black and the
Transparent key property to the same color, then I drew the form's
background using Graphics.DrawImage Method.
2. Like Method 1, I first set the form's FormBorderStyle property to
None, then I changed the form's Region property. I built the region by
building a GraphicsPath Object from a background Bitmap I used in the
application and stored it in my assembly to use it in the future.
3. I used a different way to draw the window. I drew the background
image by using Win32 Function UpdateLayeredWindow and set the form's
style to LayeredWindow.
I got different results on them but none of them satisfied our
requirements.
a. By using the first method, I could draw the form fast but there was
black margin around the shape and when I change the background Bitmap
in runtime the screen would flicker even though I had used
DoubleBuffer.
b. For the second method, the flickering shrinks a lot, but the
process of dragging the window cost a lot of system resources and
there was still a black margin around the Bitmap object.
c. The last method maybe the best of all, and the margin disappeared ,
the problem of resource consumption did not exist, the window didn't
flicker any more. But there was a big problem on it : the controls on
the form just "disappeared" but still could be used when I click the
controls' region(or area), the system just ignored the images of
the controls.
The last solution seems fit us well and I want to know if there is
some
way to eliminate the problem of the last solution and make my controls
visible. Or if can not, how can I do to improve the performance of
solution 1 and 2?
That's it. Great thanks.