-
Rotate Element
private
IHookHelper
m_hookHelper =
null
;
private
IPoint
m_pPoint;
private
IElement
m_pElement;
//private bool
m_bMoving;
private
IPoint
m_oldPoint;
private
IElement
m_viewElement;
public
RotateElement()
{
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.
try
string
bitmapResourceName =
GetType().Name +
;
base
.m_bitmap =
n
ew
Bitmap
(GetType(),
bitmapResourceName);
base
.m_cursor =
new
.
Cursor
(GetType(),
GetType().Name +
);
}
catch
(
Exception
ex)
st
ics.
Trace
.WriteLine(e,
);
RotateElement(
IFeatureLayer
annotationLayer) :
this
()
{
AnnotationLayer = annotationLayer;
}
publicoverridevoid
OnCreate(
object
hook)
{
try
{
m_hookHelper =
new
HookHelper
Class
();m_ = hook;
if
(m_View ==
null
){ m_hookHelper =
null
;
catch
{m_hookHelper =
null
;
if
(m_hookHelper ==
null
)
base
.m_enabled =
false
;
elsebase
.m_enabled =
true
;
publicoverridevoid
OnClick()
// TODO: Add k implementation
publicoverridevoid
OnMouseDown(
int
Button,
int
Shift,
int
X,
int
Y)
{
if
(Button != 1)
return
;
IGraphicsContainer
pGraphicsContainer = m_View
as
IGraphicsContainer
; m_pPoint =
m_oint(X, Y);
IEnumElement
pEnumElement =
Elements(m_pPoint, 0.1);
m_pElement =
null
;
//
赋初始值为
null
if
(pEnumElement ==
null
)
return
;
m_pElement = ();
//
第一个
element
if
(m_pElement
is
AnnotationElem
ent
) {
if
(AnnotationLayer ==
null
)
ILayer
pLayer
=
LayerHelperClass
.GetFeatureLayer(
注记
< br>
,
m_ap);
AnnotationLayer = pLayer
as
IFeatureLayer
;
}
if
(AnnotationLayer ==
null
)
{
MessageBox
.Show(
未找到注记图层
,
错误
,
MessageBoxButtons
.OK,
MessageBoxIcon
.Error);
return
;
}
//
根据注记的参考坐标调整字体显示大小【修正部分】<
/p>
?
IAnnotationClassExtension
pAnnotationClassExtension =
ion
as
IAnnotationClassExtension
< br>;
ITextSymbol
pSymbol = (
(
ITextElement
)m_pElement).Sy
mbol;
= /
(m_le /
nceScale);
ITextElement
pTextElement =
new
TextElementClass
{ Text =
((
ITextElement
p>
)m_pElement).Text, Symbol = pSymbol };
m_viewElement =
pTextElement
as
IElement
;
m_ry = m_ry;
m_ment(m_viewElement, 0);
m_lRefresh(
esriViewDrawPhase
.esriViewGraphics,
m_viewElement,
null
); }
//
移动状态信息
//m_bMoving =
true;}
publicoverridevoid
OnMouseMove(
int
Button,
int
Shift,
int
X,
int
Y)
{
if
(Button != 1 ||
m_pElement ==
null
)
return
;
IPoint
centerPoint =
new
PointClass
{
X = (m_eft.X +
m_ight.X) / 2,
Y = (m_eft.Y +
m_ight.Y) / 2
};
if
(m_pElement
is
AnnotationElement
)
{
//
如果旧点为空,则赋
MouseDown
事件所获取的点值
if
(m_oldPoint ==
null
)
m_oldPoint = m_pPoint;
//
新点为
当前的鼠标点坐标
IPoint
newPoint =
m_oint(X, Y);
//
获取旧点角度