Solid Color Brush In Code with SolidColorBrush and RGB color : Brush « Windows Presentation Foundation « VB.Net Tutorial






<Window x:Class="WPFBrushes.SolidColorBrushInCode"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="WPFBrushes" Height="300" Width="300"
    >
    <Grid>
        
    </Grid>
</Window>
//File:Window.xaml.vb
Imports System.Windows
Imports System.Windows.Documents
Imports System.Windows.Controls
Imports System.Windows.Media
Imports System.Windows.Shapes

Namespace WPFBrushes
  Public Partial Class SolidColorBrushInCode
    Inherits System.Windows.Window
    Public Sub New()
      InitializeComponent()
      Me.Width = 600

      Dim sp As New StackPanel()
      sp.Margin = New Thickness(4.0)
      sp.HorizontalAlignment = HorizontalAlignment.Left
      sp.Orientation = Orientation.Vertical

      Dim tb1 As New TextBlock(New Run("Brush from RGB Color [ .Fill = new SolidColorBrush(Color.FromRgb(0, 0, 255)); ]"))
      Dim rect1 As New Rectangle()
      rect1.HorizontalAlignment = HorizontalAlignment.Left
      rect1.Width = 60
      rect1.Height = 20
      rect1.Fill = New SolidColorBrush(Color.FromRgb(0, 0, 255))

      sp.Children.Add(tb1)
      sp.Children.Add(rect1)


      Me.Content = sp
    End Sub

  End Class
End Namespace
WPF Solid Color Brush In Code With Solid Color Brush And R G B Color








16.64.Brush
16.64.1.Fill = Brushes.RedFill = Brushes.Red
16.64.2.Fill = new SolidColorBrush(Colors.Green)Fill = new SolidColorBrush(Colors.Green)
16.64.3.Fill = new SolidColorBrush(Color.FromRgb(0, 0, 255))Fill = new SolidColorBrush(Color.FromRgb(0, 0, 255))
16.64.4.Fill = new SolidColorBrush(Color.FromArgb(100, 0, 0, 255));Fill = new SolidColorBrush(Color.FromArgb(100, 0, 0, 255));
16.64.5.Using the SolidColorBrush typeUsing the SolidColorBrush type
16.64.6.Using the SolidColorBrush and Color typeUsing the SolidColorBrush and Color type
16.64.7.Describes the brush's color using ARGB values. Each value has a range of 0-255.Describes the brush's color using ARGB values. Each value has a range of 0-255.
16.64.8.Shows the predefined brushes defined by the System.Brushes class.Shows the predefined brushes defined by the System.Brushes class.
16.64.9.Drawing Brush In XAMLDrawing Brush In XAML
16.64.10.Use SolidColorBrush to paint RectangleUse SolidColorBrush to paint Rectangle
16.64.11.Solid brush using type converterSolid brush using type converter
16.64.12.Fill the underline decoration with a solid color brush in VBFill the underline decoration with a solid color brush in VB
16.64.13.Fill the strikethrough decoration with a solid color brush in VBFill the strikethrough decoration with a solid color brush in VB
16.64.14.Colors and BrushesColors and Brushes
16.64.15.Predefined brush in Brushes ClassPredefined brush in Brushes Class
16.64.16.Convert contents of a ListBoxItem to an instance of Thickness by using the BrushConverterConvert contents of a ListBoxItem to an instance of Thickness by using the BrushConverter
16.64.17.Solid Color Brush In Code with predefined brushSolid Color Brush In Code with predefined brush
16.64.18.Solid Color Brush In Code with SolidColorBrushSolid Color Brush In Code with SolidColorBrush
16.64.19.Solid Color Brush In Code with SolidColorBrush and RGB colorSolid Color Brush In Code with SolidColorBrush and RGB color
16.64.20.Fill up the ListBox with brush namesFill up the ListBox with brush names
16.64.21.DrawingBrush with DrawingGroupDrawingBrush with DrawingGroup