63 063
Assignments Done
99,1%
Successfully Done
In July 2018

Answer to Question #8908 in AJAX | JavaScript | HTML | PHP for hamidi

Question #8908
910209 - Where's ResizeEnd event?
hi
i need to know when resize ends in my Silverlight application. how can i do that?
ResizeEnd exists in a form application, but not in a Silverlight application. how can i resemble it?
Expert's answer
1. If you mean that user change Browser size than you cannot know when he stop resize. You can only handle SizeChanged event, like this
private void UserControl_SizeChanged(object sender, SizeChangedEventArgs e)
{
if (e.PreviousSize.Width == 0 || e.PreviousSize.Height == 0)
return;

cmdButton.Width = cmdButton.Width + (e.NewSize.Width - e.PreviousSize.Width);
cmdButton.Height = cmdButton.Height + (e.NewSize.Width - e.PreviousSize.Width);
}

2. If you mean that user change Control size than you can handle MouseLeftButtonDown/MouseLeftButtonUp event, like this:
bool isInResizeMode = false;
Point lastPos;

private void UserControl_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
isInResizeMode = true;
}

private void UserControl_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
isInResizeMode = false;
}

private void UserControl_MouseMove(object sender, MouseEventArgs e)
{
Point newPos = e.GetPosition(this);

if (isInResizeMode)
{
cmdButton.Width = cmdButton.Width + (newPos.X - lastPos.X);
cmdButton.Height = cmdButton.Height + (newPos.Y - lastPos.Y);
}

lastPos = newPos;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions