Windows Forms advanced visual effects - c#

I have an design idea about the appearence of a small program , which is basically a windows form with a combo and one button.What i would like to do is the following.When i click on the .exe of the program to start it , i would like to have an non-standart start up of the window.To be more specific i will give you an example - i click on the .exe , upon which some dots appear in a random matter all over the screen , after those points appear they start moving in a spiral way so finally they merge into the standart square windows form shape.So my question is - is there a free API or anything similar with the help of which its easily doable or there would be a lot of work needed from myself to create those API's ?
Thanks in advance

This will be extremely difficult to do.
It will also be very annoying for the end-users.

In short I see two options:
Render your form to a bitmap and render peices of the bitmap to a full-screen layered window. You'll have to call UpdateLayeredWindow repeatedly to get the animation working but that should be a good lead. I could see getting 10-20 fps with this method.
Take a screenshot of the desktop, create a full screen borderless topmost window, render the screenshot, then render your animation on top. This will prevent any other windows from recieving input while the animation is playing.
Either way your users will hate you.

As SLaks has already said, that will be pretty annoying for the end-users.
If you ask whether it is doable, I would say yes, everything is doable in programming, it all depends on the effort you're ready to put into.
As a very simple algorithm, here are some steps I would go through for your achievement:
Create a System.Windows.Forms.Form;
Set Form.ShowInTaskBar= false;
Set the Form.TransparencyKey property;
Set the Form.ControlBox= false;
Set Form.TopMost= true;
Drop a PictureBox control on your Form;
On the Form.Load event, take a screenshot of the current desktop and set it as the image of your PictureBox.
Then, build an animated GIF, and superpose it to your form.
You will most likely appreciate, I guess, the following link which discusses about C# Winforms Animation.
Disclaimer: This is an arbitrary algorithm off the top of my head. Besides, I illustrated the steps I would go through in order to achieve such objective, though I have never ever performed WindowsForms animation.
Althouth this might be cool to program, users are conservatives and "always anxious" about program startups, so, as already mentioned, this might become pretty annoying for the end-users.
I hope this helps you through anyway!

Related

Setting a C# Form to a Negative Location

I am working on a tool for Windows that will interface with CloudApp using its API. I found some articles on here about how to achieve the Region capture which I used to modified to fit my exact needs. Everything is going very well, but I am having trouble with a multi-monitor setup. The reason for the trouble, is that I run one monitor in 1920x1080 and the second is 1080x1920.
The overall flow is that I create an image of the entire screen (3000, 1920), then I show it as the background in a form. The issue is I can't get that form to start at a negative point so it moves everything down.
If I look at the raw image I capture before I do the region selection, all is well:
http://img.paronity.com/KsiA
The issue is when I go to bring up the region form. In order for it to be the background of the form and be in the correct place, I would need the form's upper left X,Y to be (0,-670). No matter which method I try, I am unable to achieve this.
Is there any way to achieve the negative point that I am missing? For sake of being complete, I made a very simple form which outputs its "top" coordinate when you move it, and when I move it to the upper portion of the vertical monitor, I get negative points for it so I know they are valid.
Let me know if any part of my code would be helpful and I will post it. I just wasn't sure it was going to be necessary. Thanks in advance!
Sorry for the post. It is possible to do. The issue was that I was setting the size of the form in the constructor for the form. I wasn't aware this wouldn't work. Once I set it on the form load event instead, it moved it into the right place.
Thanks #dognose! You saying your test worked made me think that is was probably a scope/placement issue and it was! Thanks for everyone looking at this question!

Taking screenshot of a partially hidden window in a programmatic way

