how to slide image with finger touch in wp7 [closed] - c#

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I am developing an windows phone 7 with silverlight application in which i want to slide images with finger touch, can any one help me how to do that

You need to subscribe to the ManipulationDelta event, which sends you information about the changes made by a touch event. e.g:
<Image ManipulationDelta="abc_ManipulationDelta" Height="100" Width="100" Name="abc" Source="smiley.jpg" Stretch="Fill"/>
Now, your event handler should be something like:
private void abc_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
{
abc.Margin = new Thickness(abc.Margin.Left +e.DeltaManipulation.Translation.X,
abc.Margin.Top + e.DeltaManipulation.Translation.Y,
abc.Margin.Right, abc.Margin.Bottom);
}
The e.DeltaManipulation.Translate informs us about the amount of shift the touch gesture had in X and Y directions. I've altered the Margins of the image control by that amount. If there is a downward drag the Translate.Y is +ve i.e, the Top Margin is increased, the opposite happens in upward drag.
You can use more complex margin alterations to produce better drag effects, but this answer gives you basic idea about the technique.

Related

Removing sprites from screen [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
How can we remove sprites from certain co-ordinates position on the screen on occurance of certain event in C#-XNA?
Typically you don't erase anything from the screen. Instead, for every frame, you render everything into a buffer and then render the finished buffer to the screen (to avoid flickering). When the next frame comes, it simply overwrites the previous content on the screen.
So, as said in the comment, you don't erase a sprite - you just don't render it in the next frame. How you achieve that depends on how you manage your Draw cycle.

stretch image in windows store app [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I want to implement stretch image function, user can drag each corner to stretch and pinch the image to make it smaller or bigger. Anyone can help? I use C# and xaml.
Basically you have to write the following on yourself:
Add the Image in XAML
Add four squares
position the squares to the edge
add a mousedown handler to the squares and save the square on mousedown to a property
add a mousemove handler to your application, check if the property is filled
resize the image by calculating the image size. For example for the right-bottom corner (pseudo code):
image.width=square.offset.x-image.offset.x
image.height=square.offset.y-image.offset.y
Add a mouseup handler to your application and release the square-property.
This is very basic. There are lot of good examples out there, mostly for WPF, but you can reuse it for Windows 8. This is a good one, but for image cropping.

Difference between Grid and GridSplitter [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I am new to wpf.I know well to use Grid control.But i don't know where should i use GridSplitter,the use of GridSplitter and why should i use it.Please tell me the difference.
A grid is used for layout. For example, you can say your grid has 2 columns and 2 rows with Width="*", then they will size automatically to take up a quarter of the space.
Now if you want to resize them (like with the navigation pane on the left of windows explorer, you can drag the border to change its width), you can use a GridSplitter. That enables you to grab the edge between the grid's columns (or rows) and resize them.
The grey line that you can drag is a GridSplitter:

hide form scrollbar in C# [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
Maybe this isn't a new question; but unfortunately I'm unable to solve my problem.
My Form needs to show scrollbar, but I don't want use scrollbar all the time.
I want to know how to show the ScrollBar only in specific conditions.
For example:
I want to set specific Form Position without using / showing the scrollbar when form is out of working area boundaries.
Thus my question: How to move Form Horizontally without using scrollbar?
Update: It seems still my question is unclear.
Please find bellow the following conditions:
Form requires ScrollBar functionality when the form border is smaller than the page.
Show ScrollBar when the Form is out of Working Area boundaries.
I wait for your useful replies!
You can set the AutoScroll to false and then update the scroll values programmatically:
this.HorizontalScroll.Value = this.HorizontalScroll.Maximum;

Lock Mouse in primary screen [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I have an application which use secondary monitor to display content. I dont want user to move curser to secondary monitor. I need to restrict the user to use mouse in primary monitor only. How can i do this.
Thanks
The following article describes creating a global hook: Global Hook (code project)
I think this is closer to what you're asking because you wouldn't want to continuously poll with GetCursorPos() function, mentioned in the other answer. However, using the hook and the MouseMove event handler, I would use SetCursorPos() to keep it within bounds.
Cheers,
Jonno
http://pinvoke.net/default.aspx/user32/GetCursorPos.html
http://pinvoke.net/default.aspx/user32/SetCursorPos.html
Use PInvoke to import the calls from the library and simply check the cursor position and adjust accordingly. You might need the resolution size of the monitor to check if it's within the bounds of the first or second screen.

Categories