Problems with scaling and stretching objects...
-
Hi Everybody! WPF is a great Framework. I love it! My problem: I created some polyline objects with Blend, exported and placed them into my window with a grid. Now I resized my window and my objects resized too, but not as I would like it. The objects moved in all directions. It looks ugly... I want to achive a resizing method like stretching an image. Several parts should by resized or stretched as a whole. Maybe resizing the buffer where the objects are rendered? Do you have a solution or idea? Thank you!
-
Hi Everybody! WPF is a great Framework. I love it! My problem: I created some polyline objects with Blend, exported and placed them into my window with a grid. Now I resized my window and my objects resized too, but not as I would like it. The objects moved in all directions. It looks ugly... I want to achive a resizing method like stretching an image. Several parts should by resized or stretched as a whole. Maybe resizing the buffer where the objects are rendered? Do you have a solution or idea? Thank you!
-
Hey There, Have a look at this: http://msdn.microsoft.com/en-us/library/ms741838.aspx[^] I'm sure you'll find the answer here ...
Jammer Going where everyone here has gone before! :) My Blog
-
Thank you! I tried it. But how to put multiple objects (Images, polylines etc.) into one ViewBox?
Viewbox can only have one child so use something like a Canvass. I was just having a play around in Blend to knock up a demo for you but I'm seeing some REALLY odd behaviour with a Viewbox here so it may have to wait a while until I can figure out what is going on here. I've used Viewbox's with complex/multiple path objects before with no problems.
Jammer Going where everyone here has gone before! :) My Blog
-
Thank you! I tried it. But how to put multiple objects (Images, polylines etc.) into one ViewBox?
Lob this into a window and have a play around ...
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="MultipleItemsInViewbox.Window1"
x:Name="Window"
Title="Window1"
Width="200" Height="200">
<Grid x:Name="LayoutRoot" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="25"/>
</Grid.RowDefinitions>
<Viewbox Grid.Row="0" Grid.RowSpan="1" Stretch="UniformToFill">
<Canvas Width="200" Height="200">
<Path Fill="#FF008C38" Stretch="Fill" Stroke="#FF000000" Width="97.458" Height="76.636" Canvas.Left="23" Canvas.Top="33.172" Data="M23,53 L44.5,94.5 C44.5,94.5 108.5,131.5 110.5,86.5 112.5,41.5 136.5,40.500057 96.5,38.500066 56.5,36.500075 48.499938,26.500119 38.499962,40.500056 28.499987,54.499992 23,53 23,53 z" StrokeThickness="4"/>
<Path Fill="#FF66FF00" Stretch="Fill" Stroke="#FF000000" StrokeThickness="4" Width="99.03" Height="95.15" Canvas.Left="78.394" Canvas.Top="25.137" Data="M95,63 C95,63 145,0 161,41 177,82 182,84.000101 164,100.00018 146,116.00025 146.00007,127.0003 113.00002,109.00022 79.999981,91.000132 92.999997,61.999804 82.999985,66.999801 72.999972,71.999797 95,63 95,63 z"/>
</Canvas>
</Viewbox>
</Grid>
</Window>Jammer Going where everyone here has gone before! :) My Blog
-
Lob this into a window and have a play around ...
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="MultipleItemsInViewbox.Window1"
x:Name="Window"
Title="Window1"
Width="200" Height="200">
<Grid x:Name="LayoutRoot" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="25"/>
</Grid.RowDefinitions>
<Viewbox Grid.Row="0" Grid.RowSpan="1" Stretch="UniformToFill">
<Canvas Width="200" Height="200">
<Path Fill="#FF008C38" Stretch="Fill" Stroke="#FF000000" Width="97.458" Height="76.636" Canvas.Left="23" Canvas.Top="33.172" Data="M23,53 L44.5,94.5 C44.5,94.5 108.5,131.5 110.5,86.5 112.5,41.5 136.5,40.500057 96.5,38.500066 56.5,36.500075 48.499938,26.500119 38.499962,40.500056 28.499987,54.499992 23,53 23,53 z" StrokeThickness="4"/>
<Path Fill="#FF66FF00" Stretch="Fill" Stroke="#FF000000" StrokeThickness="4" Width="99.03" Height="95.15" Canvas.Left="78.394" Canvas.Top="25.137" Data="M95,63 C95,63 145,0 161,41 177,82 182,84.000101 164,100.00018 146,116.00025 146.00007,127.0003 113.00002,109.00022 79.999981,91.000132 92.999997,61.999804 82.999985,66.999801 72.999972,71.999797 95,63 95,63 z"/>
</Canvas>
</Viewbox>
</Grid>
</Window>Jammer Going where everyone here has gone before! :) My Blog