Is it possible to get a screenshot of a window that is not on the top, i.e. if it is partially hidden by another window, without bringing it to the top?
Unfortunately, it's not trivial to take a screen-shot in C# at all, you can create a graphics object based on the current window or viewport and capture that, but its not what you're asking for.
This
Screenshot of Hidden Window
might help, but you'd have to do this with Interop code anyway.
I dare say that it's not a common thing that is supported as really, one program has no business knowing what's being displayed in another program; it's potentially a nasty exploit.
You dont need to take screenshot, if it is your application you can use Control.DrawToBitmap(Bitmap bitmap, Rectangle targetBounds); of the form object.
If it is other application window, you can try un-managed way to get the UI of window. I dont remember all the methods but I have tried and it was working. Probably GetWindow and SendMesage with WM_PRINT / WM_PRINTCLIENT

How to place a control over the task bar in windows using c#

i googled a lot and found out some info about the band object from which we can make the ad-in for the task bar, can i get some more tutorials from scratch & some sample programmes.
is there any other alternative way is there to place a control over the windows task bar apart from band objects?
Thanks in advance
If you want to place a textbox in the taskbar like the Google Desktop search bar, then you're not actually trying to place the control over the taskbar, you want to place it within the taskbar.
The proper solution here is a Desk Band. You can find an MSDN article explaining those here. I'm not really sure why you say that you want to avoid band objects. That's the right way to do this.
There's even a sample implementation in C# available on Code Project: Extending Explorer with Band Objects using .NET and Windows Forms
To make a window overlap the Taskbar you can set it's TopMost property to true. But then you will have to control the positioning yourself, and it will also overlap anything else beneath it, but it is a solution at least :)

WPF - Resizing chromeless windows using attached behaviors,..Any suggestions?

Who fancies a challenge?
I'm currently working on the ControlTemplate for a chromeless Window which will be a part of a reusable theme assembly. I want the behaviors for moving, closing, minimizing and restoring to be implicit so I've written attached behaviors for this functionality which I've then included in the template.
Now,..I've come to resizing and I've come to a junction. For better or worse I'm handling the mouse move in the behavior and finding whether the cursor is inside the resizing 'zones'. I'm far enough to change the cursor appropriately but now I've gotten to actually resizing the window there are three options I've come across.
I could hand-ball the affair and adjust the Left & Top and Width & Height as needed. This is the simplest option and is easily achievable using attached behaviors but it seems like moderately heavy lifting and I understand that WPF will continue to render as the window is adjusted causing flickering,..which sucks.
The second option is to get a message hook and listen for WM_NCHITTEST and the like but the solutions I've found so far involve me sub-classing Window and I don't want to force consumers of the theme to use any controls that aren't framework provided.
The last option is to somehow draw a rectangle on the screen showing the are the Window will take up as the mouse is dragged and then resize on MouseUp,..which seems doable but it's not something I've done before so some pointers on that would be cool.
So,..what should I do? The Win32 route seems like my best option so far but I'd rather not if someone has a 'purer' solution that works. I'm happy to get suggestions with option 3 and anything right up to .Net 4 in case some dynamic magic might be possible.
Thanks in advance.

Capture a scrolling window contents screenshot

I need to capture a screenshot of the scrolling window's client area, using .NET. My first priority is capturing web page screenshots. But this can be not the only one use case. For example it can be also a text area in the Notepad.
Some applications (FastStone Capture, PicPick) can emulate user behavior to reach hidden part of a scrollable area and capture it. I'm looking for something like this or recommendations for alternative way to get the same result.
You can get windows to redirect a WM_PAINT to an offscreen buffer with WM_PRINT and WM_PRINTCLIENT. This is better than screenscraping because it makes sure that obscured parts of a window(behind other windows) is painted anyway. If your target window scrolls by scrolling a child window position, WM_PRINT should apply. Just maybe it also helps your scenario.
I've continued my search and founded IECapt, — an open source tool which can take a web page screenshot using IE inside of it. It has С++ and .NET versions. Also there are Qt/WebKit-based analog from the same author: http://cutycapt.sourceforge.net.
This tools is not a direct answer for my question, but both of them solve the original problem by 90%.
Have you looked at Snagit? http://www.techsmith.com/download/accessories/default.asp
Also, here's a c# utility that seems to do what you're asking for: http://www.codeproject.com/KB/graphics/IECapture.aspx

Categories