Resizable rectangle

tmostad

New member
Joined
Dec 5, 2005
Messages
3
Programming Experience
3-5
I am trying to create a simple calendar with drag and drop resizable event objects (e.g.'s meetings, lunch etc.). They need to be resizable in the Y axis only. I have found some example code that shows how to do drag and drop but I can't figure out how to make the objects resizable. Is there an easy way to do this? I am a newbie to VB.NET but have done a lot of programming in VB6.
 
The idea is to make a control and, when the mouseDown event occurs for this control, you get the mouse coordinates. The check, if the cursor.position.y increases, you increase the height of your calendar object. Try using the following API functions: ReleaseCapture, SendMessage, the WM_NCLBUTTONDOWN constant with the MouseMove event of your control. I use this for moving forms with no titlebar, but a few modifications will work so you can resize the control. Ask Kulrom for documentation about the API.
 
Last edited:
This should be good start for you ... just draw anything you want on the panel control and then do couple things (you will find more in the attached project) and finally add some code to mouse_move event i.e.
VB.NET:
[SIZE=2][COLOR=#0000ff]Private [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] Panel1_MouseMove([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] sender [/SIZE][SIZE=2][COLOR=#0000ff]As [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Object[/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.Windows.Forms.MouseEventArgs) [/SIZE][SIZE=2][COLOR=#0000ff]Handles[/COLOR][/SIZE][SIZE=2] Panel1.MouseMove
[/SIZE][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=2] myFlag = [/SIZE][SIZE=2][COLOR=#0000ff]True [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]And[/COLOR][/SIZE][SIZE=2] myStart = [/SIZE][SIZE=2][COLOR=#0000ff]True[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].Panel1.Size = [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] Size([/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].Panel1.Width, Cursor.Position.Y)
[/SIZE][SIZE=2][COLOR=#0000ff]End [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]If
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]End [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE]

Regards ;)
 

Attachments

  • ResizibleObject.zip
    22 KB · Views: 69
Back
Top