I've been searching around for more information on how to create a interface that works like the form designer of microsoft visual basic. I couldn't find any information on how it works. So I made my own MDI form and started thinking about it:
When I create a new form in vb, it shows a MDI child, with the form I'm designing inside, and it looks like an image, maybe I could do something like that.
Well, I also have the 'user control' I could create a user control, to control (e.g.) buttons/commands. I could create a button inside a user control, with some little squares on the corners to resize and so on...
After I made my project, I found a simple way of moving, in this example, a button. This is the code I've got for the button:
'boolean to check if we want to move the button Dim boolMovingButton As Boolean Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) 'user clicked inside the button boolMovingButton = True End Sub Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) 'if the user clicked inside the button and moves the mouse If boolMovingButton = True Then 'move the button 'X/Y - position of the mouse !inside! the button 'Command1.Left/.Right - position of the button inside the form 'Int(Command1.Width/.Height / 2) button center locks to mouse when moving Command1.Move X + Command1.Left - Int(Command1.Width / 2), Y + Command1.Top - Int(Command1.Height / 2) End If End Sub Private Sub Command1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) 'user released button, doesn't want to move anymore boolMovingButton = False End Sub
The reason I'm trying to build such application is to create windows for messenger Plus! Live, which are made out of xml files.
Below is the full project I have so far, in a .rar (I couldn't upload the rar as attachment, so here's a link)