| You must Sign In to use this message board. |
|
|
 |
|
 |
Now Width and Height, both are resizable.
with this code,
bool _mouseDownForWidth = false , _mouseDownForHeight = false; const int _minLength = 35 , _minHeight = 20; private System.Windows.Forms.Button button1; const int _margin = 3; private void button1_mouseDown(object sender, MouseEventArgs e) { if (e.X >= button1.Width - _margin && e.X <= button1.Width + _margin) { _mouseDownForWidth = true; button1.Cursor = Cursors.SizeWE; } if (e.Y >= button1.Height - _margin && e.Y <= button1.Height + _margin) { _mouseDownForHeight = true; button1.Cursor = Cursors.SizeNS; } if (_mouseDownForWidth == true && _mouseDownForHeight == true) { button1.Cursor = Cursors.SizeNWSE; } }
private void button1_MouseMove(object sender, MouseEventArgs e) { if (_mouseDownForWidth == true) { button1.Width = (e.X < _minLength ? _minLength : e.X); } if (_mouseDownForHeight == true) { button1.Height = (e.Y < _minHeight ? _minHeight : e.Y); } if (_mouseDownForWidth == false && _mouseDownForHeight == false) { if (e.X >= button1.Width - _margin && e.Y >= button1.Height - _margin) { button1.Cursor = Cursors.SizeNWSE; } else { if (e.X >= button1.Width - _margin) button1.Cursor = Cursors.SizeWE; else { if (e.Y >= button1.Height - _margin) button1.Cursor = Cursors.SizeNS; else button1.Cursor = this.Cursor; } } } }
private void button1_MouseUp(object sender, MouseEventArgs e) { _mouseDownForWidth = false; _mouseDownForHeight = false; button1.Cursor = this.Cursor; }
"Today is mine, Tomorrow of no ones"
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
 | code in c#,  acharyakrishna1978@yahoo.com | 21:43 25 May '06 |
|
 |
i m posting this, because it is very usefull, as i hv used it. and i can know its importance.
bool _mouseDown = false; const int _minLength = 35; const int _margin = 3; private void label1_MouseDown(object sender, MouseEventArgs e) { if (e.X >= label1.Width - _margin && e.X <= label1.Width + _margin) { _mouseDown = true; label1.Cursor = Cursors.VSplit; } }
private void label1_MouseMove(object sender, MouseEventArgs e) { if (_mouseDown == true) { label1.Width = (e.X < _minLength ? _minLength : e.X); } else { if (e.X >= label1.Width - _margin) label1.Cursor = Cursors.VSplit; else label1.Cursor = this.Cursor; } }
private void label1_MouseUp(object sender, MouseEventArgs e) { _mouseDown = false; label1.Cursor = this.Cursor; }
today is mine, tomorrow of no ones
|
| Sign In·View Thread·PermaLink | 1.00/5 |
|
|
|
 |
|
|
 |
|
|