【问题标题】:How many pixel from 1 star (GridUnitType.Star) in WPFWPF中1颗星(GridUnitType.Star)有多少像素
【发布时间】:2016-10-05 23:38:47
【问题描述】:

我在这里找到了

var gridLength = new GridLength(1, GridUnitType.Star);

我想知道,1 星 = ?像素

在互联网上联系到我,但我找不到任何关于此的线索

谢谢。

【问题讨论】:

    标签: wpf gridlength


    【解决方案1】:

    star是相对单位,类似于css中的%,但略有不同

    //will split the grid into two columns with equal width
    <ColumnDefinition Width="1*" /> //the same as Width="*"
    <ColumnDefinition Width="1*" />
    
    
    //will split the grid into two columns with ratio 1:2 
    <ColumnDefinition Width="1*" />
    <ColumnDefinition Width="2*" />
    
    //will split the grid into two columns, first 50px (fixed), second the rest of the grid
    <ColumnDefinition Width="50" />
    <ColumnDefinition Width="*" />
    
    //will split the grid into three columns, first 50px, and the rest of the grid splitted with ratio 2:2, which is the same as 1:1
    <ColumnDefinition Width="50" /> 
    <ColumnDefinition Width="2*" />
    <ColumnDefinition Width="2*" />
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-02-13
      • 2021-10-15
      • 1970-01-01
      • 2014-10-30
      • 2011-01-11
      • 1970-01-01
      • 2019-11-12
      • 1970-01-01
      相关资源
      最近更新 更多