<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>My Silverlight Blog : bitmap</title><link>http://blogs.msdn.com/timrule/archive/tags/bitmap/default.aspx</link><description>Tags: bitmap</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Scale 9 Image for Silverlight</title><link>http://blogs.msdn.com/timrule/archive/2008/05/12/scale-9-image-for-silverlight.aspx</link><pubDate>Tue, 13 May 2008 03:15:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8497747</guid><dc:creator>Tim Rule</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/timrule/comments/8497747.aspx</comments><wfw:commentRss>http://blogs.msdn.com/timrule/commentrss.aspx?PostID=8497747</wfw:commentRss><description>&lt;P&gt;&amp;nbsp; A scale 9 image divides an image into 9 regions which each scale differently when an image is scaled. Click on the "Toggle Full Screen" to try the example. Drag the white square with a red border to resize the shape.&lt;/P&gt;&lt;IFRAME style="WIDTH: 500px; HEIGHT: 300px" src="http://silverlight.services.live.com/invoke/63894/Scale%209%20Demo/iframe.html" frameBorder=0 scrolling=no mce_src="http://silverlight.services.live.com/invoke/63894/Scale%209%20Demo/iframe.html"&gt;&lt;/IFRAME&gt;
&lt;P&gt;Take the following bitmap for example:&lt;/P&gt;
&lt;P&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" border=0 alt=Scale9Box src="http://blogs.msdn.com/blogfiles/timrule/WindowsLiveWriter/Scale9ImageforSilverlight_F23E/Scale9Box_3.png" width=200 height=100 mce_src="http://blogs.msdn.com/blogfiles/timrule/WindowsLiveWriter/Scale9ImageforSilverlight_F23E/Scale9Box_3.png"&gt;&lt;/P&gt;
&lt;P&gt;By defining a center Rectangle there is enough information for a smarter scaling of the image. In the case of scale 9 the corners will not scale when the image is resized. The edges will scale parallel to their orientation. The center will scale in both direction.&lt;/P&gt;
&lt;P&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" border=0 alt=Scale9BoxLines src="http://blogs.msdn.com/blogfiles/timrule/WindowsLiveWriter/Scale9ImageforSilverlight_F23E/Scale9BoxLines_3.png" width=200 height=100 mce_src="http://blogs.msdn.com/blogfiles/timrule/WindowsLiveWriter/Scale9ImageforSilverlight_F23E/Scale9BoxLines_3.png"&gt;&lt;/P&gt;
&lt;P&gt;This type of image construct can be useful for creating rich bitmap graphics for the backgrounds of sizable containers. &lt;/P&gt;
&lt;P&gt;Here is a sample usage of the control. The ImageSize is the "Width,Height" of the source image and the CenterRect defines the grow region of the control.&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" border=0 alt=image src="http://blogs.msdn.com/blogfiles/timrule/WindowsLiveWriter/Scale9ImageforSilverlight_F23E/image_6.png" width=447 height=38 mce_src="http://blogs.msdn.com/blogfiles/timrule/WindowsLiveWriter/Scale9ImageforSilverlight_F23E/image_6.png"&gt;&lt;/P&gt;
&lt;P&gt;The control is composed of a Grid with a Canvas in each cell of the Grid. Each Canvas contains an Image which has a Clip property as well as a TranslateTransform and a ScaleTransform. All these values are adjusted programmatically when a resize occurs to the control.&lt;/P&gt;
&lt;P&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" border=0 alt=image src="http://blogs.msdn.com/blogfiles/timrule/WindowsLiveWriter/Scale9ImageforSilverlight_F23E/image_3.png" width=514 height=219 mce_src="http://blogs.msdn.com/blogfiles/timrule/WindowsLiveWriter/Scale9ImageforSilverlight_F23E/image_3.png"&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8497747" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/timrule/attachment/8497747.ashx" length="80771" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/timrule/archive/tags/effects/default.aspx">effects</category><category domain="http://blogs.msdn.com/timrule/archive/tags/silverlight/default.aspx">silverlight</category><category domain="http://blogs.msdn.com/timrule/archive/tags/scale+9/default.aspx">scale 9</category><category domain="http://blogs.msdn.com/timrule/archive/tags/bitmap/default.aspx">bitmap</category><category domain="http://blogs.msdn.com/timrule/archive/tags/silverlight+2+beta+2/default.aspx">silverlight 2 beta 2</category></item></channel></rss>