hi everybody
i need help to make special control that will contain text
and can be resizable and move by mouse
like the how we do in visual studio when we are programing
:$
how can i do one like it,
or if there is exist one
thanx in advanced
10 1321
This is how you move the control around on the form. just changed the btnMove to the name of the control that you want to be able to move. - Inherits System.Windows.Forms.Form
-
Public Dragging As Boolean
-
Public mousex, mousey As Integer
-
-
Private Sub btnMove_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles btnMove.MouseDown
-
If e.Button = MouseButtons.Left Then
-
Dragging = True
-
mousex = -e.X
-
mousey = -e.Y
-
Dim clipleft As Integer = Me.PointToClient(MousePosition).X - btnMove.Location.X
-
Dim cliptop As Integer = Me.PointToClient(MousePosition).Y - btnMove.Location.Y
-
Dim clipwidth As Integer = Me.ClientSize.Width - (btnMove.Width - clipleft)
-
Dim clipheight As Integer = Me.ClientSize.Height - (btnMove.Height - cliptop)
-
Cursor.Clip = Me.RectangleToScreen(New Rectangle(clipleft, cliptop, clipwidth, clipheight))
-
btnMove.Invalidate()
-
End If
-
End Sub
-
-
Private Sub btnMove_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles btnMove.MouseMove
-
If Dragging Then
-
'move control to new position
-
Dim MPosition As New Point()
-
MPosition = Me.PointToClient(MousePosition)
-
MPosition.Offset(mousex, mousey)
-
'ensure control cannot leave container
-
btnMove.Location = MPosition
-
End If
-
End Sub
-
-
Private Sub btnMove_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles btnMove.MouseUp
-
If Dragging Then
-
'end the dragging
-
Dragging = False
-
'Me.Capture = False
-
Cursor.Clip = Nothing
-
btnMove.Invalidate()
-
End If
-
End Sub
This is how you move the control around on the form. just changed the btnMove to the name of the control that you want to be able to move. - Inherits System.Windows.Forms.Form
-
Public Dragging As Boolean
-
Public mousex, mousey As Integer
-
-
Private Sub btnMove_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles btnMove.MouseDown
-
If e.Button = MouseButtons.Left Then
-
Dragging = True
-
mousex = -e.X
-
mousey = -e.Y
-
Dim clipleft As Integer = Me.PointToClient(MousePosition).X - btnMove.Location.X
-
Dim cliptop As Integer = Me.PointToClient(MousePosition).Y - btnMove.Location.Y
-
Dim clipwidth As Integer = Me.ClientSize.Width - (btnMove.Width - clipleft)
-
Dim clipheight As Integer = Me.ClientSize.Height - (btnMove.Height - cliptop)
-
Cursor.Clip = Me.RectangleToScreen(New Rectangle(clipleft, cliptop, clipwidth, clipheight))
-
btnMove.Invalidate()
-
End If
-
End Sub
-
-
Private Sub btnMove_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles btnMove.MouseMove
-
If Dragging Then
-
'move control to new position
-
Dim MPosition As New Point()
-
MPosition = Me.PointToClient(MousePosition)
-
MPosition.Offset(mousex, mousey)
-
'ensure control cannot leave container
-
btnMove.Location = MPosition
-
End If
-
End Sub
-
-
Private Sub btnMove_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles btnMove.MouseUp
-
If Dragging Then
-
'end the dragging
-
Dragging = False
-
'Me.Capture = False
-
Cursor.Clip = Nothing
-
btnMove.Invalidate()
-
End If
-
End Sub
i dont mean to move element i can do it using drag and drop
but i need special kind of control to use it as text box to insert text inside it and that box can be moved and resize :$
thank u for ur answer i appreciate that :)
i believe user controls are resizable in the designer view on visual studio?
joedeene
i believe user controls are resizable in the designer view on visual studio?
joedeene
u are right
i need control to be resizable also when my program running :$
not only in the designer view :)
thank u joedeene
:)
plz help me :$
Well, build on what you know. Now that you know how to move a control, instead of changing the position, change the size.
Well, build on what you know. Now that you know how to move a control, instead of changing the position, change the size.
mmmm
i know how can i resize it using code
but i need to do using mouse ...
i hope what i mean is clear
:$
thank u nsertAlias :)
mmmm
i know how can i resize it using code
but i need to do using mouse ...
i hope what i mean is clear
:$
thank u nsertAlias :)
ok bud, now that, i think, i get what you're trying to accomplish perhaps a link like THIS ONE, and just a simple google search such as "how to make resizable controls at runtime", thats how i found the link. well ok.. let me know if thats what you were looking for...
joedeene
You will have to use code to do the resizing. But you can adapt the code for dragging a control into code for resizing. You have to change size instead of location.
ok bud, now that, i think, i get what you're trying to accomplish perhaps a link like THIS ONE, and just a simple google search such as "how to make resizable controls at runtime", thats how i found the link. well ok.. let me know if thats what you were looking for...
joedeene
yes
.....that what i want :)
but instead of picture i need text-box...and i need it in c#
than u very much
yes
.....that what i want :)
but instead of picture i need text-box...and i need it in c#
than u very much
well, they say that code works for any code
picturebox named pbDemo in this example, but it could be any control),
And well, make an attempt to convert the code yourself, and when you run into stumbles, post the part you cannot convert and we will help you...
joedeene
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Bruce Rusk |
last post by:
I'm using Stephen Lebans' RTF2 control in a report, and have discovered what
may be a slight bug in it.
I have a lot of non-Western language (Chinese) text in my RTF field, and
such records get...
|
by: John Lau |
last post by:
Hi,
Is there documentation that talks about the page lifecycle, the lifecycle of
controls on the page, and the rendering of inline code, in a single
document?
Thanks,
John
|
by: Moe Sizlak |
last post by:
Hi There,
I am trying to return the value of a listbox control that is included as a
user control, I can return the name of the control but I can't access the
integer value of the selected item,...
|
by: Ryan Ternier |
last post by:
Hello,
I have a repeater control that does the following on the ItemDataBound
event. It works perfectly, except that when it prints out, the names of the
controls
aren't what I'd expect.
...
|
by: grist2mill |
last post by:
I want to create a standard tool bar that appears on all pages that is
a control. The toolbar has a button 'New'. What I wolud like when the
user clicks on 'New' depends on the page they are on. I...
|
by: Guadala Harry |
last post by:
In an ASCX, I have a Literal control into which I inject a
at runtime.
litInjectedContent.Text = dataClass.GetHTMLSnippetFromDB(someID);
This works great as long as the contains just...
|
by: Charts |
last post by:
I use VS2005 to build a asp.net 2.0 project. I want to be able to click a
button on the page and have a dialog window appear where I can navigate the
folders to get hold of a file path to load...
|
by: nate |
last post by:
the error returned is this:
Server Error in '/AnnAccRpt' Application.
--------------------------------------------------------------------------------
Could not find control 'DropDownList1' in...
|
by: Ron L |
last post by:
I have a barcode scanner which uses a "keyboard wedge" program so that the
data it scans comes through as if it was typed on a keyboard. I am trying
to have the data in the barcode be displayed in...
|
by: fernandezr |
last post by:
I would like to use a user control as a template inside a repeater.
Some of the fields in the control should be hidden depending on whether
or not there is data. I'm still a ASP .Net newbie so the...
|
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...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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,...
|
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...
|
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: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
| |