Author Topic: Rotating Image  (Read 2338 times)

Godra

  • Hero Member
  • *****
  • Posts: 1438
    • View Profile
Rotating Image
« on: August 21, 2016, 09:27:18 PM »
This control, just like the RotatingWheel control from other topic, is intended to show possible VB Net code for Rotation, Horizontal and/or Vertical image flip, limiting the control's paint region (thanks to Archie) and some other code that can be used when creating your own controls.

The main difference from the RotatingWheel control is that this control manipulates existing images. It doesn't custom draw any image besides for the built-in image which is loaded when no other image is selected. The attached picture is actually the one that's built-in/hardcoded and has transparent background (its code should be the same as what you would see if opening this picture in any HEX editor).

This control is practically round shaped with its circle diameter being equal to the image's diagonal, to allow the image rotate without having its corners being cut off. You can see the circle if you change the controls BackColor.

If you do find a use for the control as it is, then good for you.

This control is AHMI control but additional PLC properties can be added if needed.

The "RI_RotationAngle" property of this control is defined as Single value with -360 to 360 range.
The "Value" property of this control is defined as Boolean value and, when set to True, will start Perpetual Rotation of the loaded image (so will the mouse DoubleClick event at Runtime).
The "PLCAddressDirectionOfPerpetualRotation" property of this control can be targeting either Boolean or Integer address to provide "0" or "1" value to change the direction of perpetual rotation.

If you set the PLCAddressRI_RotationAngle property, which will then have a PLC provide angle value, the Perpetual Rotation will not be active.
If you set the PLCAddressValue property, the mouse DoubleClick event will not be active.

« Last Edit: June 28, 2020, 05:51:04 AM by Godra »

Godra

  • Hero Member
  • *****
  • Posts: 1438
    • View Profile
Re: Rotating Image
« Reply #1 on: August 23, 2016, 09:40:34 AM »
The file attached in this post is a control very similar to the control in the previous post.

This new control has the following different features:

    - It doesn't limit the painting region but instead fills the whole control area with an image
    - Allows for 9 different anchor points for rotation
    - Offers both free re-sizing and fixed aspect ratio

The control should be used for special purposes and special images.
« Last Edit: June 28, 2020, 05:52:00 AM by Godra »