C# 中 没有找到合适的方法重写,哪位大侠知道一下啊
publicoverridevoidOnMouseDown(intButton,intShift,intX,intY){if(Button!=1){return;}//弹...
public override void OnMouseDown(int Button, int Shift, int X, int Y)
{
if (Button != 1)
{
return;
}
//弹出输入字体的对话框
PutInStringDialog myPutInString = new PutInStringDialog("请输入要添加的文字标注:","默认标注");
myPutInString.ShowDialog();
if (myPutInString.IfOk == false)
{
return;
}
//建立并弹出字体选择框
SelectSymbolDialog symbolForm = new SelectSymbolDialog("请选择文字的显示样式:");
//得到选择的字体样式
IStyleGalleryItem styleGalleryItem = symbolForm.GetItem(esriSymbologyStyleClass.esriStyleClassTextSymbols);
//释放形状弹出的选择窗体,如果没选择即为空 退出函数
symbolForm.Dispose();
if (styleGalleryItem == null)
{
return;
}
ITextSymbol myTextSymbol = (ITextSymbol)styleGalleryItem.Item;
//建立一个点,并赋值给其坐标
IPoint myPoint = new PointClass();
myPoint=this._pageLayout.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y);
//创建一个文本元素
ITextElement myTextElement = new TextElementClass();
myTextElement.Text = myPutInString.PutInText;
//给文本元素的样式标志属性赋值,包括字体和样式
myTextElement.Symbol = myTextSymbol;
//类型转换
IElement myElement = (IElement)myTextElement;
//设置文本元素的几何体标志,以确定位置
myElement.Geometry = myPoint;
//吧该元素添加到载体控件的容器中
this._pageLayout.ActiveView.GraphicsContainer.AddElement(myElement, 0);
//刷新载体控件
this._pageLayout.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics , myElement, null);
} 展开
{
if (Button != 1)
{
return;
}
//弹出输入字体的对话框
PutInStringDialog myPutInString = new PutInStringDialog("请输入要添加的文字标注:","默认标注");
myPutInString.ShowDialog();
if (myPutInString.IfOk == false)
{
return;
}
//建立并弹出字体选择框
SelectSymbolDialog symbolForm = new SelectSymbolDialog("请选择文字的显示样式:");
//得到选择的字体样式
IStyleGalleryItem styleGalleryItem = symbolForm.GetItem(esriSymbologyStyleClass.esriStyleClassTextSymbols);
//释放形状弹出的选择窗体,如果没选择即为空 退出函数
symbolForm.Dispose();
if (styleGalleryItem == null)
{
return;
}
ITextSymbol myTextSymbol = (ITextSymbol)styleGalleryItem.Item;
//建立一个点,并赋值给其坐标
IPoint myPoint = new PointClass();
myPoint=this._pageLayout.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y);
//创建一个文本元素
ITextElement myTextElement = new TextElementClass();
myTextElement.Text = myPutInString.PutInText;
//给文本元素的样式标志属性赋值,包括字体和样式
myTextElement.Symbol = myTextSymbol;
//类型转换
IElement myElement = (IElement)myTextElement;
//设置文本元素的几何体标志,以确定位置
myElement.Geometry = myPoint;
//吧该元素添加到载体控件的容器中
this._pageLayout.ActiveView.GraphicsContainer.AddElement(myElement, 0);
//刷新载体控件
this._pageLayout.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics , myElement, null);
} 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询