如何在WPF中对齐画布背景? [英] How can you align a canvas background in WPF?

查看:79
本文介绍了如何在WPF中对齐画布背景?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将画布的背景设置为公司徽标的图像。我希望此图像与画布的右下角对齐。

是否可以这样做,还是需要将图像作为儿童添加到画布中?不适用于该程序,因为所有画布子元素的处理方式都不同。

I have set a canvas' background to an image of a company logo. I would like for this image to be aligned to the bottom right corner of the canvas.
Is it possible to do this, or would it require for the image to be added into the canvas as a child? That would not work with this program as all children of the canvas are handled differently.

谢谢

推荐答案

可以工作吗? (无论如何,它对我有用。)

Will this work? (It worked for me, anyway.)

  <Canvas>
    <Canvas.Background>
      <ImageBrush ImageSource="someimage.jpg" AlignmentX="Right" 
          AlignmentY="Bottom" Stretch="None" />
    </Canvas.Background>
  </Canvas>

这篇关于如何在WPF中对齐画布背景?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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