Click here to Skip to main content
15,892,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am trying to implement zoom in zoom out functionality in VC++ MFC framework.As i am new for this facing problem in CDC,Graphics And CscrollView concepts.

Default ZoomLevel is 100% and it's scaling by 20% up/Down (60,80,100,120,140,160).

As i have to Zoom the CRect (i.e some rectangular blocks) along with that some lines which is connected to that Rectangle.

Currently Able to zoom with scrollbar support using Cscrollview but while we zoom at some level for ex. 120% i am expanding canvas size canvas default page size vertically and horizontally are i.e 5000. Now while we zoom @120% (canvas size * 120) i.e 6000.

Anyhow after zooming blocks and inside image all are expands properly at all zoom level. But the main problem is Connecter With that rectangle block are not exactly connected to center its showing some gap. for that i am attaching two images which showing gap between Block and Connector line.

Before Zoom @ default level i.e 100% which looks properly connected.
After Doing zoomin i.e @120% Lines are not connected properly to the Blocks

Plz let me know, What should be best practise or how to expand/zoom the canvas and its all the objects on it ?

Is there any way if we expand or zoom the view/canvas bitmap object all the object(CREct + Lines + images etc on that canvas also adjusted accordingly?

My requirement for to zoomin zoomout is similar like windows print preview dialog box is providing DefaultView Zoomin and Zoomout option at diffrent level ( 100,125,150,200 etc)

Or if you have any project reference code related to this plz share it will be very big help for me. Thanks in advance.

What I have tried:

I am trying to implement zoom in zoom out functionality in VC++ MFC framework.As i am new for this facing problem in CDC,Graphics And CscrollView concepts.

Default ZoomLevel is 100% and it's scaling by 20% up/Down (60,80,100,120,140,160).

As i have to Zoom the CRect (i.e some rectangular blocks) along with that some lines which is connected to that Rectangle.

Currently Able to zoom with scrollbar support using Cscrollview but while we zoom at some level for ex. 120% i am expanding canvas size canvas default page size vertically and horizontally are i.e 5000. Now while we zoom @120% (canvas size * 120) i.e 6000.

Anyhow after zooming blocks and inside image all are expands properly at all zoom level. But the main problem is Connecter With that rectangle block are not exactly connected to center its showing some gap. for that i am attaching two images which showing gap between Block and Connector line.

Before Zoom @ default level i.e 100% which looks properly connected.
After Doing zoomin i.e @120% Lines are not connected properly to the Blocks

Plz let me know, What should be best practise or how to expand/zoom the canvas and its all the objects on it ?

Is there any way if we expand or zoom the view/canvas bitmap object all the object(CREct + Lines + images etc on that canvas also adjusted accordingly?

My requirement for to zoomin zoomout is similar like windows print preview dialog box is providing DefaultView Zoomin and Zoomout option at diffrent level ( 100,125,150,200 etc)

Or if you have any project reference code related to this plz share it will be very big help for me. Thanks in advance.
Posted
Updated 5-Apr-16 19:09pm
v3
Comments
Richard MacCutchan 5-Apr-16 13:04pm    
Putting the same text in the "What I have tried" section, does not tell us what you have tried.
vmvajar 6-Apr-16 1:08am    
Its already describe what i have done,Means zooming implementation with logic that's why i mark both as same.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900