zoukankan      html  css  js  c++  java
  • Margin 属性的一些边界情况说明 转http://blog.csdn.net/ghj1976/article/details/4987686

    Margin 属性的一些边界情况说明

    分类: Silverlight 194人阅读 评论(1) 收藏 举报

    我们来看例子,下面的椭圆显示的将不是完整的一个椭圆。

    Xaml 文件:

    <UserControl
    	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    	xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    	x:Class="MySilverlight3StudyApplication.MainPage"
    	Width="640" Height="480" mc:Ignorable="d">
    		<Ellipse Stroke="Black" StrokeThickness="10" Height="64" 
    		Margin="313,256,200,30" 
    		VerticalAlignment="Top" HorizontalAlignment="Left" Width="197"/>
    UserControl>

    执行效果如下图:

    image

    出现椭圆被劫了一部分的原因是 Margin="313,256,200,30"  在作怪。

    Margin:获取或设置元素的外边距。上面的313,256,200,30 依次是 left,top,right,bottom

    上面的右边距X坐标是通过下面算出来的 640(父控件宽度)-200(right Margin) = 440。 而正常椭圆的最右边点的X坐标为 313(left Margin)+10(left StrokeThickness)+197(Ellipse  Width)+10(right StrokeThickness)= 530。

    由于椭圆的最右边已经在 计算出来的右边距之外了,在之外的部分就没有显示,所以就会有上面的情况发生。

  • 相关阅读:
    【bzoj2242】[SDOI2011]计算器
    1109解题报告
    【bzoj3239】Discrete Logging
    【bzoj2480】Spoj3105 Mod
    【POJ1811】Prime Test
    【bzoj3667】Rabin-Miller算法
    【HDU2138】How many prime numbers
    卢卡斯定理
    线段树2
    畅快的甩卖
  • 原文地址:https://www.cnblogs.com/songtzu/p/2441793.html
Copyright © 2011-2022 走看看