Click here to Skip to main content
15,891,657 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I'm made this image1 dragable around the form and i have a button on the form thats suck and doesn't move and when the image1 touches the button on a certain point when it touches the button it cannot drag the image1 that way anymore. for example im dragging the image1 to the right and the image1 touches the button form the right and it just stops and it cannot drag it right anymore but i can still drag it top bottom and left, but not right.
Posted

1 solution

There must be something wrong with your code, without seeing that helping you is close to impossible.
 
Share this answer
 
Comments
[no name] 18-Aug-11 5:45am    
this is what i got so far:
private void view_MouseMove(object sender, MouseEventArgs e)
{
var pos = e.GetPosition(minimap);

if (view.Margin.Top <= 1 || view.Margin.Left <= 1 || view.Margin.Right >= 170 || view.Margin.Bottom >= 100)
{
return;
}

if (e.LeftButton == MouseButtonState.Pressed)
{
view.Margin = new Thickness(pos.X - 20, pos.Y - 10, 0, 0);
}

}

private void minimap_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
var pos = e.GetPosition(minimap);

if (e.LeftButton == MouseButtonState.Pressed)
{
view.Margin = new Thickness(pos.X - 20, pos.Y - 10, 0, 0);
}

}
Simon Bang Terkildsen 18-Aug-11 6:33am    
Can you provide the xaml aswell, please. The above code should work, aslong as the mouse is inside your control and doesn't pass over any controls that handles the MoseMove event.
[no name] 18-Aug-11 7:27am    
<grid height="100" horizontalalignment="Left" margin="10,8,0,0" name="minimap" verticalalignment="Top" width="184" opacitymask="Black" removed="Black" mouseleftbuttondown="minimap_MouseLeftButtonDown">
<rectangle height="26" horizontalalignment="Left" margin="0" name="view" stroke="White" verticalalignment="Top" width="47" mousemove="view_MouseMove">
[no name] 18-Aug-11 7:30am    
sorry for all the replying, couldn't fir all the code in so here is my site that has the code http://techxsoftware.weebly.com/
Simon Bang Terkildsen 18-Aug-11 7:41am    
I can't see the button you're talking about in your original post, which is causing your problem.

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