473,387 Members | 1,497 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Form Designer

Lou
Is there a runtime form designer that comes with vs2005 or vs2008.
I need a control to allow users to add and position controls on a form.

-Lou
Nov 16 '08 #1
2 1589
On Nov 16, 6:31*am, "Lou" <lou.gar...@comcast.netwrote:
Is there a runtime form designer that comes with vs2005 or vs2008.
I need a control to allow users to add and position controls on a form.

-Lou
As far as i know, there is no built-in solution for behaving like
desinger at runtime. Instead, you need to manipulate objects
dynamically by writing your own code. However there may be 3rd party
commercial components that may allow this.

And regarding to your aim, you can add controls to your form
dynamically by using <form>.Controls.Add method after you've
instantiated them. And in the same way for setting their position as
follows:

' Eg. Add a button at runtime
Dim mybutton As New Button
mybutton.Text = "My Button"
' Allow users to specify button's
' position here
mybutton.Location = New Point(100,100)
' Add it
Me.Controls.Add(mybutton)

Additonaly, for moving your control at runtime by dragging with mouse
cursor, you can check this snippet on:
http://bytes.com/forum/thread378975.html

And as the courtesy of the link above, the code:

'---------------Begin----------------
Private dragging As Boolean
Private beginX, beginY As Integer

Private Sub Button1_MouseDown(ByVal sender As Object, _
ByVal e As System.Windows.Forms.MouseEventArgs) _
Handles Button1.MouseDown

dragging = True
beginX = e.X
beginY = e.Y

End Sub

Private Sub Button1_MouseMove(ByVal sender As Object, _
ByVal e As System.Windows.Forms.MouseEventArgs) _
Handles Button1.MouseMove
If dragging = True Then
Button1.Location = New Point(Button1.Location.X _
+ e.X - beginX, Button1.Location.Y + e.Y - beginY)
Me.Refresh()
End If
End Sub

Private Sub Button1_MouseUp(ByVal sender As Object, _
ByVal e As System.Windows.Forms.MouseEventArgs) _
Handles Button1.MouseUp

dragging = False

End Sub
'---------------End------------------

Hope this helps,

Onur Güzel

Nov 17 '08 #2
Lou
That's awesome.
Thanks you.
-Lou

"kimiraikkonen" <ki*************@gmail.comwrote in message
news:3f**********************************@f37g2000 pri.googlegroups.com...
On Nov 16, 6:31 am, "Lou" <lou.gar...@comcast.netwrote:
Is there a runtime form designer that comes with vs2005 or vs2008.
I need a control to allow users to add and position controls on a form.

-Lou
As far as i know, there is no built-in solution for behaving like
desinger at runtime. Instead, you need to manipulate objects
dynamically by writing your own code. However there may be 3rd party
commercial components that may allow this.

And regarding to your aim, you can add controls to your form
dynamically by using <form>.Controls.Add method after you've
instantiated them. And in the same way for setting their position as
follows:

' Eg. Add a button at runtime
Dim mybutton As New Button
mybutton.Text = "My Button"
' Allow users to specify button's
' position here
mybutton.Location = New Point(100,100)
' Add it
Me.Controls.Add(mybutton)

Additonaly, for moving your control at runtime by dragging with mouse
cursor, you can check this snippet on:
http://bytes.com/forum/thread378975.html

And as the courtesy of the link above, the code:

'---------------Begin----------------
Private dragging As Boolean
Private beginX, beginY As Integer

Private Sub Button1_MouseDown(ByVal sender As Object, _
ByVal e As System.Windows.Forms.MouseEventArgs) _
Handles Button1.MouseDown

dragging = True
beginX = e.X
beginY = e.Y

End Sub

Private Sub Button1_MouseMove(ByVal sender As Object, _
ByVal e As System.Windows.Forms.MouseEventArgs) _
Handles Button1.MouseMove
If dragging = True Then
Button1.Location = New Point(Button1.Location.X _
+ e.X - beginX, Button1.Location.Y + e.Y - beginY)
Me.Refresh()
End If
End Sub

Private Sub Button1_MouseUp(ByVal sender As Object, _
ByVal e As System.Windows.Forms.MouseEventArgs) _
Handles Button1.MouseUp

dragging = False

End Sub
'---------------End------------------

Hope this helps,

Onur Güzel
Nov 19 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Chris | last post by:
Hi, I'm trying to append text from another class to a generic richTextBox that I've added to a Windows form. I can't seem to figure out how to expose the richTextBox to append text to it. ...
2
by: Jaikumar | last post by:
Hi, 1) I have created one windows application, In the main form ( form1) i have added one usercontrol (usercontrol1), In that user control i am drawing one image. 2) In the UserControl1 i am...
2
by: baret bonden | last post by:
Trying to return a selected listbox item to another form .tried lots of ways; defining public variables and passing those as well as textboxes ..I' m able to display the chosen item on it's form...
18
by: Jan Nielsen | last post by:
Hi I have a main form showing personal information (name, address etc.) bound to a dataset. One of the pieces of information is the Group the person belongs to. This is selected from a combo box....
0
by: Amiram Korach | last post by:
When you create a MDI form, you can attach a main menu to the parent and to the child. When a child form is active, its menu is merged with the parent menu. The problem is: when the forms are...
4
by: Rod Gill | last post by:
Hi, I have a form that when opened in the designer appears of the screen. The form selector can't be dragged (or resized) and if I scroll right and down to centralise it the form simply jumps...
7
by: Terry | last post by:
I have a Mainform with a Statusbar. When opening another form or doing some processing I want to display info in the Statusbar of the Mainform. I have read a lot of articles on this & have come up...
6
by: Arkadiusz Smolak | last post by:
Hi, I need a help. I have form inherited from other form. The base form implementation is placed in other assembly. I try to open my inherited form in designer but visual studio throws an...
4
by: ThunderMusic | last post by:
Hi, I have a custom form that works fine when I debug it or run it in release mode but cannot be loaded in the designer... Actually, it can be loaded in the designer when no control is on it, but...
8
by: TomC | last post by:
I want to bypass the Windows Form Designer in VS, to create a form programmatically. The elements of the form are to be arranged in a table, and I want the size of the table (and therefore the...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.