SIGN UP MEMBER LOGIN:    
ARTICLE

Zoom-In and Zoom-Out An Image with Mouse Wheel in Silverlight 4

Posted by Diptimaya Patra Articles | Silverlight with C# June 25, 2010
In this article we will see how we can zoom in or zoom out an image with mouse wheel scroll in Silverlight 4.
Reader Level:
Download Files:
 

Introduction

In this article we will see how we can zoom in or zoom out an image with mouse wheel scroll in Silverlight 4.

Creating Silverlight Application

Fire up Visual Studio 2010 and create a Silverlight Application, name the solution as MouseWheelSample.

ZoomInOut1.gif


Let's add an Image control.

ZoomInOut2.gif

ZoomInOut3.gif

In Silverlight 4 we have a new event handler and that is called MouseWheel. So let's subscribe the event for the image.

ZoomInOut4.gif

Now that we have subscribed the event. As you see in the above code display we have the Property called Delata which will be added to the width and height respectively to give the new values and then we are assigning the value.

We are also checking the minimum width and height values.

Let's run the application and click on the image first other wise the focus is not set.

ZoomInOut5.gif

The above image displays the default state when Mouse wheel is not triggered.

Now let's scroll the mouse.

ZoomInOut6.gif

And we have the zoom in effect for the image when we mouse scroll.

That's it.

Hope this article helps.
 

Login to add your contents and source code to this article
share this article :
post comment
 
Team Foundation Server Hosting
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor