Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Zoom Window (Read 3047 times)
qwert789
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 4
Joined: Oct 6th, 2006
Zoom Window
Jan 15th, 2007 at 5:53pm
Print Post  
Hello everyone.
I have tried to implement the ZoomWindow of AutoCAD and other similar programs with flowchart but was not able to succeed.
I used the MouseDown event to record the Rectangle defined by the user and then in the Mouse Up event, the Inflate and ZoomRect commands but i cannot make the zoom exactly where the rectangle defined by the user is. Could you please explain me in more detail how to do this?

Thank you very much
  
Back to top
 
IP Logged
 
qwert789
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 4
Joined: Oct 6th, 2006
Re: Zoom Window
Reply #1 - Jan 15th, 2007 at 5:56pm
Print Post  
PS: I have read the previous posts about zooming functions but they where inadequate in regard to my problem.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Zoom Window
Reply #2 - Jan 15th, 2007 at 6:52pm
Print Post  
Hello,

ZoomToRect expects logical coordinates. Do you call the FlowChart.ClientToDoc method to convert from the pixel coordinates passed to MouseDown/MouseUp to the flowchart's logical ones?

Stoyan
  
Back to top
 
IP Logged
 
qwert789
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 4
Joined: Oct 6th, 2006
Re: Zoom Window
Reply #3 - Jan 15th, 2007 at 7:39pm
Print Post  
Yes, I called FlowChart.ClientToDoc in both events.
I have adapted my routine from this post:
http://mindfusion.org/cgi/Forum/YaBB.pl?board=fcnet_disc;action=display;num=1165...

But, because Im using VB and not VC and because the objective of the above post is a bit different from the one I want, I am having trouble with the conversion.
Could you please give me a simple example on how to do Zoom Window with ZoomRect?

Thanks allot
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Zoom Window
Reply #4 - Jan 15th, 2007 at 8:20pm
Print Post  
Here is one way to implement a zoom rectangle-

Code
Select All
    Private zoomMode As Boolean

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
	  zoomMode = False
    End Sub

    Private Sub btnZoom_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnZoom.Click
	  zoomMode = Not zoomMode
    End Sub

    Private Sub fc_InitializeBox(ByVal sender As Object, ByVal e As MindFusion.Diagramming.WinForms.BoxEventArgs) Handles fc.InitializeBox
	  If zoomMode Then
		e.Box.Style = MindFusion.Diagramming.WinForms.BoxStyle.Rectangle
		e.Box.Brush = New SolidBrush(Color.Transparent)
		e.Box.Pen.DashStyle = Drawing2D.DashStyle.Dot
		e.Box.ShadowColor = Color.Transparent
	  End If
    End Sub

    Private Sub fc_BoxCreated(ByVal sender As Object, ByVal e As MindFusion.Diagramming.WinForms.BoxEventArgs) Handles fc.BoxCreated
	  If zoomMode Then
		fc.ZoomToRect(e.Box.BoundingRect)
		fc.DeleteObject(e.Box)
	  End If
    End Sub
 



though I have never used AutoCad and don't know it this is similar to the AutoCad's ZoomWindow.

Stoyan
  
Back to top
 
IP Logged
 
qwert789
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 4
Joined: Oct 6th, 2006
Re: Zoom Window
Reply #5 - Jan 15th, 2007 at 9:07pm
Print Post  
Thank you very much for the assistance, that way is much simpler! What I was battling on was:

Private Sub FlowChart1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles FlowChart1.MouseDown

           abc01 = FlowChart1.ClientToDoc(FlowChart1.PointToClient(MousePosition))
           abc03 = FlowChart1.ClientToDoc(FlowChart1.ClientRectangle)

    End Sub

    Private Sub FlowChart1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles FlowChart1.MouseUp
           
    Dim abc02 As System.Drawing.RectangleF
           abc02 = New RectangleF(abc01.X - abc03.Size.Width / 2, abc01.Y - abc03.Size.Height / 2, abc03.Size.Width, abc03.Size.Height)
           abc02.Inflate(zoom01x,zoom01y) '->What Values to put in zoom01x and zoom01y ?
           FlowChart1.ZoomToRect(abc02)

    End Sub


Thank you once again!
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint