private void CreateFillPatternImage()
{
var width
= ( ActualWidth == 0 ? Width : ActualWidth ) == 0
? 100
: ( ActualWidth == 0 ? Width : ActualWidth );
if( double.IsNaN( width ) )
width = 100;
var height
= ( ActualHeight == 0 ? Height : ActualHeight ) == 0
? 30
: ( ActualHeight == 0 ? Height : ActualHeight );
if( double.IsNaN( height ) )
height = 30;
fillPatternImg = new Bitmap(
(int) width, (int) height );
using( var g = Graphics.FromImage(
fillPatternImg ) )
{
var rect = new Rectangle(
0, 0, (int) width, (int) height );
g.FillRectangle( Brushes.White, rect );
DrawFillPattern( g );
}
OnPropertyChanged( "FillPatternImage" );
}