Użyłem rozwiązań Don Kirkby'ego i Matthew Ferreiry i stworzyłem własne rozwiązanie łączące te dwa. Dodałem StatusStrip o nazwie "resizeHandle", zrobiłem jego rozmiar 20x20 pikseli i słuchałem jego wydarzeń.
public class CustomForm : Form
{
private const int WmNcLButtonDown = 0xA1;
private const int HtBottomRight = 17;
private const int wmNcLButtonUp = 0xA2;
private bool isResizing = false;
[DllImport("user32.dll")]
private static extern int ReleaseCapture();
[DllImport("user32.dll")]
private static extern int SendMessage(IntPtr hwnd, int msg, int wparam, int lparam);
private void resizeHandle_MouseDown(object sender, MouseEventArgs e)
{
isResizing = true;
}
private void resizeHandle_MouseMove(object sender, MouseEventArgs e)
{
if (isResizing)
{
// Check if we have released the Left mouse button
isResizing = (e.Button == MouseButtons.Left);
ReleaseCapture();
if (isResizing)
{
SendMessage(Handle, wmNcLButtonDown, HtBottomRight, 0);
}
else
{
// Left Mouse button was released, end resizing.
SendMessage(Handle, wmNcLButtonUp, HtBottomRight, 0);
}
}
}
Yeh Wprowadziłem zmianę rozmiaru w ten sam sposób kilka dni temu. Ale myślę, że powinienem wybrać twoją odpowiedź, ponieważ byłeś pierwszym, który napisał tutaj. –