LoginSignup
2
1

More than 5 years have passed since last update.

InkCanvasとViewbox

Posted at

Windowのサイズ変更に応じてInkCanvasの大きさを変えたかったので
Viewboxの中に放り込んだら、
InkCnavasの端っこで描くと勝手にサイズを変更してしまうみたいだった。
かなり鬱陶しい

    <Grid>
        <Rectangle Fill="Black" />
        <Viewbox>
            <InkCanvas />
        </Viewbox>
    </Grid>

最初の状態
01.png

下に線を引いたら、それに引っ張られるように縦長に
02.png

右に線を引いたら右に伸びた
03.png

InkCanvasのWidth, Heightを指定する

    <Grid>
        <Rectangle Fill="Black" />
        <Viewbox>
            <InkCanvas Width="400" Height="300" />
        </Viewbox>
    </Grid>

すると、端で描いてもサイズが変わらなくなった
04.png

なんでかようわからんけど、まぁよし

2
1
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1