how does the custom skins for c# 2010 work? - c#

I'm still working on my c# application in changing the GUI and after googling around i found out that there are skins that can be used. I still don't understand how does this work, do i have to start from scratch? or will the skins merge along with my c# application. what changes will the skin do in my c# application aside from the GUI?

What i normally do for skinning is to remove form borders and set a background image,thus you can create forms of any shape.The steps i follow
Set the FormBorderStyle property to None.
Set the BackgroundImage property of the form to the .bmp you created above.
Set the TransparencyKey property of the form to the background color of the .bmp file
There are 2 parts to a winform client area and Non Client Area,You can do anything with the Client Area easily but None Client Area is uneditable.The Skinlibary you have mentioned in your comment hookes into windows message Loop to capture Events.
Check this answer to see how the Title bar color is changed Changing the color of the title bar in WinForm

Related

How to have different opacity for multiple controls?

I have a problem with the opacity of some controls.
So I set the form opacity to 0.3, when the form is loaded, and the problem is that it makes the other controls as tranparent as the form. Here is the code.
private void Form1_Load(object sender, EventArgs e)
{
this.Opacity = 0.3;
}
By doing this, all my controls are as transparent as the form. Is there any way to have different opacity for the controls inside the form ? I don't want the other to be transparent at all.
My first recommandation would be to avoid that. Having a semi-transparent background with opaque controls will look somewhat weird. Instead, consider changing the opacity when the form is active say from 0.3 to 0.7 so that it is easier to read.
Also another problem if some controls are opaque and the background is almost transparent, then your UI might not work well on some background. For example, if the background is really dark, then dark text (control) will be hard to see. If the background is white, then white controls like edit box would be the same color as the background.
You can get a few idea from other people comments. Even though some comment are for WPF, you might be able to take some idea for WinForms. And if you don't get the expected result, you might also consider using WPF for that part of the UI.
Having said that, a possible workaround to get what you want is to create two top-level windows at the same position (and move/resize them as appropriate). That way, you can have one window with a transparency key and the desired background for opaque area that will be used to have opaque and semi-transparent area. The other window will use the opacity so that it would be semi-transparent. This is the window that will contain your UI controls (and the one that would be on the top).
I have used that technic in the past to have a semi-transparent client area with a fully opaque frame in one application where I want to be able to see through client area (adjustable opacity) so that I could "draw" in my window using the image in another application as a reference.
Another comment is that you might need actual control with windows handle and direct Win32 API access for some customization that are not available in WinForms and/or WPF. In my application, I was handling activation in a way that if I click on the bottom level windows, the top-level window still appears as the active one (caption bar color). If one has no standard caption bar (either the frame is custom or no frame at all), then you would not have that problem.
As suggested by some links in the comment section, it might also be possible to get what you want using a single top-level windows. I have not tried that. In fact, when I try the above solution, I think that my application was still supported on Windows XP and as such you are more limited in options and the behavior is somewhat different essentially because XP more or less write directly to screen while Vista and later use bitmaps (buffers) for each windows.
I have also used combined transparency key and opacity for splash screen (on a single window) and it works on most system but sometime I got black background instead of desired background on some system (probably some XP machine with specific configuration).

Get rid of the transparency of a progress bar control

While there are several questions about how to make a WinForms ProgressBar control transparent, I am facing the opposite:
I.e. I am having a WinForms form (called from an Add-in Express Outlook add-in) that contains a progress bar.
On Windows 7, everything looks fine, but on Windows XP, the progress bar's background seems to shine through (as you can see in the screenshot).
One special thing is that the FormBorderStyle property of the form is set to None.
My question is:
Does anyone know the reason for this (unwanted) transparency and how to get rid of it?
Update/solution:
Thanks to John's answer I figured out that the form's TransparencyKey property was set to some strange value. After clearing it altogether, it works like a charm:
Your transparency key is set to the background color of the control. Change it to a color you will not use, such as magenta.

BackgroundColor for all windows

In my WPF-application, I want that the user can change the background color like he or she wants. How can I set the background color from the one window where I can set it to all windows in my app?
How can I manage this?
You can dynamically reference (using DynamicResource) the same SolidColorBrush defined in the Application.Resources in the backgrounds of all windows, if you then replace this resource with another brush the windows will update.
Alternatively you could create a Brush property with change notifications somewhere (e.g. in some globally accessible settings in the App class) to which you can bind.
You don't say whether its a web or desktop app., nor whether you're using MVVM pattern or not, but I would suggest that you set this in the style sheet for your application. This is then referred to in the XAML for each "window".

Changing the window control buttons in WPF

I see that many applications do not have a title bar, but still have the window controls in the upper right corner. These are also styled differently than the normal windows form controls. Is it possible to achieve this effect in WPF?
Here are some examples:
Zune Desktop software:
http://i548.photobucket.com/albums/ii356/elpedrogrande/btns2.gif
Photoshop:
http://i548.photobucket.com/albums/ii356/elpedrogrande/btns3.gif
GoTo Assist:
http://i548.photobucket.com/albums/ii356/elpedrogrande/btns1.gif
They do this by setting the window style bits so it is created without a title bar. And then draw their own, making it look like a custom one. Which is the main reason that all these programs have caption glyphs that are not identical.
You'd accomplish the same in WPF by setting the WindowStyle to None. And a whole bunch of code to get back the behavior that Windows implements automatically with the title bar. Google "WM_NCHITTEST" to find out more.

How to make the flash player background transparent in c#

I have used ShockwaveFlash activeX control to display .swf file on the form. And to make the background transparant i set Wmode to transparent but the control is not showing transparant background. How can i set the ShockwaveFlash background transparent
Thanks,
The swf file's author needs to remove its own background. Not much what you can do after doing your part.
BTW, add a winform and a flash tag will help you. Your question has nothing to do with which language you use.

Categories