久久国产成人av_抖音国产毛片_a片网站免费观看_A片无码播放手机在线观看,色五月在线观看,亚洲精品m在线观看,女人自慰的免费网址,悠悠在线观看精品视频,一级日本片免费的,亚洲精品久,国产精品成人久久久久久久

分享

WPF 如何動態(tài)確定Grid行列數并插入控件

 牛人的尾巴 2016-04-04
C# code
private void InitRows(int rowCount,Grid g) { while (rowCount-- > 0) { RowDefinition rd = new RowDefinition(); rd.Height = new GridLength(); g.RowDefinitions.Add(rd); } } private void InitColumns(int colCount, Grid g) { while (colCount-- > 0) { ColumnDefinition rd = new ColumnDefinition(); rd.Width = new GridLength(); g.ColumnDefinitions.Add(rd); } } private void Init(Grid g) { InitRows(5, g); InitColumns(5, g); for (int r = 0; r < 5; r++) { for (int c = 0; c < 5; c++) { Image img = new Image(); g.Children.Add(img); Grid.SetColumn(img, c); Grid.SetRow(img, r); } } }
用戶名:bloodish  得分:15  時間:2011-01-01 04:39:29

C# code
for (int i = 0; i < 5; i++) { LayoutRoot.ColumnDefinitions.Add( new ColumnDefinition()); // * //new ColumnDefinition() { Width = GridLength.Auto }); // Auto //new ColumnDefinition() { Width = new GridLength(double.NaN, GridUnitType.Star) }); * //new ColumnDefinition() { Width = new GridLength(0.1, GridUnitType.Star) }); // 0.1* //new ColumnDefinition() { Width = new GridLength(100) }); // 100 } for (int i = 0; i < 5; i++) { LayoutRoot.RowDefinitions.Add( new RowDefinition()); // * } LayoutRoot.ShowGridLines = true; // create a image GeometryGroup ellipses = new GeometryGroup(); ellipses.Children.Add(new EllipseGeometry(new Point(40, 40), 20, 30)); ellipses.Children.Add(new EllipseGeometry(new Point(40, 40), 30, 20)); GeometryDrawing geo = new GeometryDrawing(); geo.Geometry = ellipses; geo.Brush = Brushes.Brown; geo.Pen = new Pen(Brushes.Black, 2); DrawingImage image = new DrawingImage(geo); image.Freeze(); Image[,] images = new Image[5, 5]; for (int row = 0; row < 5; row++) { for (int col = 0; col < 5; col++) { images[col, row] = new Image(); images[col, row].Source = image; images[col, row].SetValue(Grid.ColumnProperty, col); images[col, row].SetValue(Grid.RowProperty, row); LayoutRoot.Children.Add(images[col, row]); } }

    本站是提供個人知識管理的網絡存儲空間,所有內容均由用戶發(fā)布,,不代表本站觀點,。請注意甄別內容中的聯(lián)系方式、誘導購買等信息,,謹防詐騙。如發(fā)現(xiàn)有害或侵權內容,請點擊一鍵舉報,。
    轉藏 分享 獻花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多