public override void OnClick()
{
// TODO: Add ElementProp.OnClick implementation
IGraphicsContainerSelect pPageLayoutGraphicsSelect = m_pageLayoutCtrl.PageLayout as IGraphicsContainerSelect;
IElement pElement = pPageLayoutGraphicsSelect.SelectedElement(0);
IElementProperties pElementProp = pElement as IElementProperties;
IStyleGalleryItem styleGalleryItem;
IEnvelope eExtent=pElement.Geometry.Envelope; //只在图形的最初始范围
SymbolForm symbolForm = new SymbolForm();
//Get the IStyleGalleryItem
// System.Windows.Forms.MessageBox.Show(pElementProp.Type);
// System.Windows.Forms.MessageBox.Show(pElementProp.Name);
if (pElement is IMapSurroundFrame)
{
System.Windows.Forms.MessageBox.Show("是一个IMapSurroundFrame");
IMapSurroundFrame pMapSf=pElement as IMapSurroundFrame;
IMapSurround pMapSurround = pMapSf.MapSurround;
if (pMapSurround is ILegend)
{
ILegend pLgd = pMapSurround as ILegend;
System.Windows.Forms.MessageBox.Show(pLgd.Title);
}
else if (pMapSurround is IMarkerNorthArrow)
{
styleGalleryItem = symbolForm.GetItem(esriSymbologyStyleClass.esriStyleClassNorthArrows);
// pMapSf.MapSurround = (IMapSurround)styleGalleryItem.Item;
symbolForm.Dispose();
INorthArrow pNArrow= (INorthArrow)pMapSf.MapSurround;
IMarkerNorthArrow pmNArrow = (IMarkerNorthArrow)pMapSf.MapSurround;
// ICharacterMarkerSymbol pMarker = pmNArrow.MarkerSymbol as ICharacterMarkerSymbol;
IMarkerNorthArrow pMakerNArrowItem = styleGalleryItem.Item as IMarkerNorthArrow;
// IMarkerSymbol pMarker=;
//cMs.CharacterIndex = 34;
pmNArrow.MarkerSymbol = pMakerNArrowItem.MarkerSymbol;
// IStyleGalleryItem pMark = styleGalleryItem.Item as ICharacterMarkerSymbol;
// if (pMark==null) return;
// pmNArrow.MarkerSymbol = pMark;
// pMapSf.MapSurround = pMark;
IColor color1=new RgbColorClass();
color1.RGB=34567;
pNArrow.Color = color1;
pNArrow.Refresh();
}
// m_hookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics,pMapSf, null);
//QI to IElement and set its geometry
//pElement.Geometry = envelope;
}
else if (pElement is IPictureElement)
{
System.Windows.Forms.MessageBox.Show("是一个IPictureElement");
}
else if (pElement is ITextElement)
{
System.Windows.Forms.MessageBox.Show("是一个Textelement");
ITextElement txtElement = pElement as ITextElement;
txtElement.Text = "修改标题";
}
m_hookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics,null, null);
}