Microsoft Certification and Technology FAQs
Contact
Help
Open questions
Ask question
Add content
Advanced search
Navigation
Home
Show all categories
Microsoft Technology
Microsoft Certifications
Other FAQs
Instant Response
Sitemap
Search
Change language
Arabic
Basque
Bengali
Brazilian Portuguese
Chinese (Simplified)
Chinese (Traditional)
Czech
Danish
Dutch
English
Finnish
French
German
Greek
Hebrew
Hungarian
Indonesian
Italian
Japanese
Korean
Latvian
Norwegian Bokmål
Persian
Polish
Portuguese
Romanian
Russian
Serbian
Slovenian
Spanish
Swedish
Thai
Turkish
Ukrainian
Vietnamese
Welsh
Username:
Password:
3 Users online :: 3 Guests and 0 Registered
TOP 10
3954 views:
SUS or WSUS 70-291? Can anyone tell me if ...
2616 views:
Rocketfish Bluetooth Keyboard RF-BTKB2 not working under Windows 7 ...
1576 views:
Error on installation of .Net 3.0 [ Installation failed ...
970 views:
How to troubleshoot Windows Vista and Windows Server 2008 ...
864 views:
I just passed MCTS 70-562 exam with a score ...
729 views:
I want to activate Windows Vista Enterprise, Windows Vista ...
725 views:
How long will my certification for mcts be valid? ...
655 views:
How to become MCITP admin or ENTERPRISE, Please provide ...
595 views:
MCSE 2003 to 2008 I already have MCSE 2003, ...
560 views:
The webcam manufacturer is listed as Chicony ,(Sonix260) It ...
The latest articles:
Does a Windows 2000 MCSE become a Windows 2003 ...
(2009-10-15 05:33)
How to take exam for MCAS and MOS paper ...
(2009-10-15 05:30)
how to upgrade your MCSA/MCSE 2003 to MCITP: Enterprise ...
(2009-10-15 05:25)
how to upgrade your MCSA/MCSE 2003 to MCITP Server ...
(2009-10-15 05:22)
how to upgrade your MCSA 2003 on Windows Server ...
(2009-10-15 05:18)
Tagged entries
Ive been agonizing over it for a while now. What I have is a window with a scrollviewer that contains a canvas. Im trying to zoom in on whatever is in the center of the window, not necessarily the center of the canvas. So if they zoom in and scroll up/down/left/right, it will give the effect of zooming in on whatever new is in the center of the window. Im trying to do this by using a scale transform in the canvas' layouttransform property. The code I have works great when I load the canvas and its in portrait view, however, many times the canvas will need to be rotated 90, 180, 270 degrees and this is where I run into the problem. I apply a rotatetransform of 90 degrees to the layout transform and when I try to zoom in, the scroll bars jump around up and down, left and right instead of staying constant. Here is my code: public void performTransforms(double scale, double rotation) { TransformGroup tmpLayoutTrans = new TransformGroup(); TransformGroup tmpRenderTrans = new TransformGroup(); //adjust the currentRotation if it goes past 360 or -360 if (currentRotation + rotation != 360 && currentRotation + rotation != -360) { currentRotation += rotation; } else { currentRotation = 0; //take it back to 0 } // If not rotated set width=x, height=y. If its been rotated, we need to flip // the two sides if (currentRotation == 0 || currentRotation == 180) { this.Width = maxX; this.Height = maxY; } else { this.Width = maxY; this.Height = maxX; } tmpLayoutTrans.Children.Add(new RotateTransform(currentRotation)); tmpLayoutTrans.Children.Add(new ScaleTransform(scale, scale)); //add the transformations to this canvas this.LayoutTransform = tmpLayoutTrans; this.RenderTransform = tmpRenderTrans; // Get the center point of the window, scrollviewer and canvas Window1 window = ((Window1)ParentHost); ScrollViewer sv = window.svContent; Point svCenter = new Point(sv.ActualWidth / 2, sv.ActualHeight / 2); Point windowCenter = sv.PointToScreen(svCenter); Point zoomPt = new Point(); // Move the scroll bars so the center of the window always stays in the center when zooming if (this.Parent != null) { zoomPt = this.PointFromScreen(windowCenter); sv.ScrollToHorizontalOffset((zoomPt.X * scale) - (sv.ActualWidth / 2)); sv.ScrollToVerticalOffset((zoomPt.Y * scale) - (sv.ActualHeight / 2)); } }Again this works if the rotation is zero, but if its anything else it does not.
(2 views)
1
Keyword
Search over all languages:
Search in ...
... all categories
Microsoft Technology
....Server technologies
....Microsoft Dynamics
....Windows
....Microsoft Office
....Developer tools and applications
....Security
Microsoft Certifications
....MCTS
....MCITP
....MCPD
....Microsoft Certified Architect program
....Microsoft Certified Master program
....MCDST
....MCLC
....MCSA
....MCSE
....MCDBA
....MCT
....MCAD
....MCSD
....Microsoft Certified Business Management Solutions Specialist
....Microsoft Certified Business Management Solutions Professional
....MOS
....MCAS
Other FAQs
add search plugin