Hi,
Is it possible remove the rotation green dots of Elliptical Selection?
Thanks
Winform - Elliptical Selection without rotation
Moderator: Alex
-
- Posts: 7
- Joined: Fri May 05, 2023 12:49 pm
-
- Site Admin
- Posts: 2397
- Joined: Thu Jul 10, 2008 2:21 pm
Re: Winform - Elliptical Selection without rotation
Hi,
Yes, this is possible.
Here is C# code that demonstrates how to disable the ability to rotate the elliptical selection in image viewer:
Best regards, Alexander
Yes, this is possible.
Here is C# code that demonstrates how to disable the ability to rotate the elliptical selection in image viewer:
Code: Select all
private void Form1_Load(object sender, EventArgs e)
{
// specify that image viewer should display image in the best fit mode
imageViewer1.SizeMode = ImageSizeMode.BestFit;
// add image to the image viewer
imageViewer1.Images.Add("AutoContrast.jpg");
// create the elliptical selection region
EllipticalSelectionRegion ellipticalSelectionRegion =
new EllipticalSelectionRegion(new System.Drawing.Rectangle(100, 100, 300, 200));
// get the interaction controller that transforms the elliptical selection region
PointBasedObjectRectangularTransformer pointBasedObjectRectangularTransformer =
ellipticalSelectionRegion.TransformInteractionController as PointBasedObjectRectangularTransformer;
// if interaction controller is rectangular transformer for the point-based interactive object
if (pointBasedObjectRectangularTransformer != null)
{
// specify that rectangular transformer cannot rotate object
pointBasedObjectRectangularTransformer.CanRotate = false;
}
// create the custom selection tool
CustomSelectionTool customSelectionTool = new CustomSelectionTool();
// specify that the custom selection tool should use the elliptical selection region as selection
customSelectionTool.Selection = ellipticalSelectionRegion;
// use the custom selection tool as the visual tool in image viewer
imageViewer1.VisualTool = customSelectionTool;
}