AnnRotate example for Visual J++

Note: This topic is for Document/Medical only.

This example uses the AnnFlip, AnnReverse, and AnnRotate methods. To code this example, add a command button named Test to the example you created in Loading and Displaying an Image. For best results when you run the example, draw two objects in opposite corners, and use the right mouse button to select all annotation objects. The command button then lets you cycle through the AnnFlip, AnnReverse, and AnnRotate methods.

private void Test_click(Object source, Event e)
{
   String strMyCaption = Test.getText();
   if( strMyCaption.equals( "Flip" ) )
   {
      // Flip using the center of the bitmap as the axis.
      LEAD1.AnnFlip( true, LEAD1.getBitmapHeight() / 2, true );
      Test.setText( "Reverse" );
   }
   else
      if( strMyCaption.equals( "Reverse" ) )
      {
         // Reverse using the center of the bitmap as the axis.
         LEAD1.AnnReverse( true, LEAD1.getBitmapWidth() / 2, true );
         Test.setText( "Rotate" );
      }
      else
      if( strMyCaption.equals( "Rotate" ) )
      {
         // Rotate 90 degrees using the center of the bitmap as the axis.
         LEAD1.AnnRotate( true, LEAD1.getBitmapWidth() / 2, LEAD1.getBitmapHeight() / 2, 90, true );
         Test.setText( "Flip" );
      }
   else
   {
      Test.setText( "Flip" );
      LEAD1.setAnnUserMode( (short) LTOCXU.AnnUserModeConstants.ANNUSERMODE_DESIGN );
      LEAD1.setAnnTool( (short) LTOCXU.AnnToolConstants.ANNTOOL_REDACT );
      MessageBox.show( "Draw two objects," + "use the right mouse button to select all, then click the command button" );
   }
}