Need Help

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.
 
A

AC

mention this http://weblogs.asp.net/cumpsd/articles/79878.aspx
<http://weblogs.asp.net/cumpsd/articles/79878.aspx>

and write this:
We tried it out, but we are still seeing similar problems:
1. the image when viewed in an image viewer doesn't have a black
boundary around it. when it's used as the form background, there is a
black boundary.
2. when the form is dragged around, the form leaves a black shadow in
the old location, and there is a trace of such black shadow along the
path in which the form is dragged. the trace is not permanent, as
windows will draw the background image, but it is slow. in other
words, the trace is visible, and windows clears it too slowly.
3. in a separate effort, we tried using win32 to render the
irregularly shaped form, using the UpdateLayeredWindow method. It
drew the form very nicely, without the black boundary, and it didn't
leave a trace when the form was dragged around. however, the problem
was that it didn't show any controls, e.g. buttons, sliders, on it.
the controls were there but the image of the controls were not.

what we would like to achieve is similar to windows media player
(version 10), when it's shape is changed to non-rectangular. I was
playing with it and had its shape changed to a heart. It didn't have
any boundary. It didn't leave a trace of the path of dragging. there
were controls, like buttons and sliders on it. It was exactly what we
want. I noticed that windows media player was a win32 app, ie. not
..net framework. my questions are:
a. can .net framework winforms do it? if so, how?
b. how do you do it in win32 c++?
 
A

AC

http://weblogs.asp.net/cumpsd/articles/79878.aspx

We tried it out, but we are still seeing similar problems:
1. the image when viewed in an image viewer doesn't have a black
boundary around it. when it's used as the form background, there is a
black boundary.
2. when the form is dragged around, the form leaves a black shadow in
the old location, and there is a trace of such black shadow along the
path in which the form is dragged. the trace is not permanent, as
windows will draw the background image, but it is slow. in other
words, the trace is visible, and windows clears it too slowly.
3. in a separate effort, we tried using win32 to render the
irregularly shaped form, using the UpdateLayeredWindow method. It
drew the form very nicely, without the black boundary, and it didn't
leave a trace when the form was dragged around. however, the problem
was that it didn't show any controls, e.g. buttons, sliders, on it.
the controls were there but the image of the controls were not.

what we would like to achieve is similar to windows media player
(version 10), when it's shape is changed to non-rectangular. I was
playing with it and had its shape changed to a heart. It didn't have
any boundary. It didn't leave a trace of the path of dragging. there
were controls, like buttons and sliders on it. It was exactly what we
want. I noticed that windows media player was a win32 app, ie. not
..net framework. my questions are:
a. can .net framework winforms do it? if so, how?
b. how do you do it in win32 c++?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top