zoukankan      html  css  js  c++  java
  • 代码方式给控件添加背景图片(WPF)

          wpf中常常需要给控件添加背景图片,下边以wrapPanel为例,使用代码添加背景图片

             WrapPanel xwraPanel = new WrapPanel();

                ImageBrush ximgBrush = new ImageBrush();

               Uri xuri = new Uri("pack://application:,,,/Images/JXimgs/MeterLayout.png", UriKind.Absolute); //注意这个的写法      

         ximgBrush.ImageSource = new BitmapImage(xuri);        

         xwraPanel.Background = ximgBrush;

    另外我们在项目中可以设置控件的BackGround=“Transparent” 使本控件透明,而显示父容器的背景色

  • 相关阅读:
    图书管理系统
    关键路径
    最短路径

    最小生成树、最短路径
    Huffman编码
    LA 3401
    UVA 10881
    OI 刷题记录——每周更新
    4396: [Usaco2015 dec]High Card Wins
  • 原文地址:https://www.cnblogs.com/hanjiaxu/p/4432335.html
Copyright © 2011-2022 走看看