473,386 Members | 1,654 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Windows Forms: What is the best way to create an animated topmost transparent control

Hello there,

I have got a problem and several approaches but none is really staisfying:

Lets assume we have a form. On its surface we have got several animations (like a blinking light).
This form is not owner drawn. Everything is drawn by child controls.

Now we want to go ahead and create an animation that is on top of everything of that form. Lets assume this animation was an arrow that is moving from the top left corner to the bottom right corner.

In order to achieve that I came by several "solutions":

- First one is probably the most obvious but least elegant one:
Get rid of all childcontrols on that form. Everything is drawn in the Paint event of the Form manually.
That works. But I dont like it as you couldnt really use win forms concept of creating forms only because of one single animation that is overlaying the whole surface.

- Second one:
The control, which is the host of that animation (e.g. this arrow) is on top of all other controls on that form and it is invisible while it is not used.
Once it is supposed to become visible you initialize it with a "screenshot" of the form. Then the controls becomes visible and as background it draws the screenshot of the form.
That works. But it only works, when there are no animations happening of the forms surface.

- Third approach:
I thought somehow it has to be possible by using a control that is really transparent. Meaning its style is set to WM_EX_TRANSPARENT by overriding its CreateParams method.
That might work but I havent got it running yet.
First problem is:
The background of my animation control is drawn fine. But once I change its location (as it is animated) the background is not redrawn.
Next problem is that I am pretty sure that backbuffering is not handled automatically.


Do you have any other better solutions to get this work?

It should be portable to .NET CF as well.

Thanks,
Kevin
Oct 6 '09 #1
1 2992
Plater
7,872 Expert 4TB
You should be able to say just use a picturebox (or a usercontrol) and add it to the form, "on top" of other items.
You can then just change its location with the .Left and .Top properties (X and Y coords) and move the control around. Set .Visible to true or false if you want to see it. No need to take screenshots of anything.
I believe you can supply the transparent color to a usercontrol so that only the image is displayed. Or set ownerdraw on the usercontrol and only draw the image. Or use an image with a transparent surrounding.
Oct 6 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: °Ë´óɽÈË | last post by:
HI, I create a custom transparent control, set the style is ControlStyles.DoubleBuffer, It display black background. How to create a double buffer transparent control?
0
by: felix | last post by:
Hi, I'm trying to subclass System.Windows.Forms.Control to create a Control that is fully transparent. I'd like to place this control over other Controls in order to display additional...
2
by: Simon Tamman {Uchiha Jax} | last post by:
I understand that MS made their controls annoyingly difficult to modify (for example transparency on a listbox, tab control, treeview etc) to ensure they didn't torpedo the third party control...
1
by: Mehr H | last post by:
I've been trying to figure out how i can embed a Windows.Forms.ProgressBar in my webform (aspx) file. I have tried putting a Windows.Forms.ProgressBar as public on a regular winform designer form...
1
by: Julia | last post by:
Hi, Is it possible to create a System.Windows.Forms.UserControl and then use this control from a web-page? My collegue wants me to do this but I dont know how. He sas he used to work with...
6
by: | last post by:
Just a general question... When working with a form containing a treeview or similar control... if you need to show different form fields depending on what is selected in the treeview then what...
3
by: Sudha Pune | last post by:
Hi all I have 3 windows forms and I have one user control which holds a menu like below FormA | FormB | FormC This menu will displayed at top of the all the forms If i click FormB in...
0
by: eric escobar | last post by:
I am developing a System.Windows.Forms.UserControl. I need use this control in IE with HTTPS. Now this control work well in HTTP but I don't know how I can to do for my control to work in HTTPS. ...
3
by: Ananas | last post by:
Hi, I have created a custom control. It's a rectangle with transparent background. It's possible to see the container through the control. But when controls intersect one another then it's not...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.