i have this code that i have been trying to make it so i could move the buttons in the array( the locations of the buttons) but i am not able to move the buttons like i am if i just have a normal button
Code: - Public Class Form1
-
Dim point As New System.Drawing.Point
-
Dim X, Y As Integer
-
Dim buttons(3, 3) As Button
-
Dim times As Integer = 0
-
Structure matching
-
Dim question As String
-
Dim answers() As String
-
-
Dim correctAswr As Integer
-
End Structure
-
Dim match(11) As matching
-
-
-
-
Dim gridSize As Integer = 3
-
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
-
-
End Sub
-
-
'Private Sub Button1_MouseClick(sender As Object, e As MouseEventArgs) Handles Button1.MouseClick
-
' X = Control.MousePosition.X - Button1.Location.X
-
' Y = Control.MousePosition.Y - Button1.Location.Y
-
'End Sub
-
-
'Private Sub Button1_MouseDown(sender As Object, e As MouseEventArgs) Handles Button1.MouseDown
-
-
'End Sub
-
-
'Private Sub Button1_MouseMove(sender As Object, e As MouseEventArgs) Handles Button1.MouseMove
-
' If e.Button = Windows.Forms.MouseButtons.Right Then
-
' ContextMenuStrip = Nothing
-
-
' point = Control.MousePosition
-
' point.X = point.X + (X)
-
' point.Y = point.Y + (Y)
-
' Button1.Location = point
-
-
' End If
-
-
'End Sub
-
-
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
-
Dim buffer As Integer = 0
-
Dim buttonSize As Integer = 87.45
-
For i = 0 To gridSize - 1 'makes the button
-
For j = 0 To gridSize - 1
-
buttons(i, j) = New Button
-
buttons(i, j).Left = buffer + (buffer + buttonSize) * j
-
buttons(i, j).Top = buffer + (buffer + buttonSize) * i
-
buttons(i, j).Height = buttonSize
-
buttons(i, j).Width = buttonSize
-
buttons(i, j).Tag = i & times & j
-
times = times + 1
-
buttons(i, j).Text = "$ " '& Clues(j).money
-
Me.Controls.Add(buttons(i, j))
-
AddHandler buttons(i, j).Click, AddressOf buttonclick
-
AddHandler buttons(i, j).Click, AddressOf Button_Mouseclick
-
AddHandler buttons(i, j).Click, AddressOf Button_MouseMove
-
Next
-
Next
-
End Sub
-
-
-
Sub buttonclick(sender As Button, e As EventArgs)
-
-
Dim row As Integer = Integer.Parse(sender.Tag.ToString.Chars(0))
-
Dim column As Integer = Integer.Parse(sender.Tag.ToString.Chars(2))
-
-
End Sub
-
-
-
Sub Button_Mouseclick(sender As Object, e As MouseEventArgs) Handles Me.MouseClick
-
-
X = Control.MousePosition.X - Me.Location.X
-
Y = Control.MousePosition.Y - Me.Location.Y
-
End Sub
-
-
Private Sub Button_MouseMove(sender As Object, e As MouseEventArgs) Handles Me.MouseMove
-
-
If e.Button = Windows.Forms.MouseButtons.Right Then
-
ContextMenuStrip = Nothing
-
-
point = Control.MousePosition
-
point.X = point.X + (X)
-
point.Y = point.Y + (Y)
-
Me.Location = point
-
-
End If
-
End Sub
-
End Class
0 1030 Sign in to post your reply or Sign up for a free account.
Similar topics
by: Matt |
last post by:
I want to understand the difference between submit button and regular
button: <input type="submit"> and <input type="button">. My understanding is
that submit button will send the entire HTML form...
|
by: Codeman II |
last post by:
Hi there,
I am building a form where the user must upload a picture and fill in his
details.
Now I have a problem as all of this is on the same form.
How will I be able to have the Browse...
|
by: frankcvc |
last post by:
I created a control array at runtime using the following code. I also wanted
to code the controlarray click event. My code can respond to click event
but cannot identify the specific control...
|
by: Newbie |
last post by:
i have a c# asp.net webform that has a "Close" button. When the user clicks
the Close button, a message box saying "do u want to save to database...?".
the problem is that the statements inside the...
|
by: Novice |
last post by:
Hey all, I've already posted this question and two posters offered
suggestions and they worked - but now I would like to know why - and if
possible the answer to a second question.
Here is my...
|
by: Mel |
last post by:
Hi, Is there any way I can force to change button background colour when
toggle button is checked? Just like button change its background colour when
mouseover in MS Visual Studio.NET.
I hope I...
|
by: Bill_W_Stephens |
last post by:
I need a form with two buttons and ability to detect which button was
pressed. I got this code to work using a javascript global variable,
but I know there must be a better way using DOM. Any...
|
by: swartzbill2000 |
last post by:
Hello,
I have an array of Buttons down a column of a TableLayoutPanel. They
all share a common click handler. In the handler, how can I determine
the row of the TableLayoutPanel for the Button...
|
by: kristu |
last post by:
Hi
i have a button array of . know i want that when i press a button, i get the location of the button in the array, not which button is pressed but the location.I used the sender to do a...
|
by: Drummin |
last post by:
How do I get user id from radio button name in an array. The value is a variable. So this section repeats in an array and when submitting the ID and value is passed for each user in the array.
echo...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
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: 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,...
|
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...
| |