Hybrid Viewer/Selection modes?
Moderators: SDS, support, admin
Hybrid Viewer/Selection modes?
I have no need for a multiple select mode in my application. Is there a way to create a hybrid mode by which a single-click selects the entity the mouse is pointing at, and a drag performs a zoom? I cannot seem to find out how to enable selection mode by code, I can only click the toolbar button
I have tried many methods to get this to work, including...
Nothing I have tried so far can even get me to set it to selection mode to begin with, much less produce the desired effect of the single-click select, drag-to-zoom behavior.
Any ideas would be greatly appreciated - CAD Import .NET is the closest I've come to perfection in my application, yet I need to have it as intuitive and impressive to my boss as possible to get approval to keep working on it as is. I only have a few days left to get all the kinks such as this worked out.
Thanks in advance!
I have tried many methods to get this to work, including...
Code: Select all
Private Sub CADPict_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles CADPict.MouseDown
If CADImage.Select(e.X, e.Y) Then
CADPict.Invalidate(CADImage.GetSelectEntityRegion(CADPict.ClientRectangle))
Return
End If
End Sub
Code: Select all
Private Sub CADPict_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles CADPict.MouseClick
CADImage.Select(e.X, e.Y)
' etc...
End Sub
Code: Select all
Private Sub LoadFile(ByVal Filename As String)
CAD.LoadFile(Filename)
CAD.ToolsPanelVisible = True
CADPict = CAD.ViewerCADPictureBox
CADImage = CAD.Image
CADImage.SelectionMode = SelectionEntityMode.Enabled
End Sub
Any ideas would be greatly appreciated - CAD Import .NET is the closest I've come to perfection in my application, yet I need to have it as intuitive and impressive to my boss as possible to get approval to keep working on it as is. I only have a few days left to get all the kinks such as this worked out.
Thanks in advance!
Hello!
First of all we would like you to test EditorDemo in from the <b>CAD Import .NET</b> package available at: http://www.cadsofttools.com/download/cadimportnet.zip
It contains examples of selecting and panning entities on the drawing.
Sergey.
Please post questions to the forum or write to support@cadsofttools.com
First of all we would like you to test EditorDemo in from the <b>CAD Import .NET</b> package available at: http://www.cadsofttools.com/download/cadimportnet.zip
It contains examples of selecting and panning entities on the drawing.
Sergey.
Please post questions to the forum or write to support@cadsofttools.com
Hi, thanks for the input. I have tested the EditorDemo and the EditorControlDemo, both do indeed have selection mode by default, but they also change the model when an entity is dragged. (Ideally I would want this to simply zoom instead of moving the entity)
Does the editor control have a way to open a file as read-only or prevent any changes from being made until the user consciously selects to make changes to the model itself?
I'm using the evaluation version, but it seems to have some bugs in the editor control when I add it into the form and try to use it.
Does the editor control have a way to open a file as read-only or prevent any changes from being made until the user consciously selects to make changes to the model itself?
I'm using the evaluation version, but it seems to have some bugs in the editor control when I add it into the form and try to use it.
Hi,
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">... model when an entity is dragged. (Ideally I would want this to simply zoom instead of moving the entity)<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
<ol type="1"><li>What do you mean under "model"?</li>
<li>What do you mean under "simply zoom"? The whole drawing stays the same and selected entity must be increased in size? Isn't it?</li></ol id="1">
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">Does the editor control have a way to open a file as read-only or prevent any changes from being made until the user consciously selects to make changes to the model itself?<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
We recommend to use the following line:
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">I'm using the evaluation version, but it seems to have some bugs in the editor control when I add it into the form and try to use it.<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
What exactly problems have you met?
Sergey.
Please post questions to the forum or write to support@cadsofttools.com
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">... model when an entity is dragged. (Ideally I would want this to simply zoom instead of moving the entity)<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
<ol type="1"><li>What do you mean under "model"?</li>
<li>What do you mean under "simply zoom"? The whole drawing stays the same and selected entity must be increased in size? Isn't it?</li></ol id="1">
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">Does the editor control have a way to open a file as read-only or prevent any changes from being made until the user consciously selects to make changes to the model itself?<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
We recommend to use the following line:
Code: Select all
<font color="blue">this</font id="blue">.cadViewerControl1.Image.SelectionMode = CADImport.SelectionEntityMode.Disabled;
What exactly problems have you met?
Sergey.
Please post questions to the forum or write to support@cadsofttools.com
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by support</i>
<br />Hi,
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">... model when an entity is dragged. (Ideally I would want this to simply zoom instead of moving the entity)<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
<ol type="1"><li>What do you mean under "model"?</li>
<li>What do you mean under "simply zoom"? The whole drawing stays the same and selected entity must be increased in size? Isn't it?</li></ol id="1"><hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
By model I mean a DXF file that gets loaded.
By zoom I mean to zoom the view into the area which you select with the mouse.
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">Does the editor control have a way to open a file as read-only or prevent any changes from being made until the user consciously selects to make changes to the model itself?<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
We recommend to use the following line:<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
It doesn't appear to do anything differently with this line. (I was actually trying the opposite - to get it to enable the selection mode in the ViewerControl by default)
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">I'm using the evaluation version, but it seems to have some bugs in the editor control when I add it into the form and try to use it.<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
What exactly problems have you met?
<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">Drawing and zooming glitches that seemingly happen at random. The item that gets selected will remain on the screen like a "ghost" image, and become an actual editable item if an undo is performed.
<br />Hi,
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">... model when an entity is dragged. (Ideally I would want this to simply zoom instead of moving the entity)<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
<ol type="1"><li>What do you mean under "model"?</li>
<li>What do you mean under "simply zoom"? The whole drawing stays the same and selected entity must be increased in size? Isn't it?</li></ol id="1"><hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
By model I mean a DXF file that gets loaded.
By zoom I mean to zoom the view into the area which you select with the mouse.
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">Does the editor control have a way to open a file as read-only or prevent any changes from being made until the user consciously selects to make changes to the model itself?<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
We recommend to use the following line:
Code: Select all
<font color="blue">this</font id="blue">.cadViewerControl1.Image.SelectionMode = CADImport.SelectionEntityMode.Disabled;
It doesn't appear to do anything differently with this line. (I was actually trying the opposite - to get it to enable the selection mode in the ViewerControl by default)
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">I'm using the evaluation version, but it seems to have some bugs in the editor control when I add it into the form and try to use it.<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
What exactly problems have you met?
<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">Drawing and zooming glitches that seemingly happen at random. The item that gets selected will remain on the screen like a "ghost" image, and become an actual editable item if an undo is performed.
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by fury</i>
<br /><blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by support</i>
<br />Hi,
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">... model when an entity is dragged. (Ideally I would want this to simply zoom instead of moving the entity)<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
<ol type="1"><li>What do you mean under "model"?</li>
<li>What do you mean under "simply zoom"? The whole drawing stays the same and selected entity must be increased in size? Isn't it?</li></ol id="1"><hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
By model I mean a DXF file that gets loaded.
By zoom I mean to zoom the view into the area which you select with the mouse.<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
Zoom by mouse is already implemented in <b>Viewer</b> demo. Please test it.
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">Does the editor control have a way to open a file as read-only or prevent any changes from being made until the user consciously selects to make changes to the model itself?<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
We recommend to use the following line:<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
It doesn't appear to do anything differently with this line. (I was actually trying the opposite - to get it to enable the selection mode in the ViewerControl by default)<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
Selection mode is switched on by default in <b>EditorControlDemo</b>.
Selection mode is switched off by default in <b>ViewerControlDemo </b>.
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">I'm using the evaluation version, but it seems to have some bugs in the editor control when I add it into the form and try to use it.<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
What exactly problems have you met?
<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">Drawing and zooming glitches that seemingly happen at random. The item that gets selected will remain on the screen like a "ghost" image, and become an actual editable item if an undo is performed.
<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
We have tested this question and found no problems. Can you please describe your actions step by step?
Sergey.
Please post questions to the forum or write to support@cadsofttools.com
<br /><blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by support</i>
<br />Hi,
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">... model when an entity is dragged. (Ideally I would want this to simply zoom instead of moving the entity)<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
<ol type="1"><li>What do you mean under "model"?</li>
<li>What do you mean under "simply zoom"? The whole drawing stays the same and selected entity must be increased in size? Isn't it?</li></ol id="1"><hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
By model I mean a DXF file that gets loaded.
By zoom I mean to zoom the view into the area which you select with the mouse.<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
Zoom by mouse is already implemented in <b>Viewer</b> demo. Please test it.
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">Does the editor control have a way to open a file as read-only or prevent any changes from being made until the user consciously selects to make changes to the model itself?<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
We recommend to use the following line:
Code: Select all
<font color="blue">this</font id="blue">.cadViewerControl1.Image.SelectionMode = CADImport.SelectionEntityMode.Disabled;
It doesn't appear to do anything differently with this line. (I was actually trying the opposite - to get it to enable the selection mode in the ViewerControl by default)<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
Selection mode is switched on by default in <b>EditorControlDemo</b>.
Selection mode is switched off by default in <b>ViewerControlDemo </b>.
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">I'm using the evaluation version, but it seems to have some bugs in the editor control when I add it into the form and try to use it.<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
What exactly problems have you met?
<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">Drawing and zooming glitches that seemingly happen at random. The item that gets selected will remain on the screen like a "ghost" image, and become an actual editable item if an undo is performed.
<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
We have tested this question and found no problems. Can you please describe your actions step by step?
Sergey.
Please post questions to the forum or write to support@cadsofttools.com
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by support</i>
<br />
Zoom by mouse is already implemented in <b>Viewer</b> demo. Please test it.
Selection mode is switched on by default in <b>EditorControlDemo</b>.
Selection mode is switched off by default in <b>ViewerControlDemo </b>.
<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
Yes, my wish is to get this zooming by click/drag to happen along with the ability to select an entity upon a single-click (which, when in zoom mode, appears to do nothing by default anyway)
Basically, this is what it does right now:
<ul>
<li>Zoom mode:
Single-click: appears to do nothing
Click and drag: zooms in</li>
<li>Selection mode:
Single-click: selects entity underneath the mouse click
Click and drag: multi-select</li>
</ul>
Here is what I'd like to do, since I do not require the multi-select functionality:
<ul>
<li>Hybrid mode:
Single-click: selects entity underneath the mouse click
Click and drag: Zoom</li>
</ul>
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by support</i>
<br />
We have tested this question and found no problems. Can you please describe your actions step by step?
<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
Well, as usual, I can't duplicate the problem now that I'm trying to.
As far as I can recall, the issue occurred when editing a simple .DXF file, moving an entity or layer around, deleting a layer, and then trying to perform an undo/redo.
Additionally, and this occurs as well in the Viewer, in my experience, the image does not zoom correctly when using the scroll wheel or fit drawing to window after the form (and thus the control, since it is docked) has been resized. The fit drawing to window command sizes the drawing to where it was at when it was first loaded. Running the method to open the same file again resets this so that it sizes correctly to whatever the control is sized at as soon as the file loads.
Thanks so much for your time! I appreciate the assistance.
<br />
Zoom by mouse is already implemented in <b>Viewer</b> demo. Please test it.
Selection mode is switched on by default in <b>EditorControlDemo</b>.
Selection mode is switched off by default in <b>ViewerControlDemo </b>.
<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
Yes, my wish is to get this zooming by click/drag to happen along with the ability to select an entity upon a single-click (which, when in zoom mode, appears to do nothing by default anyway)
Basically, this is what it does right now:
<ul>
<li>Zoom mode:
Single-click: appears to do nothing
Click and drag: zooms in</li>
<li>Selection mode:
Single-click: selects entity underneath the mouse click
Click and drag: multi-select</li>
</ul>
Here is what I'd like to do, since I do not require the multi-select functionality:
<ul>
<li>Hybrid mode:
Single-click: selects entity underneath the mouse click
Click and drag: Zoom</li>
</ul>
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by support</i>
<br />
We have tested this question and found no problems. Can you please describe your actions step by step?
<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
Well, as usual, I can't duplicate the problem now that I'm trying to.
As far as I can recall, the issue occurred when editing a simple .DXF file, moving an entity or layer around, deleting a layer, and then trying to perform an undo/redo.
Additionally, and this occurs as well in the Viewer, in my experience, the image does not zoom correctly when using the scroll wheel or fit drawing to window after the form (and thus the control, since it is docked) has been resized. The fit drawing to window command sizes the drawing to where it was at when it was first loaded. Running the method to open the same file again resets this so that it sizes correctly to whatever the control is sized at as soon as the file loads.
Thanks so much for your time! I appreciate the assistance.
Hello!
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><ul><li>Hybrid mode:
Single-click: selects entity underneath the mouse click
Click and drag: Zoom</li></ul><hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
Current version of <b>EditorControlDemo</b> does not allow to do it.
Current version of <b>ViewerControlDemo</b> does not allow to do it.
Both demos can be changed to implement this mode. If you are interested in, please contact us to support@cadsofttools.com accordingly to this question (add a reference to this topic in a e-mail).
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by support</i>
<br />
We have tested this question and found no problems. Can you please describe your actions step by step?<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
Well, as usual, I can't duplicate the problem now that I'm trying to.
As far as I can recall, the issue occurred when editing a simple .DXF file, moving an entity or layer around, deleting a layer, and then trying to perform an undo/redo.<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
We will make necessary tests, but it is important to repeat your actions step by step and your file is required.
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">Additionally, and this occurs as well in the Viewer, in my experience, the image does not zoom correctly when using the scroll wheel or fit drawing to window after the form (and thus the control, since it is docked) has been resized. The fit drawing to window command sizes the drawing to where it was at when it was first loaded. Running the method to open the same file again resets this so that it sizes correctly to whatever the control is sized at as soon as the file loads.
Thanks so much for your time! I appreciate the assistance.<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
We have found this inaccuracy. We will work on it.
Sergey.
Please post questions to the forum or write to support@cadsofttools.com
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><ul><li>Hybrid mode:
Single-click: selects entity underneath the mouse click
Click and drag: Zoom</li></ul><hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
Current version of <b>EditorControlDemo</b> does not allow to do it.
Current version of <b>ViewerControlDemo</b> does not allow to do it.
Both demos can be changed to implement this mode. If you are interested in, please contact us to support@cadsofttools.com accordingly to this question (add a reference to this topic in a e-mail).
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by support</i>
<br />
We have tested this question and found no problems. Can you please describe your actions step by step?<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
Well, as usual, I can't duplicate the problem now that I'm trying to.
As far as I can recall, the issue occurred when editing a simple .DXF file, moving an entity or layer around, deleting a layer, and then trying to perform an undo/redo.<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
We will make necessary tests, but it is important to repeat your actions step by step and your file is required.
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">Additionally, and this occurs as well in the Viewer, in my experience, the image does not zoom correctly when using the scroll wheel or fit drawing to window after the form (and thus the control, since it is docked) has been resized. The fit drawing to window command sizes the drawing to where it was at when it was first loaded. Running the method to open the same file again resets this so that it sizes correctly to whatever the control is sized at as soon as the file loads.
Thanks so much for your time! I appreciate the assistance.<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
We have found this inaccuracy. We will work on it.
Sergey.
Please post questions to the forum or write to support@cadsofttools.com
Ah, I understand now, and I've started to work with the Viewer code rather than the Viewer control.
Here's my attempt at making the zooming more accurate, but I am not quite as proficient in such things as math and graphics, more in general user interface. The zooming I made still isn't working right. If I am close, but just one or two lines off, a quick pointer would be greatly appreciated.
Otherwise, I will simply wait for an official fix.
Also, in the resetscaling, I was able to get it pretty close to perfect by doing this:
Thanks for all your answers, and continued patience. 
Here's my attempt at making the zooming more accurate, but I am not quite as proficient in such things as math and graphics, more in general user interface. The zooming I made still isn't working right. If I am close, but just one or two lines off, a quick pointer would be greatly appreciated.

