Fill the strikethrough decoration with a solid color brush in VB : Brush « Windows Presentation Foundation « VB.Net






Fill the strikethrough decoration with a solid color brush in VB

Fill the strikethrough decoration with a solid color brush in VB
     

<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  x:Class="TextDecorationExample.Window1"
  Title="TextDecoration Example"
  Width="720"
  Height="400"
  Loaded="WindowLoaded">
  <StackPanel>
      <TextBlock Name="strikethroughTextBlock" FontSize="24" Width="180" VerticalAlignment="Center">The lazy dog</TextBlock>

  </StackPanel>
</Window>

//File:Window.xaml.vb
Imports System
Imports System.Windows
Imports System.Windows.Media

Namespace TextDecorationExample
  Public Partial Class Window1
    Inherits Window
    Private Sub WindowLoaded(sender As Object, e As EventArgs)
      ' Fill the overline decoration with a solid color brush.
      Dim myCollection As New TextDecorationCollection()
      Dim myStrikeThrough As New TextDecoration()
      myStrikeThrough.Location = TextDecorationLocation.Strikethrough

      ' Set the solid color brush.
      myStrikeThrough.Pen = New Pen(Brushes.Blue, 1)
      myStrikeThrough.PenThicknessUnit = TextDecorationUnit.FontRecommended

      ' Set the underline decoration to the text block.
      myCollection.Add(myStrikeThrough)
      strikethroughTextBlock.TextDecorations = myCollection
    End Sub

  End Class
End Namespace

   
    
    
    
    
  








Related examples in the same category

1.Fill = Brushes.RedFill = Brushes.Red
2.Fill = new SolidColorBrush(Colors.Green)Fill = new SolidColorBrush(Colors.Green)
3.Fill = new SolidColorBrush(Color.FromRgb(0, 0, 255))Fill = new SolidColorBrush(Color.FromRgb(0, 0, 255))
4.Fill = new SolidColorBrush(Color.FromArgb(100, 0, 0, 255));Fill = new SolidColorBrush(Color.FromArgb(100, 0, 0, 255));
5.Using the SolidColorBrush typeUsing the SolidColorBrush type
6.Using the SolidColorBrush and Color typeUsing the SolidColorBrush and Color type
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.
8.Shows the predefined brushes defined by the System.Brushes class.Shows the predefined brushes defined by the System.Brushes class.
9.Drawing Brush In XAMLDrawing Brush In XAML
10.Use SolidColorBrush to paint RectangleUse SolidColorBrush to paint Rectangle
11.Solid brush using type converterSolid brush using type converter
12.Fill the underline decoration with a solid color brush in VBFill the underline decoration with a solid color brush in VB
13.Colors and BrushesColors and Brushes
14.Predefined brush in Brushes ClassPredefined brush in Brushes Class
15.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.Solid Color Brush In Code with predefined brushSolid Color Brush In Code with predefined brush
17.Solid Color Brush In Code with SolidColorBrushSolid Color Brush In Code with SolidColorBrush
18.Solid Color Brush In Code with SolidColorBrush and RGB colorSolid Color Brush In Code with SolidColorBrush and RGB color
19.Fill up the ListBox with brush namesFill up the ListBox with brush names
20.DrawingBrush with DrawingGroupDrawingBrush with DrawingGroup