strayromeo
宠辱不惊,闲看庭前花开花落。 去留无意,谩随天外云卷云舒。

            wpf如何将图片设置为窗体的背景

            System.Drawing.Bitmap bitmap = global::WpfApplication1.Properties.Resources.bg;
            ImageSourceConverter convert = new ImageSourceConverter();
            System.IO.MemoryStream ms = new System.IO.MemoryStream();
            bitmap.Save(ms, System.Drawing.Imaging.ImageFormat.Gif);
            ImageBrush b = new ImageBrush();
            b.ImageSource = (ImageSource)convert.ConvertFrom(ms);
            this.Background = b;

posted on 2010-07-01 19:26  strayromeo  阅读(3650)  评论(0编辑  收藏  举报