1 Attachment(s)
Let Users Move/Resize Controls at Runtime
Here I am presenting a sample that I found floating on internet.
This Code allows one to implement a VB IDE like behavior that allows a user to move and resize controls at runtime!
Imagine the possibilities! There are many. For example you will be able to allow your users to arrange the content of any form in your software according to their requirement!
Of course you will have to code the part of saving the location of controls.
Anyways please check this out and enjoy it as much as I have enjoyed it and used it.
Yogi Yang
Re: Let Users Move/Resize Controls at Runtime
WOW! Just what I needed. Thanks!
Re: Let Users Move/Resize Controls at Runtime
Quote:
Originally Posted by
yogiyang
Here I am presenting a sample that I found floating on internet.
This Code allows one to implement a VB IDE like behavior that allows a user to move and resize controls at runtime!
Imagine the possibilities! There are many. For example you will be able to allow your users to arrange the content of any form in your software according to their requirement!
Of course you will have to code the part of saving the location of controls.
Anyways please check this out and enjoy it as much as I have enjoyed it and used it.
Yogi Yang
Hi, I really like your code but I can't get it to work when I want to move controls inside of a UserControl. I get 438 run-time error on the ClientToScreen api. It appears to have a handle value.
Re: Let Users Move/Resize Controls at Runtime
Hello,
Actually I have never tried to run the code in a custom control (User Control). So I can't help you here.
Hope someone more talented than me would help you out.
Regards,
Yogi Yang
Re: Let Users Move/Resize Controls at Runtime
Now if someone can just add rotate with this....
Re: Let Users Move/Resize Controls at Runtime
Re: Let Users Move/Resize Controls at Runtime
Quote:
Originally Posted by
Arnoutdv
Rotate a control??
Yip. That's the idea....
Re: Let Users Move/Resize Controls at Runtime
You want to have for example a ListBox rotated at 30 degrees?
What does this has to do with the moving and resizing controls?
You completely lost me, but the source code is available, so you are free to make these enhancements yourself :)
4 Attachment(s)
Re: Let Users Move/Resize Controls at Runtime
Quote:
Originally Posted by
Arnoutdv
...What does this has to do with the moving and resizing controls?
You completely lost me,...
This is good code. I like it.
If I can get my hands on a rotating tool for some toolboxes, it will perfect for some programs with this (moving and resizing) code included.
It was a bit misleading... :)
Some of the tools cannot be dragged or resized. Here are some of them:
RTFBox
SSCommand
Combo
Needs to be placed inside a panel or picture box. Then double click on the frame/picturebox to resize (any) toolbox/s inside to correct width and/or height (Remember: Combo height cannot be resized).
Here are some coding I added:
Code:
Private Sub Frame2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton And m_bDesignMode Then
DragBegin Frame2
End If
End Sub
Private Sub Frame2_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If m_bDesignMode Then
MCoM.Width = Frame2.Width - 240
End If
End Sub
...and it looks like this:
Attachment 150467
========
For the RTF:
Code:
Private Sub SSFra_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton And m_bDesignMode Then
DragBegin SSFra
End If
End Sub
Private Sub SSFra_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If m_bDesignMode Then
RTX.Width = SSFra.Width - 120
RTX.Height = SSFra.Height - 300
End If
End Sub
...and:
Attachment 150469
[Edited to add:]
Program working:
Attachment 150471Attachment 150473
Re: Let Users Move/Resize Controls at Runtime
very ineresting
is there a way to make controls resizable inside a picturebox
thnks
1 Attachment(s)
Re: Let Users Move/Resize Controls at Runtime
Quote:
Originally Posted by
Mustaphi
very ineresting
is there a way to make controls resizable inside a picturebox
thnks
Check attachment.
Re: Let Users Move/Resize Controls at Runtime
Eduardo
thank you very much