Support Center

Controlling Rubberband Selector

Gerardo Hernandez Dec 30, 2015 12:23PM EST

Is there a way to programmatically change the rubberband selector (while Select = True) so that rubberband will follow a specific aspect ratio?
If not, how to have our own selector and then manually running the crop method (a similar selection as stated in these post: http://help.data-tech.com/customer/portal/questions/177962-functionality-of-imageman-overlay-and-printing-)?

Any help would be appreciated.

Gerardo

5 Data Techniques Responses and 5 Community Responses

Up 0 Rated Down
DTI Support  Data Techniques Employee Dec 30, 2015 12:30PM EST

Hello,

You can force an aspect ration for the Select rectangle by setting the viewer.Selection.AspectRatio to the x/y ratio you want it restricted to.

Thanks for your interest in our products and please let us know if you have any questions.

Sincerely,
Sean
Data Techniques Support

Up 0 Rated Down
Gerardo Hernandez  Data Techniques Employee Jan 04, 2016 09:27AM EST

Thanks for your response Sean, although I forgot to mention that I'm using ImageMan ActiveX Suit, no .NET. So, maybe the response you provided applies to .NET, for I'm not able to find any viewer object in the ActiveX control.

Thanks.

Gerardo

Up 0 Rated Down
Gerardo Hernandez  Data Techniques Employee Jan 04, 2016 09:27AM EST

Thanks for your response Sean, although I forgot to mention that I'm using ImageMan ActiveX Suit, no .NET. So, maybe the response you provided applies to .NET, for I'm not able to find any viewer object in the ActiveX control.

Thanks.

Gerardo

Up 0 Rated Down
DTI Support  Data Techniques Employee Jan 04, 2016 09:28AM EST

HI,

Sorry right the ActiveX controls do not have this support. You would have to create your own rubberband by calling the Windows API functions to draw it over the Image control.

Thanks for your interest in our products and please let us know if you have any questions.

Sincerely,
Sean
Data Techniques Support

Up 0 Rated Down
Gerardo Hernandez  Data Techniques Employee Jan 06, 2016 03:22PM EST

Thnaks for your input Sean. I tried your suggestion (using the DrawFocusRect() WinAPI call) and I was able to make it works perfectly when an image is loaded into the ImageMan control, resizing the control to fit the image:
imgmanPhoto.Width = imgmanPhoto.ImageWidth * Screen.TwipsPerPixelX
imgmanPhoto.Height = imgmanPhoto.ImageHeight * Screen.TwipsPerPixelY

But what I really need is to fit the picture into my ImageMan control ( i.e. stretching it) so I set the ScaleWidth and ScaleHeight as follows:
imgmanPhoto.ScaleWidth = imgmanPhoto.ImageWidth
imgmanPhoto.ScaleHeight = imgmanPhoto.ImageHeight

But then, the rubberband is barely seen, and if the picture is bigger no rubberband is displayed at all.

I'm trying to make it work using a VB6 pictureBox control and painting the image from the ImageMan control (which seems to work).

Any ideas on what's going on there would be greatly appreciated.

Gerardo

Up 0 Rated Down
DTI Support  Data Techniques Employee Jan 06, 2016 03:25PM EST

Hello,

If the DrawFocusRect() output is changing size along with the image then it sounds like you are calling it with the hDC for for the image. I would suggest calling it with a DC you get from the Image control hWnd. That way it wont scale as the image does.

Thanks for your interest in our products and please let us know if you have any questions.

Sincerely,
Sean
Data Techniques Support

Up 0 Rated Down
Gerardo Hernandez  Data Techniques Employee Jan 07, 2016 09:42AM EST

Thanks Sean. If what you mean is using the hWnd property when calling DrawfocusRec as below:
DrawFocusRect imgmanPhoto.hWnd, FocusRec
imgmanPhoto.Refresh

then .. it didn't work. No rubberband is displayed at all even when no scaling the picture. I try with AutoRedraw = False (the set I used before) and AutoRedraw = True.

Any ideas?

Thanks.

Gerardo

Up 0 Rated Down
DTI Support  Data Techniques Employee Jan 07, 2016 09:43AM EST

Hi,

You will need to get an hDC for the control's window then pass that to the DrawFocusRect, as you discovered you cannot pass the hWnd where the method needs an hDC :-)

Thanks for your interest in our products and please let us know if you have any questions.

Sincerely,
Sean
Data Techniques Support

Up 0 Rated Down
Gerardo Hernandez  Data Techniques Employee Jan 07, 2016 10:42AM EST

Sean , thank you so much for that clarification. Now, it is working as I wanted to.

Gerardo

Up 0 Rated Down
DTI Support  Data Techniques Employee Jan 07, 2016 10:42AM EST

Cool, glad to hear.

Have a great day,
Sean

This question is closed to new answers.

Contact Us