I am trying to make an Flipping / Sliding Effect with Winforms.
To be exact: a effect where the first Form slides/ is pushed out of the screen and the second one slides in.
After a lot of research I came to the conclusion that a Flipping effect is not working in Winforms.
I tried the following things for the sliding effect:
Embedding winforms in Wpf Application - using Windowsformshost
--> Windowsformshost doesn't support animation.
Change Location of the Forms
a. with an Timer
b. with loop
c. separate threads
-->the form is flickering & does not look professional
Screen capture - i.e. screenshots of the forms
--> same Problem: flickering
AnimateWindow Function (API)
--> the API doesn't support threading
--> sliding in AND out of both forms at the same time is not possible.
--> same Problem: flickering
Additional Infos:
I use C# ,Visual Studio 2010 (Dot net Framework 4.0)
3rd party Controls - Telerik
On my Form are Custom Controls (extended Telerik controls)
I have set Doubblebuffered to True for the controls.
It would be really helpful if somebody could help/suggest to overcome this issue (winforms Flipping/Sliding Effect).
Regards, WickedSquall
The best option would be
5. Switch to WPF. It runs on DirectX and you need that.
But I guess that's not an option. The most workable seems your option 3 , moving bitmaps. The flickering should be solvable with double-buffering etc.
Here our final solution:
We decided to bring this issue to a third party who has more experience with graphics.
The best solution with our knowledge moving Pictureboxs with Screenshots and an Timer.
Regards
Related
I have to play a video in my C# program and I have to make it so that users can't interact with it, since the PC will be set in a public area.
I tried unchecking Enable Control and I also set uiMode to 'none', but CTRL+P (Pause) still works. This makes me think that other hotkeys do as well.
How can I set it so that you can't do anything with the video?
Edit:
I'm using Winforms, because it seems to be easier. I'm not really a C# developer, I have 0 experience and it resembles VB back from school.
In case you are developing WPF application, there is MediaElement you can use. It doesn't have any control for user interaction. Developer has to built it manually using buttons, progress bar, etc in case he need to provide control for user interaction.
And the usage is very straightforward :
<MediaElement Source="path_to_video-file.mp4" />
For reference :
Sample Application in MSDN
http://www.wpf-tutorial.com/audio-video/playing-video/
PS: It turns out that you are developing winform apps instead of WPF. In case this option still interesting for you to try, you can use ElementHost to embed WPF control in winform.
This is one of many tutorials available on net about how to use ElementHost control : http://tech.pro/tutorial/799/wpf-tutorial-using-wpf-in-winforms.
Have you tried putting another transparent WINDOW in front of the media player (area only if needed). While not totally befinner level, that is not exactly super science either.
As WINDOWS can go in front, that should block any interaction with the media player while - due to transparency - still showing the video.
MAybe even a control works (panel with nothing on it), but given that media player is a native control it may be needed to hide it behind a transparent window.
WOuld help to know what UI technology you use.... Winforms or WPF.
I am developing a tetris like game in winforms(C# and .netframework 2.0).
The winform has an background image and a picture-box which move down(new Location is assigned) at an interval of 500ms.
The problem is when picture-box moves down the background image of form flickers at the point where the picture-box was earlier located. If i don't use any background image, then there is no flickering.
Is there any graphics accelerator or any kind of solution using which the flickering problem can be solved.
The term used for this is Double Buffering. The idea is simple - start with 2 panes but only display one. Draw to a hidden pane, and quickly swap the hidden and visible panes. Rinse and repeat for every transition (animation).
Luckily, you dont have to deal with the nuts and bolts of this in .NET, controls do it for you. This SO question will help you: How to double buffer .NET controls on a form?
Set DoubleBuffered = true on your controls. This should help prevent flickering.
For documentation on the DoubleBuffered property, see here:
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.doublebuffered.aspx
If you are developing a game in Windows Forms you really ought to be overriding OnPaint and implementing painting of the sprites on every frame, as opposed to moving heavyweight PictureBox controls.
You will find you may get the flicker regardless of DoubleBuffer if you use the approach you mentioned. However, with all drawing done in OnPaint, then DoubleBuffer begins to work.
I did a quick search and found this interesting article on creating a game-loop in Windows Forms using OnPaint override. In particular take a look at GameStateDrawer which does the rendering directly to graphics context.
I'm writing an app in C# WPF and I'm hoping to implement a similar kind of touch-based horizontal scrolling that's featured prominently in Windows 8.
At the moment I'm using ScrollViewer with content inside it. This works fine as far as the scrolling is concerned, but it creates problems when interacting with controls inside of it (for example, sliders).
With my limited programming knowledge (a month ago the most I'd done was create a mockup in Photoshop :P), I'd assume this was because the touch hits the ScrollViewer first? Is there some way of flipping this around? I would be happy even if you had to hit a white space to be able to scroll, I just need the user to be able to interact with the controls inside easily without accidentally scrolling all over the place ^_^
Unfortunately, I can't just code for Windows 8 as this is specifically for a bunch of touch-enabled Windows 7 machines.
Look for the Metro theme here you might find some usful style here that you can modify and use..
Also you can check this website for information and guidelines on Metro UI on WPF
I am writing a WPF application using Csharp. Its a touch application that has four browser windows displayed. Two upside down. The screen will be built into a table and lie flat. Four people will use the table - two on one side and two on the other. Thus the need for the upside down (or 180 degree rotation) browsers. I have tried using SilverLight and its Browser Brush. This works to display the browser content upside down BUT to interact with the browser you have to make the browser control active (instead of the Brush) and this turns the content back the right way up. I guess what I need is a Browser control that can be rotated in the normal way and work rotated. IE in Dot Net wont work.
Sascha Barber and Chris Cavanagh have blog posts about an alternative WebBrowser Control based on Chromium that behaves like a real WPF control. Check out http://sachabarber.net/?p=597 and http://chriscavanagh.wordpress.com/2009/08/25/a-real-wpf-webbrowser/
If it is WPF application you can use a simple RotateTransform to rotate controls any degree you want. So upside down should be no problem.
Sample/Tutorial
I have a C# winforms project and I want to add a bit of jQuery or iPhone style animation flash to it.
Nothing too fancy just an easy way to slide and expand panels, perhaps a bit of rotation.
Is there a library out there that would do this all for me?
You can also inject WPF controls into your WinForms apps if you're wanting to add stuff in to an existing project. Here's a good tutorial on how it's done.
I'm not sure if it would work for drawing 3D or rotating (although it might), but you can def use WPF in your WinForms. I haven't tried using the expander myself, but other controls I've used worked just fine.
If you're using .NET 3.5 you can use WPF to achieve animations.