Update snap tips with ISnappingEnvironment

2834
1
Jump to solution
07-26-2015 06:48 PM
MarkMindlin
Occasional Contributor III

Hi there,

I added a snapping to a custom tool and trying to change a snap tip with ISnappingEnvironment.SnapTipSymbol Property

like

public override void OnMouseMove(int Button, int Shift, int X, int Y)

{

  ...

snapResult = m_Snapper.Snap(m_CurrentMouseCoords);

//Update the snapping feedback.

if (snapResult != null)

{

   (m_SnappingEnv.SnapTipSymbol as IFormattedTextSymbol).Text = "Changed";

   m_SnappingFeedback.Update(snapResult, 0);

}

...

}

public override void Refresh(int hDC)

{

if (m_SnappingFeedback != null)

  m_SnappingFeedback.Refresh(hDC);

}

It does not update the actual tip.

In the help ESRI says that

"You have a number of options to customize the tip symbol, including advanced text capabilities provided by IFormattedTextSymbol to provide options for backgrounds, offsets, or right-to-left text capabilities. "

Any help will be appreciated.

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
JavierArtero
New Contributor III

Hi Mark,

In the code you posted, the text you are changing is the IFormattedTextSymbol.Text property.

This isn't the string being used by the snapping feedback. As far as I know, this property is just used internally by the ISymbol to apply formatting.

In fact, there's no straightforward way to replace the tip with a custom text. The only way I know is writing an interface which inherits ISnappingFeedback and dealing manually with the Update and Refresh to draw your custom text.

By the way, the string used in the feedback is the one at ISnappingResult.Description.

Good luck on your customization.

View solution in original post

0 Kudos
1 Reply
JavierArtero
New Contributor III

Hi Mark,

In the code you posted, the text you are changing is the IFormattedTextSymbol.Text property.

This isn't the string being used by the snapping feedback. As far as I know, this property is just used internally by the ISymbol to apply formatting.

In fact, there's no straightforward way to replace the tip with a custom text. The only way I know is writing an interface which inherits ISnappingFeedback and dealing manually with the Update and Refresh to draw your custom text.

By the way, the string used in the feedback is the one at ISnappingResult.Description.

Good luck on your customization.

0 Kudos