• wp7 在Grid中实现元素叠加


    //创建Border
     Border imageBorder = new Border();
     imageBorder.Width = picWidth;
     imageBorder.Height = picWidth;


     //创建Grid
     Grid imageGrid = new Grid();
     imageGrid.Width = imageBorder.Width;
     imageGrid.Height = imageBorder.Height;

     //设置Grid为Borde的子元素
     imageBorder.Child = imageGrid;

     
    //创建图片
    Image image = new Image();
     //设置图片资源
     image.Source = new BitmapImage(new Uri(imageurl, UriKind.Relative));
     //添加图片到Grid中
     imageGrid.Children.Add(image);

    ImageBrush imageBrush = new ImageBrush();
                        imageBrush.ImageSource = new BitmapImage(new Uri(imageurl, UriKind.Relative));
                        imageGrid.Background = imageBrush;

                        image.Width = imageGrid.Width - 14;
                        image.Height = imageGrid.Height - 14;

                        descImage.Source = new BitmapImage(new Uri(imageurl, UriKind.Relative));
                        descImage.Width = imageGrid.Width;
                        descImage.Height = 60;
                        descImage.VerticalAlignment = VerticalAlignment.Bottom;
                        //descImage.Margin = new Thickness(0,50,0,7);
                        //添加说明图片到Grid中
                        imageGrid.Children.Add(descImage);


                        RichTextBox priceText = new RichTextBox();
                        priceText.HorizontalAlignment = HorizontalAlignment.Left;
                        priceText.VerticalAlignment = VerticalAlignment.Bottom;
                        priceText.FontSize = 20;
                        priceText.FontFamily = new FontFamily("Microsoft MHei Light");
                        priceText.Margin = new Thickness(2, 0, 0, 7.5);
                        imageGrid.Children.Add(priceText);

                         RichTextBox text = new RichTextBox();
                        text.HorizontalAlignment = HorizontalAlignment.Right;
                        text.VerticalAlignment = VerticalAlignment.Bottom;
                        text.FontSize = 20;
                        text.Margin = new Thickness(2, 0, 0, 9);
                        text.FontFamily = new FontFamily("Microsoft MHei Light");
                        imageGrid.Children.Add(text);

  • 相关阅读:
    智能家居——安全信息收集(一)
    PMP软件管理之路——站在巨人的肩膀上(一)
    Linux——信息收集(二)Nikto网页服务器扫描器
    XML约束(3)
    xml基本语法(2)
    xml概述(1)
    ajax接受json响应
    ajax接受json响应(讲义)
    json与xml的比较
    零碎小技能
  • 原文地址:https://www.cnblogs.com/xiaofoyuan/p/2582454.html
Copyright © 2020-2023  润新知