BorderBrush and Background not match - c#

I am having a problem with BorderBrush and Background. They both are set to the same gradient but as border starts higher, they don't match. How do I make it match? These are 5 buttons in the image:
Edited: I need border for rounded corners. It's not in the picture but I need 'em.

Why not make it harder on yourself? To achieve this (keep rounded corners), you can do one of two things: Adjust the border gradient (trial and error, most likely) or you will have to change the button's Template so that the face of the button is represented by a Border that has radiused corners (with a border of thickness 0) and a Background of your gradient.
Of course, since the Button template is very complex you'll have to reproduce all the animations, overlays etc on your new template.

Related

How to split a form background color in c# so one half is black and the other is white

I am stuck on figuring out how to split the background colors so the left side of the form is black and the right side of the form is white in response to the ClientSize of width and height and when the form is clicked, the background color inverses
Use two panels both equal to 50% of the form. You can then manipulate their background color.

WP8.1 Opaque hidden AppBar/CommandBar

How do I achieve opaque CommandBar/AppBar while it's hidden in WP8.1? CommandBar's property Opacity works just fine, but only when AppBar is opened. Though even then you can see non-opaque rectangle at the bottom. I want my AppBar to be opaque at all times, even when ClosedDisplayMode is set to Minimal.
[UPDATED]
"This happens because when you create a CommandBar an automatic margin is created for the ContentGrid to free a space below it for the app bar. Give the Main Grid a bottom margin by -24 and your content will show behind the command bar Like this: Margin="0,0,0,-24"
[ORIGINAL COMMENT]
I guess it is not applicable to do it with the control itself. But the workaround is to give it an opaque color. You can give the command bar a color but reduce its alpha value that controls the color's transparency.
Example: that's the Color code of the "Red" color with 80% transparency: #CCFF0000

ToolStrip TextBox Colour

I have set up a ToolStrip in my C# WinForms project and have added a TextBox on it. I'm just curious whether it is normal that the TextBox is barely visible due to the colour of the ToolStrip and TextBox.
I could put a border around it or change the background colour of the TextBox but that just looks odd.
Is there some property which I haven't thought of which I could set to make it stand out more but not look out of place?
Screenshot added:
A very light border would probably be best. if you use the same color as the toolstrip, you won't really notice the border at the bottom, but it will make the top of the search box stand out. you might also want to add a margin around it, or less padding inside of it, so it doesn't fill up the whole hight.

Masking a scrolling text in WPF

I'm working on a simple application with text animations and videos as background.
It's really similar to a simple LED scrolling text and I'm using the animations framework of WPF for this (Storyboards and timelines).
My text comes from the right side and finishes animation to the left side, thus it is visible for the entire width of the window.
Now, what if I want to display this text only in a specific rectangle of the window? The text would normally come from the right and finish to the left, but should be visible only when passing through this rectangle. Imagine it like a "rectangle hole" in the background where the text is shown.
I hope I have been straightforward in my explanation!
Thank you.
Is it an opacity mask you're after?
http://www.c-sharpcorner.com/uploadfile/dbeniwal321/implementing-opacity-masks-in-wpf/
Obviously you won't be using gradients of opacity as seen in the article - you'll use a more strict rectangle outline and play your animation as usual - using the bounds of the mask as the boundaries of your animation.
Text in a Canvas. Set the size and position of your Canvas to be your rectangle hole. With clipping on, when the text is outside the Canvas, it will not show. You just animate Canvas.Left attached property on your text.

UserControl ClientRectangle is smaller than it says

I am trying to make my UserControl with custom borders (I changed default border style to "none" in properties - I created control and I am invoking Graphics.DrawRectangle(...,ClientRectangle). And what I see is only the top and left borders of my painted rectangle - it seems that real size of the area where I can draw is different than ClientRectangle... How to change it / get the right ClientRectangle size?
ClientRectangle returns the rectangle in exclusive coordinates so you need to subtract 1 from the bottom and right hand sides. This will work regardless of how many units per pixel there are in the current graphics mode, someone correct me if I am wrong.

Categories

Resources