如何将圆圈或窗口中的任何物体居中? [英] How to center a circle or any objects in a window?

查看:101
本文介绍了如何将圆圈或窗口中的任何物体居中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨论坛!

感谢我对表达混合的疑惑的最后回复!
现在我急切地想要在我的窗口中心放一个圆圈!
显然如果我的窗口有200 * 200像素,圆的中心应该是100 * 100。
但是,问题是窗口宽度和高度设置为AUTO,因为它有在装载时适合所有屏幕。
因此我可以知道它的大小...

你能帮帮我吗?

提前谢谢

Eduardo

解决方案

Howdy Eduardo,

你想要你的圆直径相同吗?窗户的大小与其大小无关?

例如你的窗口是200,所以椭圆半径是100?如果是这样,解决办法就是使用Bindings自动修改宽度/高度。使用以下作为示例:


< Ellipse Fill =" #FFEE2D2D"行程="黑色"的Horizo​​ntalAlignment = QUOT;中心" 
VerticalAlignment = QUOT;中心"
Width =" {Binding ActualWidth,ElementName = LayoutRoot,Mode = Default}"
高度="绑定ActualHeight,ElementName = LayoutRoot,模式=默认}" />




如果不是,然后只需添加固定在像素大小的椭圆宽度/高度,并将元素水平和垂直居中。您需要确保您的网格确实处于网格模式(而不是在Canvas模式下),方法是转到工具 - >选项 - >画板 - >使用网格布局模式...

<登记/>
HTH


干杯


Hi forum!

Thanks to the last replies to my Expression Blend doubts!
Now I´ve to put a circle exactly at the center of my window!
Obviously that if my window has 200*200 px, the center of the circle should be at 100*100.
However, the problem is that the window width and height is set to AUTO, because it has to fit all the screen when it is loaded.
As a result I can´t know the size of it...

Could you help me?

thanks in advance

Eduardo

解决方案

Howdy Eduardo,

Are you wanting your circle to be the same diameter of the Window regardless of its size?

E.g. your window is 200 so your Ellipse radius is 100?


If so, the solution is to use Bindings to automatically modify the Width/Height. Use the following as an example:


<Ellipse Fill="#FFEE2D2D" Stroke="Black" HorizontalAlignment="Center" 
VerticalAlignment="Center"
Width="{Binding ActualWidth, ElementName=LayoutRoot, Mode=Default}"
Height="{Binding ActualHeight, ElementName=LayoutRoot, Mode=Default}"/>




If not, then just add your Ellipse Width/Height fixed in pixel size and center the element both Horizontally and Vertically. You need to make sure your Grid is indeed in Grid mode (and not in Canvas mode) by going to Tools->Options->Artboard->Use Grid Layout Mode...



HTH


Cheers


这篇关于如何将圆圈或窗口中的任何物体居中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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