求教wpf里面MenuItem.Icon属性的问题!!! 我在XAML前台文件里,没有<MenuItem.Icon>这个节呢而我在后台给MenuItem.Icon这个属性给值,界面上直接显示system.drwaing.bitmap我晕死miConfig.Icon = global::WpfApp.Properties.Resources.Start; 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 哦,我现在找到menuitem.icon这个节了,但是还是没有图标显示呢。。在后台又怎么给值呢。。 <MenuItem> <MenuItem.Icon> <StackPanel> <Image Source="/Console;component/Icon/Mini-brightgreen.png"></Image> </StackPanel> </MenuItem.Icon> </MenuItem> 还有就是为什么我现在在前台给了image的source,还是没显示出来呢? try { BitmapImage bi = new BitmapImage(); FileStream fs = new FileStream("c:\\imgDemo.bmp", FileMode.Create); fs.Write(bHeadImage, 0, bHeadImage.GetLength(0)); fs.Close(); bi.BeginInit(); bi.StreamSource = new MemoryStream(bHeadImage, bHeadImage.GetLowerBound(0), bHeadImage.GetLength(0)); bi.EndInit(); this.imgHead.Source = bi; } catch { } 我晕,在wpf里面给menuitem添加个icon这么困难??我见menuitem提供了一个icon的属性,但是我这边用起有问题 你不是动态加载图片吗? public void HeadImageBind(byte[] bHeadImage) { try { BitmapImage bi = new BitmapImage(); FileStream fs = new FileStream("c:\\imgDemo.bmp", FileMode.Create); fs.Write(bHeadImage, 0, bHeadImage.GetLength(0)); fs.Close(); bi.BeginInit(); bi.StreamSource = new MemoryStream(bHeadImage, bHeadImage.GetLowerBound(0), bHeadImage.GetLength(0)); bi.EndInit(); this.imgUser.Source = bi; } catch { } }把你的图片转换成byte[] 调用上面的方法就行了 我仅仅只是想给Menuitem加个Icon而已。啊 C#读取配置文件 高人达人进来帮看一下我想把数据库记录生成xml格式 如何通过程序分析一段中文的关键字 如何下载图片 解释下这代码c#的 ListBox 的事件问题,请教 windows moblie拨号 不需要命令InstallUtil 安装windows服务 求求您,帮帮我吧? 怎样在xml文档中找到某个具体节点的数据 DateTime转换为字符串 decimal --小问题
<MenuItem.Icon>
<StackPanel>
<Image Source="/Console;component/Icon/Mini-brightgreen.png"></Image>
</StackPanel>
</MenuItem.Icon>
</MenuItem>
{
BitmapImage bi = new BitmapImage();
FileStream fs = new FileStream("c:\\imgDemo.bmp", FileMode.Create);
fs.Write(bHeadImage, 0, bHeadImage.GetLength(0));
fs.Close();
bi.BeginInit();
bi.StreamSource = new MemoryStream(bHeadImage, bHeadImage.GetLowerBound(0), bHeadImage.GetLength(0));
bi.EndInit();
this.imgHead.Source = bi;
}
catch { }
public void HeadImageBind(byte[] bHeadImage)
{
try
{
BitmapImage bi = new BitmapImage();
FileStream fs = new FileStream("c:\\imgDemo.bmp", FileMode.Create);
fs.Write(bHeadImage, 0, bHeadImage.GetLength(0));
fs.Close();
bi.BeginInit();
bi.StreamSource = new MemoryStream(bHeadImage, bHeadImage.GetLowerBound(0), bHeadImage.GetLength(0));
bi.EndInit();
this.imgUser.Source = bi;
}
catch { }
}
把你的图片转换成byte[] 调用上面的方法就行了