This is the same as the full graph mentioned in the previous article. It is a command-class function. You only need to override the onclick () method when customizing the function. Similarly, if you want to write with a button, as long as you know that they correspond to controlsmapzoomtolastextentbackcommand and controlsmapzoomtolastextentforwardcommand, the subsequent code will be easy. Let's take a look at the code that implements these two functions in the button:
Code
# View on Region
Private void btngoback_click (Object sender, eventargs E)
{
Controlsmapzoomtolastextentbackcommand mapgoback = new controlsmapzoomtolastextentbackcommandclass ();
Mapgoback. oncreate (axmapmain. Object );
Mapgoback. onclick ();
}
# Endregion
# Next view of Region
Private void btngoforward_click (Object sender, eventargs E)
{
Controlsmapzoomtolastextentforwardcommand mapgoforward = new controlsmapzoomtolastextentforwardcommandclass ();
Mapgoforward. oncreate (axmapmain. Object );
Mapgoforward. onclick ();
}
# Endregion
The code for rewriting the onclick method is as follows:
Code
# View on Region
Public override void onclick ()
{
If (null = m_pactiveview) return;
Iextentstack m_stack = m_pactiveview.extentstack;
If (m_stack.canundo ())
{
M_stack.undo ();
}
}
# Endregion
# Region next view
Public override void onclick ()
{
If (null = m_pactiveview) return;
Iextentstack m_stack = m_pactiveview.extentstack;
If (m_stack.canredo ())
{
M_stack.redo ();
}
}
# Endregion
During rewriting, note that the iextentstack stack interface is used to store the map view for each operation on the stack. The canundo () and canredo () methods are provided, determine whether a view in the stack can be back or forward.