I have an application where, beyond my control, several Windows Forms have a TransparencyKey property set. When these windows cover (are in front of) another form which has a DirectDraw video surface, the foreground form flickers (partly showing the form and partly showing the video beneath). The thing is, the color of the TransparencyKey doesn't appear anywhere in the application, so NOTHING should be transparent... in other words, the result should be that the foreground form is completely opaque.
Does anyone have experience with DirectDraw surfaces flickering when combined with Windows Forms that are in some form or other set up to be transparent? I've worked on this for weeks, with no success. Thanks!
I'm sorry but I would suggest that you abandon that goal completely and try to do it some other way.
DirectDraw is one way of displaying stuff on the screen, and forms with regions (that are created on the fly as masks from so called 'transparent key color') are done with GDI. As I see it (and would like to be proven otherwise) - you won't be able to combine that two windows anyway.
And you will probably get different results on different Windows, depending on the version, graphics card used, and so on.
On the other side, can you hack those forms that you don't have the control over and remove TransparencyKey property from them? Even with Win32 API?
Related
I'm trying to rebuild the "Window Snip" functionality from the Microsoft "Snipping Tool"
I know how to get the boundaries of a window by first getting the window handle with p/invoke from the cursors point and after that getting the windows RECT also with a p/invoke method.
The problem I'm facing is that when I'm trying to implement an overlay like the snipping tool does I'm always getting my own applications handle.
I think the problem lies in the way I’m trying to implement that overlay. At the moment I am instancing a new form with the boundaries of the screen, Background is White with 50% opacity. I have a TransparencyKey with the color Fuchsia. My goal is that my overlay is completely transparent for the window where the mouse cursor is. (Like Snipping Tool does) For that I planning to draw a rectangle in Fuchsia with the boundaries of the underlying window to my overlay form (effectively making that spot transparent).
Is there a way to ignore my own window in the p/invoke method? Or is my idea to use a form for the overlay the wrong way to go and there is a simpler way to achieve the wanted behavior?
is there any way that winforms or WPF can do this kind of UI? transparent with blur window.
A forenote: Windows 8 removes the Aero Glass effect. Windows will appear with a solid background where there would be glass (like how they appear on Windows 7 when you disable the glass effect but still run the DWM).
That said, the effect is done using Win32's DwmExtendFrameIntoClientArea function. Using this in your program differs depending on whether you're using WPF or WinForms (as WPF windows do some pretty interesting window subclassing, and of course, WPF controls are largely windowless).
To get a "whole glass" window, you just use the DwmExtendFrameIntoClientArea function to fill your window, rather than just the first 50px or so, which is what IE and other browsers do.
This is the canonical MSDN article on how to do this with WPF: http://msdn.microsoft.com/en-us/library/ms748975.aspx
For WinForms, see this blog article: http://blogs.msdn.com/b/tims/archive/2006/04/18/578637.aspx
Enjoy, but not for long considering Windows 8...
I am using C# to make my desktop applications.
But I want to make more graphical applications that have full transparency backgrounds and different levels of transparency for picture box controls.
Basically, not cookie cutter opacity of removing a solid color.
How can I accomplish this with C#?
It is simple, just go ahead with WPF. This gived me a good start point.
This should help:
http://www.c-sharpcorner.com/UploadFile/scottlysle/XparentFormsCS10282007212944PM/XparentFormsCS.aspx
also
form2.Opacity = .x; where x is percentage of transparency
or
transparency can be directly edited in appearance property of form in case you are using VSTO
http://i.imgur.com/OXfC7.png
I have a c# form application that has a fixed size (cannot be resized) and cannot be maximized. Users who have a different setting for their icon/text sizes breaks my GUI (the entire form is bigger, background images start tiling, etc.
Help?
Microsoft recommends that a user change their DPI (dots per inch) settings and keep their native resolution rather than change the resolution to enlarge the visible display. This article also links to guides for building DPI aware applications.
http://msdn.microsoft.com/en-us/library/dd371771(VS.85).aspx
You should allow your forms and controls to scale, the user would most probably have changed their DPI settings for a reason. This reason is most probably related to accessibility and, as developers, we should strive to adhere to user interface and accessibility standards.
This usually increases the amount of work to create assets for web sites and applications. Also, thought should be put into the positioning of controls to ensure that they will not overlap or fall off the edge of the form when scaled. The best way to ensure that your application is compliant is to test at both ends of the spectrum and the normal recommended settings for usage.
As for disabling maximising of the form, this should only be done if you can ensure that the form will fit on the smallest of displays without issue. I have used applications on a netbook with a 7" screen that cannot be maximised, and they just don't fit, there is limited space to move the form around to access certain controls. If these could be maximised, I would then expect all controls to be visible, or can be able to scroll to reach them.
It is a challenge to develop a solution for all, but your end users will appreciate the work you have put in, if your application works correctly. Accessibility is a sensitive area and we should be making the effort to provide interfaces to cater for all users.
Well, sounds like you should allow it to be resized...
Quite frankly, even MS has gotten the hint and started changing most of their forms and even dialogs to be resizable. It's the friendly thing to do.
UPDATE:
A couple things come to mind on how to fix this. First, set the background image to Stretch. For the button, instead of using an image to display the text, just use a background image that has some transparency and use a regular font.
You should be a little more description of what you want. Since I'm not sure what you want to actually happen, you can prevent the form elements from resizing by changing your forms property AutoScaleMode to None.
I have a screen in my windows mobile app that I is intended for another person than the user to look at and interact with (it is a signature screen).
There is a few edit boxes and such on that screen. Is there any way to make them display upside down?
If so I would love to hear how. Thanks!
Are the controls (except the signature) purely for viewing (i.e. interaction is not needed)? If so, I'd be inclined to just take a screen shot, rotate that bitmap, draw it to the Form's background and then put the signature control on top of that.