Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WPF
  4. Problems with scaling and stretching objects...

Problems with scaling and stretching objects...

Scheduled Pinned Locked Moved WPF
csharpcsswpfhelpquestion
6 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gethomast
    wrote on last edited by
    #1

    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!

    J 1 Reply Last reply
    0
    • G gethomast

      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!

      J Offline
      J Offline
      Jammer 0
      wrote on last edited by
      #2

      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

      G 1 Reply Last reply
      0
      • J Jammer 0

        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

        G Offline
        G Offline
        gethomast
        wrote on last edited by
        #3

        Thank you! I tried it. But how to put multiple objects (Images, polylines etc.) into one ViewBox?

        J 2 Replies Last reply
        0
        • G gethomast

          Thank you! I tried it. But how to put multiple objects (Images, polylines etc.) into one ViewBox?

          J Offline
          J Offline
          Jammer 0
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          • G gethomast

            Thank you! I tried it. But how to put multiple objects (Images, polylines etc.) into one ViewBox?

            J Offline
            J Offline
            Jammer 0
            wrote on last edited by
            #5

            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

            G 1 Reply Last reply
            0
            • J Jammer 0

              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

              G Offline
              G Offline
              gethomast
              wrote on last edited by
              #6

              Thank you! :rolleyes:

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups