c# Programming Glossary: brush
C#: TreeView owner drawing with ownerdrawtext and the weird black highlighting when clicking on a node http://stackoverflow.com/questions/1003459/c-treeview-owner-drawing-with-ownerdrawtext-and-the-weird-black-highlighting-w Color.FromArgb 255 128 128 128 Grad fill the background Brush backBrush new SolidBrush leftColour e.Graphics.FillRectangle.. 255 128 128 128 Grad fill the background Brush backBrush new SolidBrush leftColour e.Graphics.FillRectangle backBrush.. 128 128 Grad fill the background Brush backBrush new SolidBrush leftColour e.Graphics.FillRectangle backBrush itemRect Faint..
When is Dispose necessary? http://stackoverflow.com/questions/1209585/when-is-dispose-necessary bmp Pen p new Pen Color.FromArgb 128 Color.Blue 1 Brush b new SolidBrush Color.FromArgb 128 Color.Blue g.FillEllipse.. p new Pen Color.FromArgb 128 Color.Blue 1 Brush b new SolidBrush Color.FromArgb 128 Color.Blue g.FillEllipse b 0 0 99 99 g.FillRegion.. using Pen p new Pen Color.FromArgb 128 Color.Blue 1 using Brush b new SolidBrush Color.FromArgb 128 Color.Blue g.FillEllipse..
How to generate an image from text on fly at runtime http://stackoverflow.com/questions/2070365/how-to-generate-an-image-from-text-on-fly-at-runtime drawing.Clear backColor create a brush for the text Brush textBrush new SolidBrush textColor drawing.DrawString text font.. backColor create a brush for the text Brush textBrush new SolidBrush textColor drawing.DrawString text font textBrush.. create a brush for the text Brush textBrush new SolidBrush textColor drawing.DrawString text font textBrush 0 0 drawing.Save..
Draw a rectangle using Winforms http://stackoverflow.com/questions/2529567/draw-a-rectangle-using-winforms g this.panel1.CreateGraphics Pen pen new Pen Color.Black 2 Brush brush new SolidBrush this.panel1.BackgroundColor g.DrawRectangle.. Pen pen new Pen Color.Black 2 Brush brush new SolidBrush this.panel1.BackgroundColor g.DrawRectangle pen 100 100 100.. g this.panel1.CreateGraphics Pen pen new Pen Color.Black 2 Brush brush new SolidBrush this.panel1.BackColor g.FillRectangle brush..
C# : changing listbox row color? http://stackoverflow.com/questions/2554609/c-sharp-changing-listbox-row-color DrawItemEventArgs e e.DrawBackground Graphics g e.Graphics Brush myBrush Brushes.Black Brush myBrush2 Brushes.Red g.FillRectangle.. e e.DrawBackground Graphics g e.Graphics Brush myBrush Brushes.Black Brush myBrush2 Brushes.Red g.FillRectangle new.. e e.DrawBackground Graphics g e.Graphics Brush myBrush Brushes.Black Brush myBrush2 Brushes.Red g.FillRectangle new SolidBrush..
Placing Images and Strings with a C# Combobox http://stackoverflow.com/questions/4080719/placing-images-and-strings-with-a-c-sharp-combobox name e.Graphics.DrawString item.Value e.Font new SolidBrush e.ForeColor e.Bounds.Left item.Image.Width e.Bounds.Top 2 base.OnDrawItem.. new Bitmap 16 16 Graphics g Graphics.FromImage img Brush b new SolidBrush Color.FromName val g.DrawRectangle Pens.White.. 16 16 Graphics g Graphics.FromImage img Brush b new SolidBrush Color.FromName val g.DrawRectangle Pens.White 0 0 img.Width..
How do I rotate a label in C#? http://stackoverflow.com/questions/416897/how-do-i-rotate-a-label-in-c stringFormat.Trimming StringTrimming.None Brush textBrush new SolidBrush this.ForeColor Getting the width and.. stringFormat.Trimming StringTrimming.None Brush textBrush new SolidBrush this.ForeColor Getting the width and height of.. StringTrimming.None Brush textBrush new SolidBrush this.ForeColor Getting the width and height of the text which..
Colour Individual Items in a winforms ComboBox? http://stackoverflow.com/questions/4667532/colour-individual-items-in-a-winforms-combobox the forecolor based on whether or not the item is selected Brush brush if YourListOfDates e.Index DateTime.Now compare date with.. e.Index DateTime.Now compare date with your list. brush Brushes.Red else brush Brushes.Green Draw the text e.Graphics.DrawString.. date with your list. brush Brushes.Red else brush Brushes.Green Draw the text e.Graphics.DrawString text Control sender..
WPF - Auto Line Number for FlowDocument? http://stackoverflow.com/questions/6073644/wpf-auto-line-number-for-flowdocument Current background for known objects summary public Brush CurrentElementBackground get set summary Current foreground.. Current foreground for known objects summary public Brush CurrentElementForeground get set summary Gets the current fixed..
How to draw gridline on WPF Canvas? http://stackoverflow.com/questions/6434284/how-to-draw-gridline-on-wpf-canvas just drawing a grid so you could just create a DrawingBrush to draw a single grid square and tile it to fill in the rest... already have the horizontal and vertical step sizes DrawingBrush x Key GridTile Stretch None TileMode Tile Viewport 0 0 20 10.. Absolute ^^^^^^^^^^^ set the size of the tile DrawingBrush.Drawing GeometryDrawing GeometryDrawing.Geometry draw a single..
Winforms: Making a control transparent http://stackoverflow.com/questions/9358500/winforms-making-a-control-transparent 1 this.Height 1 Color frmColor this.Parent.BackColor Brush bckColor default Brush alpha m_opacity 255 100 if drag Color.. frmColor this.Parent.BackColor Brush bckColor default Brush alpha m_opacity 255 100 if drag Color dragBckColor default.. dragBckColor frmColor alpha 255 bckColor new SolidBrush Color.FromArgb alpha dragBckColor else bckColor new SolidBrush..
Why is Graphics.MeasureString() returning a higher than expected number? http://stackoverflow.com/questions/1203087/why-is-graphics-measurestring-returning-a-higher-than-expected-number out the required text. graphics.DrawString string font brush widthOfPage 2F yPoint stringformat This works fine for what..
When is Dispose necessary? http://stackoverflow.com/questions/1209585/when-is-dispose-necessary pictureBox1.Image bmp Do you have to dispose the pen and brush What about bmp and the g My main question is if these were to.. question Yes you have to dispose them not just pen and brush but also Bitmap and Graphics . They don't get disposed when..
How to generate an image from text on fly at runtime http://stackoverflow.com/questions/2070365/how-to-generate-an-image-from-text-on-fly-at-runtime img paint the background drawing.Clear backColor create a brush for the text Brush textBrush new SolidBrush textColor drawing.DrawString..
Draw a rectangle using Winforms http://stackoverflow.com/questions/2529567/draw-a-rectangle-using-winforms Pen pen new Pen Color.Black 2 Brush brush new SolidBrush this.panel1.BackgroundColor g.DrawRectangle pen.. Pen pen new Pen Color.Black 2 Brush brush new SolidBrush this.panel1.BackColor g.FillRectangle brush this.panel1.Bounds.. brush new SolidBrush this.panel1.BackColor g.FillRectangle brush this.panel1.Bounds redraws background g.DrawRectangle pen e.X..
Multiple colors in a C# .NET label http://stackoverflow.com/questions/275836/multiple-colors-in-a-c-sharp-net-label create all white background for drawing SolidBrush brush new SolidBrush Color.White g.FillRectangle brush 0 0 pb.Image.Width.. brush new SolidBrush Color.White g.FillRectangle brush 0 0 pb.Image.Width pb.Image.Height draw comma delimited elements.. elements in multiple colors string chunks Text.Split ' ' brush new SolidBrush Color.Black SolidBrush brushes new SolidBrush..
Colour Individual Items in a winforms ComboBox? http://stackoverflow.com/questions/4667532/colour-individual-items-in-a-winforms-combobox Keep your dates on a list and compare them with ID's and brush your items. private void comboBox1_DrawItem object sender DrawItemEventArgs.. based on whether or not the item is selected Brush brush if YourListOfDates e.Index DateTime.Now compare date with your.. e.Index DateTime.Now compare date with your list. brush Brushes.Red else brush Brushes.Green Draw the text e.Graphics.DrawString..
With block equivalent in C#? http://stackoverflow.com/questions/481725/with-block-equivalent-in-c block equivalent in C# I know VB.Net and am trying to brush up on my C#. Is there a With block equivalent in C# Thanks ..
TreeView Remove CheckBox by some Nodes http://stackoverflow.com/questions/4826556/treeview-remove-checkbox-by-some-nodes foreColor e.Node.ForeColor using SolidBrush brush new SolidBrush backColor e.Graphics.FillRectangle brush e.Node.Bounds.. brush new SolidBrush backColor e.Graphics.FillRectangle brush e.Node.Bounds TextRenderer.DrawText e.Graphics e.Node.Text..
How do I adjust the brightness of a color? http://stackoverflow.com/questions/737217/how-do-i-adjust-the-brightness-of-a-color like to darken an existing color for use in a gradient brush. Could somebody tell me how to do this please C# .net 2.0 GDI..
|