15,911,786 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by kamaraj sp (Top 2 by date)
kamaraj sp
30-Apr-12 2:43am
View
public sealed partial class BlankPage : Page
{
private TransformGroup _transformGroup;
private TranslateTransform _translate;
private ScaleTransform _scale;
private RotateTransform _rotate;
private bool forceManipulationsToEnd;
public BlankPage()
{
this.InitializeComponent();
forceManipulationsToEnd = false;
Img1.ManipulationStarting += new ManipulationStartingEventHandler(Img1_ManipulationStarting);
Img1.ManipulationStarted += new ManipulationStartedEventHandler(Img1_ManipulationStarted);
Img1.ManipulationDelta += new ManipulationDeltaEventHandler(Img1_ManipulationDelta);
Img1.ManipulationCompleted += new ManipulationCompletedEventHandler(Img1_ManipulationCompleted);
InitManipulationTransforms();
}
///
/// Invoked when this page is about to be displayed in a Frame.
///
/// <param name="e">Event data that describes how this page was reached. The Parameter
/// property is typically used to configure the page.</param>
protected override void OnNavigatedTo(NavigationEventArgs e)
{
}
private void InitManipulationTransforms()
{
_translate = new TranslateTransform()
{
X = 0,
Y = 0
};
_scale = new ScaleTransform()
{
ScaleX = 1,
ScaleY = 1,
CenterX = Img1.ActualWidth / 2,
CenterY = Img1.ActualHeight / 2
};
_rotate = new RotateTransform()
{
Angle = 0,
CenterX = Img1.ActualWidth / 2,
CenterY = Img1.ActualHeight / 2
};
_transformGroup = new TransformGroup();
((IList<Transform>)_transformGroup.Children).Add(_rotate);
((IList<Transform>)_transformGroup.Children).Add(_scale);
((IList<Transform>)_transformGroup.Children).Add(_translate);
Img1.RenderTransform = _transformGroup;
}
void Img1_ManipulationStarting(object sender, ManipulationStartingRoutedEventArgs e)
{
forceManipulationsToEnd = false;
e.Handled = true;
}
void Img1_ManipulationStarted(object sender, ManipulationStartedRoutedEventArgs e)
{
e.Handled = true;
}
void Img1_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
{
if (forceManipulationsToEnd)
{
e.Complete();
return;
}
_rotate.Angle += (e.Delta.Rotation * 180 / Math.PI);
_scale.ScaleX = _scale.ScaleY *= e.Delta.Scale;
_scale.CenterX = Img1.ActualWidth / 2;
_scale.CenterY = Img1.ActualHeight / 2;
_translate.X += e.Delta.Translation.X;
_translate.Y += e.Delta.Translation.Y;
e.Handled = true;
}
void Img1_ManipulationCompleted(object sender, ManipulationCompletedRoutedEventArgs e)
{
e.Handled = true;
}
async private void BtnLoad_Click(object sender, RoutedEventArgs e)
{
FileOpenPicker imagePicker = new FileOpenPicker
{
ViewMode = PickerViewMode.Thumbnail,
SuggestedStartLocation = PickerLocationId.PicturesLibrary,
FileTypeFilter = { ".jpg", ".png", ".bmp", ".gif", ".tif" }
};
StorageFile imageFile = await imagePicker.PickSingleFileAsync();
if (imageFile != null)
{
//this.scenarioId = ScenarioId.Image;
IRandomAccessStream displayStream = await imageFile.OpenAsync(FileA
kamaraj sp
24-Apr-12 5:08am
View
If I zoom out the image more, the image is not visible its looking like a dot and I couldn't zoom again. If I drag the image to corner of the screen, the image is going out of screen.