zoukankan      html  css  js  c++  java
  • 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);

  • 相关阅读:
    dubbo学习(一)认识
    MySQL学习(九)小结
    MySQL学习(八)删除表数据
    MySQL学习(六)change-buffer
    RPC 学习(一)认识
    MySQL学习(五)事务隔离
    MySQL学习(四)死锁及死锁检测
    计算机操作系统 --- 进程和进程的上下文切换
    MySQL 学习(三)事务学习
    消息队列(七)--- RocketMQ延时发送和消息重试(半原创)
  • 原文地址:https://www.cnblogs.com/xiaofoyuan/p/2582454.html
Copyright © 2011-2022 走看看