Code: Select all
Private Sub cadPictBox_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles cadPictBox.MouseUp
If CADImage Is Nothing Then Exit Sub
If e.Button = MouseButtons.Right Then Exit Sub
If ClipRectangle Is Nothing OrElse ClipRectangle.Enabled = False Then Exit Sub
Dim LTR As Boolean ' Left to right
Dim RTL As Boolean ' Right to left
Dim TTB As Boolean ' Top to bottom
Dim BTT As Boolean ' Bottom to top
Dim RectLeft As Integer
Dim RectTop As Integer
Dim RectRight As Integer
Dim RectBottom As Integer
Dim ZoomHeight As Integer
Dim ZoomWidth As Integer
Dim ZoomX As Integer
Dim ZoomY As Integer
'CadPictPoint is set on MouseDown to define the original click point = e.Location
If e.X > CADPictPoint.X + 4 Then
' mouse is further to the right than when they started
LTR = True
RectLeft = CADPictPoint.X ' starting point was on the left
RectRight = e.X
End If
If e.Y > CADPictPoint.Y + 4 Then
' mouse is further down than when they started
TTB = True
RectTop = CADPictPoint.Y ' starting point was on the top
RectBottom = e.Y
End If
If e.X < CADPictPoint.X - 4 Then
' mouse is further to the left than when they started
RTL = True
RectLeft = e.X
RectRight = CADPictPoint.X ' starting point was on the right
End If
If e.Y < CADPictPoint.Y - 4 Then
' mouse is further up than when they started
BTT = True
RectTop = e.Y
RectBottom = CADPictPoint.Y ' starting point was on the bottom
End If
Dim DragRectangle As Rectangle = Rectangle.FromLTRB(RectLeft, RectTop, RectRight, RectBottom)
Dim ZoomRectangle As Rectangle ' this is to be an aspect-correct rectangle to which we are zooming. Aspect is set by VisibleAreaSize.Width / VisibleAreaSize.Height upon MouseDown
If LTR = True Or RTL = True Or TTB = True Or BTT = True Then
Dim tmp1 As Single = (Me.VisibleAreaSize.Width / CSng(DragRectangle.Width))
Dim tmp2 As Single = (Me.VisibleAreaSize.Height / CSng(DragRectangle.Height))
If (DragRectangle.Width > (DragRectangle.Height * Aspect)) Then
'wider than the display area aspect ratio
'use height as the base
tmp1 = tmp2
ZoomHeight = DragRectangle.Height ' 200
ZoomWidth = DragRectangle.Height * Aspect ' 200 * 2.0 = 400
Debug.Print("ZoomWidth: " & DragRectangle.Height & " * " & Aspect & " = " & ZoomWidth)
'example DragRectangle: 600x200 at 400, 400
' (600 - 400) \ 2 = 100
ZoomX = DragRectangle.X + ((DragRectangle.Width - ZoomWidth) \ 2)
ZoomY = DragRectangle.Y
Else
'equal to or taller than the display area aspect ratio
'make width be the base of the zoom
ZoomWidth = DragRectangle.Width ' 400
ZoomHeight = DragRectangle.Width / Aspect ' 400 / 2.0 = 200
Debug.Print("ZoomHeight: " & DragRectangle.Width & " / " & Aspect & " = " & ZoomHeight)
'example DragRectangle: 400, 400
ZoomX = DragRectangle.X ' 400
ZoomY = DragRectangle.Y + ((DragRectangle.Height - ZoomHeight) \ 2)
End If
ZoomRectangle = New Rectangle(ZoomX, ZoomY, ZoomWidth, ZoomHeight)
Dim CC As DPoint
With ZoomRectangle
Debug.Print("New zoom rectangle coordinates: " & ZoomX & ", " & ZoomY & " (LTRB: " & .Left & " " & .Top & " " & .Right & " " & .Bottom)
CC = Me.GetRealPoint(.Left, .Top)
End With
Me.Zoom(tmp1)
Debug.Print(LTR & RTL & TTB & BTT & " DragRect: " & DragRectangle.Left & "," & DragRectangle.Top & " " & DragRectangle.Width & "x" & DragRectangle.Height & " ImagePosition: " & Me.LeftImagePosition & ", " & Me.TopImagePosition & " CADCoords: " & CC.X & ", " & CC.Y)
Me.LeftImagePosition = CC.X
Me.TopImagePosition = CC.Y
End If
End Sub
Code: Select all
Public Sub ResetScaling()
Me.ImageScale = 1.0!
Me.ImagePreviousScale = 1.0!
Me.LeftImagePosition = ((Me.cadPictBox.ClientRectangle.Width - Me.VisibleAreaSize.Width) / 2.0!)
Me.TopImagePosition = ((Me.cadPictBox.ClientRectangle.Height - Me.VisibleAreaSize.Height) / 2.0!)
Me.Position = New PointF
Me.SetCADImageOptions()
Me.cadPictBox.Invalidate()
End Sub

