473,762 Members | 6,675 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

7 New Member
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_TRANSPARE NT 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 3021
Plater
7,872 Recognized Expert Expert
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
8057
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
1178
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 information. Unfortunately, as soon as the Control is placed on to with BringToTop(), all underlying Controls aren't painted anymore. The constructor looks like this:
2
6744
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 library industry (or is this just an excuse to fob us off with controls that are difficult to extend?). Therefore could anyone tell me of a company that offers decent transparent controls?
1
5423
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 (form called ProgressForm) and the built the dll. Then I reference this new assembly from within my asp.net applicaiton and tried to access Windows.Forms.ProgressBar from within the ProgressForm but apparently it doesn't work. Because it won't...
1
1563
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 ActiveX in this way but I havent worked with ActiveX before. So, is there anyone hwo can help me? Thanks
6
2341
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 is the best way to deal with these form controls...? Like, when they are all visible in the designer it can be absolute chaos... So how do you guys deal with it? Is there a blank container control (can't see one) that allows you to drop a...
3
8479
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 FormA's menu i want to close the formA and i want
0
1114
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. When I try to show my control in HTTPS, my web site don't show the control. My control to have a Strong Name and Certificate. I think that problems in Security policy but I don't know what is exactly problem. someone could can help me, please....
3
4567
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 possible to see the control lying under another. Please, give me an idea how to create a transparent controls? Is anywhere any useful examples located?
0
9377
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10136
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9925
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9811
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8814
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7358
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5266
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3913
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3509
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.