将画布调整为窗口/用户控件大小 [英] Resize canvas to window / user control size

查看:115
本文介绍了将画布调整为窗口/用户控件大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我将SVG图像转换为XAML/画布.我想将此画布设置为窗口/用户控件背景.

Hi I convert SVG image to XAML/canvas. I would like set this canvas as window/user control background.

类似这样的东西:

    <Window x:Class="WpfApplication2.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            Title="MainWindow" Height="350" Width="525">

    <Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
Name="svg2383" Width="800" Height="600">

    <---->
    </Canvas>
    </Window>

我的问题是Canvas太大了,我想在窗口的高度/宽度上自动调整大小/拉伸画布.

My problem is Canvas is too much big, I would like automatic resize/stretch canvas on window height/width.

画布上的图像很复杂..http://kde-look.org/content/show.php/something_wall?content = 115863

Image on canvas is complicated..http://kde-look.org/content/show.php/something_wall?content=115863

因此设置宽度"和高度"不是解决方案,因为此画布包含其他画布.

So set Width and Height is not solution, because this canvas consist other canvas.

推荐答案

您可以将画布放在

You can put the canvas within a Viewbox. This will allow you to stretch it to fill the window, while designing it at a constant size.

这篇关于将画布调整为窗口/用户控件大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