Message Box in Metro Style XP, W7 and W8 - c#

Let's get straight to the point, a time'm implementing a Message Box in Metro Style with Windows Forms and C #
implementation was cool, but I'm having problems with semi transparent background on windows XP, use the method:
this.BackColor = Color.FromArgb (0x46, 0x69, 0x69, 0x69);
This model worked perfectly on windows 7 and 8 on XP but not also renders simply ignores the parameter Alpha. and beyond it depending on the system model theme he does not respond to Alpha too.
Even after searching I did not find something that really works perfectly in this Annex I developed a model based on other examples, to work on Windows XP, 7 and 8, the background is semi transparent independent of themes but does not render the controls inside the form of message simply ignores all content.
Hope you can give me a help.
Thank you in advance.
Download Examples

Only Top-Level windows (Forms) support alpha transparence in Winforms, but not controls.
If you want to have semi-transparent controls in Winforms you'll have to implement that feature by yourself.
See this post as an example:
Winforms: Making a control transparent
Edit:
If you want a transparent / semi-transparent MessageBox, you have to create it yourself. Simply inherit from Form (which supports transparency) and create the look and feel that you want to have. Then you can simply set the opacity of 'your' MessageBox:
myMessageBox.Opacity = .75;
If you want more control over the appearance of your controls you should consider using WPF. Here is a WPF-controll that seems to fit your needs:
All-Purpose Message Box in WPF

Related

WPF and Windows Forms Interoperation

WPF and Windows Forms Interoperation
Description on MSDN:
In a WPF user interface, you can change the z-order of elements to control overlapping behavior. A hosted Windows Forms control is drawn in a separate HWND, so it is always drawn on top of WPF elements.
*But I would like to know there is no private way to solve it?
No, this is known as the airspace problem (because WinForms elements take all of it).
There was supposed to be a fix around .NET 4.5/4.6 but it never made it to production (source; there are others if you google it). There has been no word as of yet that Microsoft plans on addressing it.
This article might help with ways to get around it: MSDN
My first recommandation would be to replace the Windows Form control by an equivalent WPF control.
Second recommandation would be to accept the limitation and do not overlap any WPF control over the Windows Form control.
In some case, you might be able to use multiple top-level Windows to work around the limitation. You then have to write some code to properly synchronize the location or the apparent activation state of Windows...
I have never done that between Windows Form and WPF but I have done 2 top-level windows in Windows Form so that part of the UI could be semi-transparent (the purpose was to be able to overlap another application (maybe a PDF viewer) so that we can "copy" curves from existing charts).

Make a .NET Control transparent in VB6

So I've got this problem where I'm creating a control in c# .NET, and I can use it just fine in VB6. However, since you can't place borderless controls in .net containers in vb6, I've tried making a special .NET Label and exposing it to vb6.
I can get this label on my form just fine, but I can't make it transparent.
I have tried using UserControl_AmbientChanged but the Ambient.BackColor always seems to be the form's color, and not the actual parent's color (say, a frame). Same when I use UserControl.Parent and then the Parent's BackColor. Same with Extender.Parent. Even if that worked, it wouldn't be pretty in the case where the background is an image.
I've tried using SetWindowLong but that just makes the whole label invisible / transparent with no regards for the Caption.
I've tried using a bliting technique found here: http://www.vbforums.com/showthread.php?438895-transparent-text-box-or-label-with-scrollbars&highlight=transparent%20TextBox But this did not work as my controls are not PictureBoxes.
I'm out of option, has anyone done this before? How? Any help at all would be very appreciated.
If I understand your situation correctly you will want to set the .NET user control background color to something distinct (say a pink color with a specific HEX color code). Then in your VB6 application you'll set this same color code (pink) to be the transparent color within the property sheet.
I've handled transparency in VB6 user controls in this fashion for a number of years and it seems to work fine.
As for the comments regarding VB6 in 2013 for an Enterprise application, well these people obviously haven't working in the software industry for long :) VB6 has been implemented in millions of Enterprise applications that are still in use today. I would ask one question for the users that posted such comments, how can you provide the power of a VB6 ActiveX control in any other language? Answer -> You cannot.

.NET Compact Framework Transparent UserControl

I am programming a mobile application. I need a UserControl (emulating the TabContol navigation - the customer wants the tabs at the top) with a transparent background. The control contains three buttons each with an OnClick handler.
In Googling, I've found a number of solutions for WinForms. But they seemed incompatible with Win Mobile. I used the Christian Helle blog for a transparent label used in the app, but cannot wrap my mind around modifying it for UserControls.
TIA, Gus
Yeah, it's a complex task - way more complex than it should be, but it is what it is. While I never actually finished Project Resistance, it does have code for transparent user controls
The resistor body itself is a UserControl, the background shows through the surrounding area and it even dynamically draws the color bands so that the resistor body shows through the band transparent areas.

Control sizing and position will change when form will resize in win form application c#

suppose i have label and button on textbox and i want that if i resize my win form then my label and button size and position will change. i got the solution in wpf but i am working with win form apps. here i am giving the url from where you can see what kind of output i am looking form. the url is http://i.stack.imgur.com/QeoVK.png. please see the image and tell me how can i implement the same output in win form apps. please help me with code snippet in c#.thanks.
You should make yourself familiar with the Anchor and Dock properties of the controls. They are great tools for this kind of work.
Note though that they will alter the size of the controls only, they will not affect font size.
consider that window forms and WPF are very different, especially about the UI management and controls nesting / UI composition.
I have seen some articles describing what you are trying to do now in windows forms, long ego, it's something called control scaling if I recall well.
Use Anchor and Dock properties for simple stuff and SizeChanged event for more complicated stuff. UI positioning API is much more limited than WPF and you will probably have to do stuff like scaling manually.

Disable themed Window Border

In Windows XP's CMD, the Luna border isn't applied to it. alt text http://wedowebstuff.info/uploads/1272861285CMDNotThemed%5D.png
Is it possible to do it in a similar way in Visual C# Winforms, for an application? I just wonder how it's done, of course I am not going to force any of my applications to not use the beautiful XP/Aero theme :P
Thanks.
edit: Adding a note to this after many months. The Luna border isn't applied to CMD due to the fact that it is technically a 16-bit (old) application, so it does not use the standard Windows theming system (nor windowing, as demonstrated by the fact that it cannot be maximized). Applications like this are common in 32-bit windows (16-bit apps were removed in x64 Windows builds), for example, sysedit. The fact that it has a properly themed window border (but note, not the inside controls) in Vista/7, is due to the fact that Aero/Desktop Window Manager (DWM) overrides all window borders and renders them. If we switch to the Basic/Classic theme, that inconsistency continues.
The x64 cmd.exe doesn't have this problem. :)
I don't know how to modify the border, but on a side note, I do know how you can control the appearance of controls. As far as I know (I am a Linux programmer so I have limited knowledge in this field), without XPCommonControls enabled, you will have "old-style" controls, but with it, you will have "nice" buttons that are styled with the system style settings.

Categories

Resources