天天看點

WPF 與Surface 2.0 SDK 親密接觸 - 圖形縮放篇

     通過上一篇的介紹大家應該已經了解到ScatterView 可以使開發者友善的實作控件的Manipulate 操作。細心的朋友可能發現了前面示例中矩形的縮放似乎有些問題,為了便于說明我們編寫如下代碼。

<Grid>      <s:ScatterView>          <Rectangle Fill="Blue" Width="200" Height="100"/>          <Ellipse Fill="Red" Width="150" Height="80"/>      </s:ScatterView>  </Grid>        

     在ScatterView 中分别加入了矩形和橢圓形,并且為兩個圖形分析别限定了長、寬尺寸。當我們對圖形進行縮放操作時發現,兩個圖形本身尺寸并沒有發生任何變化,隻有ScatterViewItem 尺寸變大了。似乎圖形的大小已經被長、寬參數限制住了。

<Grid>      <s:ScatterView>          <Rectangle Fill="Blue" Width="200" Height="100"/>          <Viewbox>              <Rectangle Fill="Red" Width="200" Height="100"/>          </Viewbox>      </s:ScatterView>  </Grid>        

繼續閱讀