Ellipse Stroke background color - c#

I have an ellipse with a stroke, so:
myEllipse.Stroke = Brushes.Yellow;
I need it to be yellow, but it doesn't always show up nicely on white backgrounds, which is pretty common in this scenario.
I was wondering if there was a way to put the Yellow Stroke on a black background.
myEllipse.Stroke = Brushes.Black;
myEllipse.Stroke = Brushes.Yellow;
Where instead of the yellow replacing the black, it would be a combination so that it always appears yellow as if the background image was black.

You could draw two ellipses on top of each other. The first would be black and slightly thicker than the second which would be yellow.
They get drawn in the order they are added to their container object (view, grid or whatever), so make sure you add them in the order "black" then "yellow".

Related

Different Background Color for each Chart quadrant

Is there a way to paint each of the 4 quadrants with a different background color? I'm using BackColor but it paints the whole chart. I can't find how to customize by area, axis, or anything.
chart1.ChartAreas[0].BackColor = Color.AliceBlue;
this is my chart:
And I want it to look like this

Green pixels around label's text

I turned the BackColor of the Form into Green and then the TransparencyKey into the BackColor (that would turn the background color of the WF into Transparent)
this.BackColor = Color.Green;
this.TransparencyKey = BackColor;
But when I run the project the label I got on the upper left-corner has a pixeled outline of color green...
I tried turning the label's BackColor into Green hoping that it will turn the pixels transparent... but that didn't happened.
Also I got an image with transparent background (.png with transparent background) and that image got the pixels too. Also tried chaning the BackColor from green to lime but that did nothing but worsening the situation (more pixels than before)...
Anyone out there know how to remove those green pixels?

Disable Antialiasing with HatchBrush?

I want to use Graphics.FillRectangle with a HatchBrush, drawing on a transparent window with a ControlStyles.SupportsTransparentBackColor style.
Therefore I must disable the line smoothing that appears when the (diagonal) lines are drawn by the hatch brush, otherwise I get a combined color of the brush's color and Magenta, which is the transparency key color, resulting in a somehow Magenta hatch, regardless of my chosen color.
I have tried various mode properties of my Graphics object, without luck.

DataGridCell background coloring

In my WPF application, I need to paint the background of a specific DataGridTextColumn cell with some color. Here is what I tried:
DataGridCell cell = ...
cell.Background = Brushes.Yellow;
Upon execution, I do see a little bit of yellow color near the right edge but the color does not cover the complete cell.
I figured it must be the TextBlock content that is getting painted on top of my yellow color. Therefore, I added the following code:
TextBlock content = cell.Content as TextBlock;
content.Text = "abc";
content.Background = Brushes.Yellow;
This results in a background color behind the text "abc." The rest of the cell is still colored in white.
I am wondering if someone can point me in the right direction.

BorderBrush and Background not match

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.

Categories

Resources