Hello!
The problem can be solved by single line. please find method ResetScaling and replace Me.cadPictBox.Invalidate() by Me.DoResize():
Sergey.
Please post questions to the forum or write to support@cadsofttools.com
The problem can be solved by single line. please find method ResetScaling and replace Me.cadPictBox.Invalidate() by Me.DoResize():
Code: Select all
<font color="blue">Public Sub</font id="blue"> ResetScaling()
<font color="blue">Me</font id="blue">.ImageScale = 1.0!
<font color="blue">Me</font id="blue">.ImagePreviousScale = 1.0!
<font color="blue">Me</font id="blue">.LeftImagePosition = ((<font color="blue">Me</font id="blue">.cadPictBox.ClientRectangle.Width - <font color="blue">Me</font id="blue">.VisibleAreaSize.Width) / 2.0!)
<font color="blue">Me</font id="blue">.TopImagePosition = ((<font color="blue">Me</font id="blue">.cadPictBox.ClientRectangle.Height - <font color="blue">Me</font id="blue">.VisibleAreaSize.Height) / 2.0!)
<font color="blue">Me</font id="blue">.DoResize()
<font color="blue">End Sub</font id="blue">
Please post questions to the forum or write to support@cadsofttools.com
Great! Thanks very much, again!
Any ideas on the ClipRectangle zooming? Nothing I can do gets it quite right.
How is the method GetRealPoint expecting to receive the screen coordinates? From the mouse location relative to cadPictBox, or from the location in absolute screen coordinates?
Can there be an aspect-correct rectangle drawn on the screen while dragging the mouse around so that the user knows exactly which region of the image is going to be zoomed in?
I try this myself on the cadPictBox.MouseMove event, but the ClipRectangle.ClientRectangle gets changed back after the event, so it looks rather ugly, and even then, I still can't figure out how to translate that corrected rectangle into the parameters to pass to Position and Zoom()
Any ideas on the ClipRectangle zooming? Nothing I can do gets it quite right.
How is the method GetRealPoint expecting to receive the screen coordinates? From the mouse location relative to cadPictBox, or from the location in absolute screen coordinates?
Can there be an aspect-correct rectangle drawn on the screen while dragging the mouse around so that the user knows exactly which region of the image is going to be zoomed in?
I try this myself on the cadPictBox.MouseMove event, but the ClipRectangle.ClientRectangle gets changed back after the event, so it looks rather ugly, and even then, I still can't figure out how to translate that corrected rectangle into the parameters to pass to Position and Zoom()
Hello!
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">Any ideas on the ClipRectangle zooming? Nothing I can do gets it quite right.<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
We will consider this problem and answer you soon.
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">How is the method GetRealPoint expecting to receive the screen coordinates? From the mouse location relative to cadPictBox, or from the location in absolute screen coordinates?<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
GetRealPoint receives mouse coordinates relatively to cadPictBox.
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">Can there be an aspect-correct rectangle drawn on the screen while dragging the mouse around so that the user knows exactly which region of the image is going to be zoomed in?
I try this myself on the cadPictBox.MouseMove event, but the ClipRectangle.ClientRectangle gets changed back after the event, so it looks rather ugly, and even then, I still can't figure out how to translate that corrected rectangle into the parameters to pass to Position and Zoom()<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
The problem will lose its actuality when we have fixed ClipRectangle zooming.
Sergey.
Please post questions to the forum or write to support@cadsofttools.com
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">Any ideas on the ClipRectangle zooming? Nothing I can do gets it quite right.<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
We will consider this problem and answer you soon.
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">How is the method GetRealPoint expecting to receive the screen coordinates? From the mouse location relative to cadPictBox, or from the location in absolute screen coordinates?<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
GetRealPoint receives mouse coordinates relatively to cadPictBox.
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">Can there be an aspect-correct rectangle drawn on the screen while dragging the mouse around so that the user knows exactly which region of the image is going to be zoomed in?
I try this myself on the cadPictBox.MouseMove event, but the ClipRectangle.ClientRectangle gets changed back after the event, so it looks rather ugly, and even then, I still can't figure out how to translate that corrected rectangle into the parameters to pass to Position and Zoom()<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
The problem will lose its actuality when we have fixed ClipRectangle zooming.
Sergey.
Please post questions to the forum or write to support@cadsofttools.com
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by support</i>
<br />
We will consider this problem and answer you soon.
<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
Thanks! Has there been an update?
<br />
We will consider this problem and answer you soon.
<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
Thanks! Has there been an update?
Please contact us by e-mail.
Sergey.
Please post questions to the forum or write to support@cadsofttools.com
Sergey.
Please post questions to the forum or write to support@cadsofttools.com
Hello!
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by fury</i>
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by support</i>
<br />Hi,
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by fury</i>
<br />... model when an entity is dragged. (Ideally I would want this to simply zoom instead of moving the entity)<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
<ol type="1"><li>...</li>
<li>What do you mean under "simply zoom"? The whole drawing stays the same and selected entity must be increased in size? Isn't it?</li></ol id="1"><hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
...
By zoom I mean to zoom the view into the area which you select with the mouse.<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
Please follow the instructions:
<ol type="1">
<li>Please find <i><font color="blue">Private Sub</font id="blue"> CADPictBoxMouseWheel(...)</i> and replace it by the following:</li>
<li>Please find <i><font color="blue">Public Sub</font id="blue"> Zoom(...)</i> and replace it by the following:</li>
<li>Please find <i><font color="blue">Private Sub</font id="blue"> cadPictBox_MouseUp(...)</i> and replace it by the following:</li></ol id="1">
Sergey.
Please post questions to the forum or write to support@cadsofttools.com
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by fury</i>
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by support</i>
<br />Hi,
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by fury</i>
<br />... model when an entity is dragged. (Ideally I would want this to simply zoom instead of moving the entity)<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
<ol type="1"><li>...</li>
<li>What do you mean under "simply zoom"? The whole drawing stays the same and selected entity must be increased in size? Isn't it?</li></ol id="1"><hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
...
By zoom I mean to zoom the view into the area which you select with the mouse.<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
Please follow the instructions:
<ol type="1">
<li>Please find <i><font color="blue">Private Sub</font id="blue"> CADPictBoxMouseWheel(...)</i> and replace it by the following:
Code: Select all
<font color="blue">Private Sub</font id="blue"> CADPictBoxMouseWheel(<font color="blue">ByVal</font id="blue"> sender <font color="blue">As Object</font id="blue">, <font color="blue">ByVal</font id="blue"> e <font color="blue">As</font id="blue"> MouseEventArgs)
<font color="blue">If</font id="blue"> (e.Delta < 0) <font color="blue">Then
Me</font id="blue">.Zoom(0.7!, <font color="blue">True</font id="blue">)
<font color="blue">Else
Me</font id="blue">.Zoom(1.3!, <font color="blue">True</font id="blue">)
<font color="blue">End If
Me</font id="blue">.Shift()
<font color="blue">Me</font id="blue">.SetPictureBoxPosition(<font color="blue">Me</font id="blue">.Position)
<font color="blue">End Sub</font id="blue">
<li>Please find <i><font color="blue">Public Sub</font id="blue"> Zoom(...)</i> and replace it by the following:
Code: Select all
<font color="blue">Public Sub</font id="blue"> Zoom(<font color="blue">ByVal</font id="blue"> i <font color="blue">As Single</font id="blue">, <font color="blue">ByVal</font id="blue"> invalidate <font color="blue">As Boolean</font id="blue">)
<font color="blue">If</font id="blue"> (<font color="blue">Not Me</font id="blue">.cadImage <font color="blue">Is Nothing</font id="blue">) <font color="blue">Then
Me</font id="blue">.ImageScale = (<font color="blue">Me</font id="blue">.ImageScale * i)
<font color="blue">If</font id="blue"> (<font color="blue">Me</font id="blue">.ImageScale < 0.005!) <font color="blue">Then
Me</font id="blue">.ImageScale = 0.005!
<font color="blue">End If
If</font id="blue"> (invalidate) <font color="blue">Then
Me</font id="blue">.cadPictBox.Invalidate()
<font color="blue">End If
End If
End Sub</font id="blue">
<li>Please find <i><font color="blue">Private Sub</font id="blue"> cadPictBox_MouseUp(...)</i> and replace it by the following:
Code: Select all
<font color="blue">Private Sub</font id="blue"> cadPictBox_MouseUp(<font color="blue">ByVal</font id="blue"> sender <font color="blue">As</font id="blue"> System.Object, <font color="blue">ByVal</font id="blue"> e <font color="blue">As</font id="blue"> System.Windows.Forms.MouseEventArgs) <font color="blue">Handles</font id="blue"> cadPictBox.MouseUp
<font color="blue">Dim</font id="blue"> w, h, scaleX, scaleY, midShiftX, midShiftY, vScl <font color="blue">As Single
Dim</font id="blue"> r <font color="blue">As</font id="blue"> RectangleF
<font color="blue">Me</font id="blue">.detRMouseDown = <font color="blue">False</font id="blue">
<font color="blue">Me</font id="blue">.cadPictBox.Cursor = Cursors.Default
<font color="blue">If</font id="blue"> ((((<font color="blue">Me</font id="blue">.clipRectangle.Enabled <font color="blue">AndAlso</font id="blue"> (<font color="blue">Me</font id="blue">.clipRectangle.Type = RectangleType.Zooming)) <font color="blue">AndAlso</font id="blue"> (<font color="blue">Me</font id="blue">.clipRectangle.ClientRectangle.Width > 5)) <font color="blue">AndAlso</font id="blue"> (<font color="blue">Me</font id="blue">.clipRectangle.ClientRectangle.Height > 5)) <font color="blue">AndAlso</font id="blue"> (Not <font color="blue">Me</font id="blue">.MultipleSelect <font color="blue">AndAlso</font id="blue"> (<font color="blue">Me</font id="blue">.ImageScale <= 1000.0!))) <font color="blue">Then</font id="blue">
w = <font color="blue">Me</font id="blue">.clipRectangle.ClientRectangle.Width
h = <font color="blue">Me</font id="blue">.clipRectangle.ClientRectangle.Height
r = ImageRectangleF
r.Offset(-<font color="blue">Me</font id="blue">.clipRectangle.ClientRectangle.Left, -<font color="blue">Me</font id="blue">.clipRectangle.ClientRectangle.Top)
scaleX = <font color="blue">Me</font id="blue">.visibleArea.Width / w
scaleY = <font color="blue">Me</font id="blue">.visibleArea.Height / h
midShiftX = 0.0F
midShiftY = 0.0F
vScl = 0.0F
<font color="blue">If</font id="blue"> (scaleX * h > <font color="blue">Me</font id="blue">.visibleArea.Height) <font color="blue">Then</font id="blue">
vScl = scaleY
midShiftX = (<font color="blue">Me</font id="blue">.visibleArea.Width - vScl * w) / 2.0F
<font color="blue">Else</font id="blue">
vScl = scaleX
midShiftY = (<font color="blue">Me</font id="blue">.visibleArea.Height - vScl * h) / 2.0F
<font color="blue">End If</font id="blue">
r = New RectangleF(vScl * r.Left, vScl * r.Top, vScl * ImageRectangleF.Width, vScl * ImageRectangleF.Height)
r.Offset(midShiftX, midShiftY)
LeftImagePosition = r.Left
TopImagePosition = r.Top
PreviousPosition = <font color="blue">New</font id="blue"> PointF(LeftImagePosition, TopImagePosition)
<font color="blue">Me</font id="blue">.Zoom(vScl, <font color="blue">False</font id="blue">)
<font color="blue">Me</font id="blue">.ImagePreviousScale = <font color="blue">Me</font id="blue">.ImageScale
<font color="blue">Me</font id="blue">.cadPictBox.Invalidate()
<font color="blue">End If
End Sub</font id="blue">
Sergey.
Please post questions to the forum or write to support@cadsofttools.com