I want to have a button with 2 background colors, diveded by a part of a elipse. Like this:
Whats the best way two implement this? I can't find it on the web :(
Put the rectangle and the ellipse in your controltemplate for the button (I suggest you start from the SimpleButton style in Expression Blend) just like you have in your drawing.
You can then set ClipToBounds to true on the parent border to make the parts outside the black border hidden.
Related
Is there a way I can change the icon of the expander to +/- with the color white as the foreground color? I've been looking everywhere but cant find a simple solution. Or better yet, how do I change the color of the expander icon to white? My background is a dark color, so this is why I'm asking.
You will need to create a custom control template, see this CodeProject article: http://www.codeproject.com/Articles/248112/Templating-WPF-Expander-Control
You need to change the Template, you can base it on the existing template though.
I want to create a colored border around a TextBox on a Windows Form, something like what can be done in Android (with the "ID" and "PackSize" EditText widgets):
Is this possible (without writing a gazillion LOC and sacrificing a chicken)?
There is a BorderStyle property, but that does not change the color of the border. The ForeColor and BackColor properties also do nothing helpful.
You could either:
Put the textbox in a slightly larger Panel with a dark BackColor or
Handle the Paint event and draw the border yourself.
I was wondering if I could draw the background of a tabpage in C# transparent like so I can see behind the window itself. I though it would give a cool effect but I don't know if or how I can do it.
You can set the Appearance property of TabControl to Buttons Instead of using BackColor property. That would bring transparent tab page look and cool effect.
VB & C# syntax
TabPage1.BackColor = Color.Transparent
this will show the tabpage1 color as the form color.
I'm writing a form in C# and have several panels. I need to draw a line between two of the panels. I've found online several ways to go about this, the most promising appears to be to create a third panel, make it transparent, place it on top of my original panels and draw the line here.
I'm not able to get the panel to be transparent, even if I set its BackColor and ForeColor properties to transparent (in code or in design view of VS).
Any ideas on how to make the panel itself transparent (or not Visible) but have the line I draw on it still visible on top of everything else?
Thanks in advance.
No, it's transparent. See this by giving the form's BackgroundImage a value. You'll see it through the transparent panel. Of course, that's not the kind of transparency you want, you want stacking effects to work. There is no direct support for that.
If you want layers to work then don't use controls. Use the Paint event to draw. Now there's no problem, if you want transparency then just don't paint. Draw a line across an image simply by drawing the image first. This is also the rendering model of WPF.
You can actually do this pretty easily as your own UserControl. Here's a code example:
Drawing on top of controls inside a panel (C# WinForms)
This is similar to what you were originally attempting to do, only instead of drawing a line on top of a transparent panel, this code creates an irregularly-shaped user control (which happens to be in the irregular shape of a line).
how to make any control of win application transparent. i want that i will assign a background image for the target control and will invoke a routine and that routine will create that control transparent in such a way that only image will visible. as a example suppose image has assign to picture box. the picture shape is not square rather irregular. if i can make picture box transparent then user will see the image only. basically i want to make a picture box or any control irregular shape. how to achieve it through code in c#.
thanks
In WPF, transparency is quasi for free. For the image-element, assign a png-image with an alpha mask and the image will be rendered with active transparency.
For controls with an solid background, you generally have to set the Background to a transparent Brush:
If you want to make a whole window partial transparent, you have to remove the border, set the window style to none, set the background brush to a transparent brush, and set the AllowsTransparency-property of the window to true.
there is one for ordinary winform at
http://www.youtube.com/watch?v=K_JzL4kzCoE