WPF 實現word的縮放效果

2021-09-19 21:31:15 字數 3188 閱讀 3722

原文:

wpfの實現word的縮放效果

ms-word做出的效果令人十分欣喜,那麼如何用wpf達到這個效果,下面我們來進行討論。

"

disrow

"/>

"50"/>

"slider

" grid.row="

1" horizontalalignment="

right

" width="

200"

margin="

10,0,100,0

" verticalalignment="

top" tickfrequency="

0.2"

tickplacement="

bottomright

" cursor="

hand

" issnaptotickenabled="

true

"value="

0.6" maximum="

1" largechange="

0.1" template="

" valuechanged="

slider_valuechanged_1

"/>

"textblock

" grid.row="

1" width="60"

horizontalalignment="

right

" margin="

0,0,10,0

"fontfamily="

宋體" fontsize="

15" fontweight="

light

"wrap

" verticalalignment="

top">

"value

" elementname = "

slider

" stringformat="

{}"/>

"scr

" margin="

0" verticalscrollbarvisibility="

auto

">

parent

" grid.row="

0" width="

"height="

"horizontalalignment="

center

" margin="

0,0,0,0

" verticalalignment="

top"/>

後台新增:

double

sh;

double

sw;

const

int a4_h = 297

;

const

int a4_w = 210

;

static

double

rate;

public

mainwindow()

private

void test_loaded(object

sender, routedeventargs e)

}

valuechange的**:

private

void slider_valuechanged_1(object sender, routedpropertychangedeventargse)

switch

(e.newvalue.tostring())

break

;

case

"0.2":

parent.width = a4_w * rate * 2 + 40

;

foreach (inkcanvas c in

parent.children)

break

;

case

"0.3":

break

;

case

"0.4":

parent.width = a4_w * rate * 2+20

;

foreach (inkcanvas c in

parent.children)

break

;

case

"0.5":

break

;

case

"0.6":

parent.width = a4_w *rate;

foreach (inkcanvas c in

parent.children)

break

;

case

"0.7":

break

;

case

"0.8":

parent.width = a4_w * rate * 1.5

;

foreach (inkcanvas c in

parent.children)

break

;

case

"0.9":

parent.width = a4_w * rate * 2

;

foreach (inkcanvas c in

parent.children)

break

;

case"1

":parent.width = a4_w * rate * 2.5

;

foreach (inkcanvas c in

parent.children)

break

; }

}

實現的效果:

WPF 實現縮放移動

熟悉wpf 的朋友應該知道canvas 預設是不支援scale 和offset 操作的,如果我們想對canvas 裡包含的控制項進行整體縮放或移動可能會比較麻煩。kael rowan 提供了zoomablecanvas 類可以方便實現上述效果。我們可以在xaml 中直接使用對控制項布局進行開發,而不...

WPF 實現縮放移動

熟悉wpf 的朋友應該知道canvas 預設是不支援scale 和offset 操作的,如果我們想對canvas 裡包含的控制項進行整體縮放或移動可能會比較麻煩。kael rowan 提供了zoomablecanvas 類可以方便實現上述效果。我們可以在xaml 中直接使用對控制項布局進行開發,而不...

WPF 實現水紋效果

原文 wpf 實現水紋效果 滑鼠滑過產生水紋,效果圖如下 xmal就放置了乙個img標籤 後台主要 窗體載入 private void window loaded object sender,routedeventargs e 計時器 public void tobindtimerevent tim...