arcengine右键菜单不显示图标
做右键菜单功能,想在菜单的命令前显示图标。
代码部分:
主窗体:
..........
//打开属性表
pToolMenuLayer.AddItem(new OpenAttributeTable(), -1, 1, true, esriCommandStyles.esriCommandStyleIconAndText);
.........
.........
感觉这个esriCommandStyles.esriCommandStyles.esriCommandStyleIconAndText设置了没用。
命令:
public sealed class OpenAttributeTable : BaseCommand
{
//定义指针
private IMapControl3 pMapControl;
public OpenAttributeTable()
{
//
// TODO: Define values for the public properties
//
base.m_category = "打开属性表"; //localizable text
base.m_caption = "打开属性表"; //localizable text
base.m_message = "打开属性表"; //localizable text
base.m_toolTip = "打开属性表"; //localizable text
base.m_name = "打开属性表"; //unique id, non-localizable (e.g. "MyCategory_MyCommand")
try
{
//
// TODO: change bitmap name if necessary
//
string bitmapResourceName = GetType().Name + ".bmp";
base.m_bitmap = new Bitmap(GetType(), bitmapResourceName);
}
catch (Exception ex)
{
System.Diagnostics.Trace.WriteLine(ex.Message, "Invalid Bitmap");
}
}
调试的时候 base.m_bitmap 为null,然后进入异常 System.Diagnostics.Trace.WriteLine(ex.Message, "Invalid Bitmap");
图标:
功能没问题,就是图标不显示。。。
代码部分:
主窗体:
..........
//打开属性表
pToolMenuLayer.AddItem(new OpenAttributeTable(), -1, 1, true, esriCommandStyles.esriCommandStyleIconAndText);
.........
.........
感觉这个esriCommandStyles.esriCommandStyles.esriCommandStyleIconAndText设置了没用。
命令:
public sealed class OpenAttributeTable : BaseCommand
{
//定义指针
private IMapControl3 pMapControl;
public OpenAttributeTable()
{
//
// TODO: Define values for the public properties
//
base.m_category = "打开属性表"; //localizable text
base.m_caption = "打开属性表"; //localizable text
base.m_message = "打开属性表"; //localizable text
base.m_toolTip = "打开属性表"; //localizable text
base.m_name = "打开属性表"; //unique id, non-localizable (e.g. "MyCategory_MyCommand")
try
{
//
// TODO: change bitmap name if necessary
//
string bitmapResourceName = GetType().Name + ".bmp";
base.m_bitmap = new Bitmap(GetType(), bitmapResourceName);
}
catch (Exception ex)
{
System.Diagnostics.Trace.WriteLine(ex.Message, "Invalid Bitmap");
}
}
调试的时候 base.m_bitmap 为null,然后进入异常 System.Diagnostics.Trace.WriteLine(ex.Message, "Invalid Bitmap");
图标:
功能没问题,就是图标不显示。。。
1 个回复
xiaosi9524 - GISER
赞同来自:
2、图片格式
3、生成操作
检查下
要回复问题请先登录或注册