Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


VB2008-Moving your form with a button

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Orbit
Advanced Cheater
Reputation: 0

Joined: 09 Dec 2007
Posts: 74

PostPosted: Sun Jul 06, 2008 9:06 am    Post subject: VB2008-Moving your form with a button Reply with quote

Hello Guys,
I want to ask how can i drag a form using a button
Back to top
View user's profile Send private message
DeletedUser14087
I post too much
Reputation: 2

Joined: 21 Jun 2006
Posts: 3069

PostPosted: Sun Jul 06, 2008 10:06 am    Post subject: Reply with quote

What do you mean using a button ? can't you just drag it ?
Back to top
View user's profile Send private message
Orbit
Advanced Cheater
Reputation: 0

Joined: 09 Dec 2007
Posts: 74

PostPosted: Sun Jul 06, 2008 10:40 am    Post subject: Reply with quote

You can if you have the top bar visible but i am hiding it and now i want to move the form using a button
Back to top
View user's profile Send private message
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Sun Jul 06, 2008 2:34 pm    Post subject: Reply with quote

Code:

Me.Position.X = 0
Me.Position.Y = 0


or

Code:

Me.X = 0
Me.Y = 0


I think.

Been a while since I've messed with that stuff.

_________________
Wiccaan wrote:

Oh jeez, watchout I'm a bias person! Locked.


Auto Assembly Tuts:
In Depth Tutorial on AA
Extended
Back to top
View user's profile Send private message
Typhoon808
Expert Cheater
Reputation: 0

Joined: 27 Mar 2008
Posts: 175
Location: Wales

PostPosted: Sun Jul 06, 2008 4:05 pm    Post subject: Reply with quote

Try using:

Code:
Form1.Location = New Point(xValue, yValue).
Back to top
View user's profile Send private message
Orbit
Advanced Cheater
Reputation: 0

Joined: 09 Dec 2007
Posts: 74

PostPosted: Tue Jul 08, 2008 7:57 am    Post subject: Reply with quote

Sorry but Typhoon808 nor samuri25404 code works
Back to top
View user's profile Send private message
Typhoon808
Expert Cheater
Reputation: 0

Joined: 27 Mar 2008
Posts: 175
Location: Wales

PostPosted: Tue Jul 08, 2008 8:31 am    Post subject: Reply with quote

Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Me.Location = New Point(100, 100)
    End Sub


This seems to work for me.
Back to top
View user's profile Send private message
Orbit
Advanced Cheater
Reputation: 0

Joined: 09 Dec 2007
Posts: 74

PostPosted: Tue Jul 08, 2008 8:50 am    Post subject: Reply with quote

Typhoon808 wrote:
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Me.Location = New Point(100, 100)
    End Sub


This seems to work for me.

This doesnt work
I found the correct code it is

Code:
    Private blnMoving As Boolean = False
    Private MouseDownX As Integer
    Private MouseDownY As Integer

    Private Sub Button1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button1.MouseDown
        If e.Button = MouseButtons.Left Then
            blnMoving = True
            MouseDownX = e.X
            MouseDownY = e.Y
        End If
    End Sub

    Private Sub Button1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button1.MouseMove
        If blnMoving Then
            Dim temp As Point = New Point()

            temp.X = Me.Location.X + (e.X - MouseDownX)
            temp.Y = Me.Location.Y + (e.Y - MouseDownY)
            Me.Location = temp
        End If
    End Sub

    Private Sub Button1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button1.MouseUp
        If e.Button = MouseButtons.Left Then
            blnMoving = False
        End If
    End Sub


+repped samuri25404
As he gave me the idea Smile
Back to top
View user's profile Send private message
Snootae
Grandmaster Cheater
Reputation: 0

Joined: 16 Dec 2006
Posts: 969
Location: --->

PostPosted: Tue Jul 08, 2008 9:19 am    Post subject: Reply with quote

the reason it did not work is because you did not tell anyone what you wanted to do, if you say moving with a button, we assume it is by pressing and it moves to a certain point

be more specific and we will help you more

_________________
Back to top
View user's profile Send private message
Typhoon808
Expert Cheater
Reputation: 0

Joined: 27 Mar 2008
Posts: 175
Location: Wales

PostPosted: Tue Jul 08, 2008 9:24 am    Post subject: Reply with quote

Oh, I see what you want to do now.
This is a much easier way of dragging a form without use of API functions and mouse events:
http://www.planet-source-code.com/URLSEO/vb/scripts/ShowCode!asp/txtCodeId!3965/lngWId!10/anyname.htm

As Snootae said, be more specific and you will get an answer much quicker. Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites