Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > General Coding > Coding Tutorials
You last visited: Today at 02:39

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[VB.NET] Form bewegen

Discussion on [VB.NET] Form bewegen within the Coding Tutorials forum part of the General Coding category.

Reply
 
Old   #1

 
P00w's Avatar
 
elite*gold: 186
Join Date: Sep 2010
Posts: 1,519
Received Thanks: 491
[VB.NET] Form bewegen

Hey Leute,
Ihr kennt ja wenn man FormBoderStyle auf "None" setzt
Das man die Form1 wenn sie gestartet ist nicht mehr hin und her schieben kann
Weil ja der Rahmen weg ist

Aber ich habe ein Code für euch damit ihr die Form dann noch immer "hin und her" schieben könnt.
(Jeder der sich gut mit VB auskennt kann das ja eh aber das ist jetzt für die Leute die es noch nicht so gut können)

Code:
    Private Sub Sticky_MouseDown1(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
        If e.Button = Windows.Forms.MouseButtons.Left Then
            Me.Capture = False
            Const WM_NCLBUTTONDOWN As Integer = &HA1S
            Const HTCAPTION As Integer = 2
            Dim msg As Message = Message.Create(Me.Handle, WM_NCLBUTTONDOWN, New IntPtr(HTCAPTION), IntPtr.Zero)
            Me.WndProc(msg)
        End If
    End Sub
P00w is offline  
Thanks
6 Users
Old 09/10/2011, 18:10   #2
 
.KeRo's Avatar
 
elite*gold: 21
Join Date: Mar 2011
Posts: 734
Received Thanks: 130
Ty klappt ganz gut
.KeRo is offline  
Old 09/10/2011, 21:10   #3
 
.SkyneT.'s Avatar
 
elite*gold: 273
Join Date: Sep 2010
Posts: 1,831
Received Thanks: 786
Bekommst ein Thx, hab früher mal ne Zeit lang nach sowas gesucht, dann
hab ichs aber doch noch selber hinbekommen...

(Nur war mein Code viel länger und die einzigen Sachen die gleich sind wie hier
sind :
Code:
    Private Sub Sticky_MouseDown1(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
        If e.Button = Windows.Forms.MouseButtons.Left Then
.SkyneT. is offline  
Thanks
1 User
Old 09/10/2011, 21:52   #4

 
P00w's Avatar
 
elite*gold: 186
Join Date: Sep 2010
Posts: 1,519
Received Thanks: 491
Es gibt einige möglichkeiten es zu machen
P00w is offline  
Old 09/18/2011, 17:48   #5
 
Kraizy​'s Avatar
 
elite*gold: 0
The Black Market: 471/0/0
Join Date: Apr 2010
Posts: 9,696
Received Thanks: 1,811
Quote:
Originally Posted by -_HackGamer View Post
Nice das hat keiner gefunden kriegst ein thanks
gefunden?^^
Kraizy​ is offline  
Thanks
1 User
Old 09/19/2011, 07:22   #6

 
P00w's Avatar
 
elite*gold: 186
Join Date: Sep 2010
Posts: 1,519
Received Thanks: 491
er hats schon editiert^^

Er meinte wohl was anderes
P00w is offline  
Old 10/17/2011, 16:54   #7


 
Benhero's Avatar
 
elite*gold: 964
Join Date: Mar 2008
Posts: 2,634
Received Thanks: 1,637
Gibt es auch eine Möglichkeit die Form über ein Element. In meinem Fall ein Bild zu bewegen? Also ich klicke bild an und bewege die maus und form bewegt sich mit?

Wäre nett wenn jemand ne idee hat wies geht

Mfg. Benhero
Benhero is offline  
Old 10/17/2011, 17:47   #8
 
elite*gold: 0
Join Date: Nov 2007
Posts: 62
Received Thanks: 17
@Benhero: Let just say you want to use it with a picturebox. So declare an MouseDown event for you picturebox and write following code in there:

Code:
private void samplePicBox_MouseDown(object sender, MouseEventArgs e)
{
    const int WmNclButtonDown = 0xA1;
    const int HtCaption = 0x2;

    if (e.Button == MouseButtons.Left)
    {
        ReleaseCapture();
        SendMessage(this.Handle, WmNclButtonDown, HtCaption, 0);
    }
}
but you should also add System.Runtime.InteropServices class to your imports and declare 2 winapi functions.

Code:
[DllImportAttribute("user32.dll")]
public static extern int SendMessage(IntPtr handle, int message, int wParam, int lParam);

[DllImportAttribute("user32.dll")] 
public static extern bool ReleaseCapture();
well it's in C# but I hope you are smart enough to rewrite it with VB.NET or at least use code translator (look at google).
Demon-777 is offline  
Thanks
1 User
Old 10/17/2011, 18:27   #9


 
Benhero's Avatar
 
elite*gold: 964
Join Date: Mar 2008
Posts: 2,634
Received Thanks: 1,637
i´ve just startet with Vb.NET... so i can´t translate it.. and the most Online Translater i hate ....
But thank you very mutch..

Code:
[DllImportAttribute("user32.dll")]
public static extern int SendMessage(IntPtr handle, int message, int wParam, int lParam);

[DllImportAttribute("user32.dll")] 
public static extern bool ReleaseCapture();
Must be
Code:
Import System
Or?

Mfg.
Benhero is offline  
Old 10/17/2011, 18:30   #10
 
Kraizy​'s Avatar
 
elite*gold: 0
The Black Market: 471/0/0
Join Date: Apr 2010
Posts: 9,696
Received Thanks: 1,811
Aus dem Kopf, muss nicht richtig übersetzt sein:
PHP Code:
Private Sub samplePicBox_MouseDown(sender As ObjectAs MouseEventArgsHandles samplePicBox.MouseDown
     
Const WmNclButtonDown As Integer = &HA1
     
Const HtCaption As Integer = &H2

     
If e.Button MouseButtons.Left Then
          ReleaseCapture
()
          
SendMessage(samplePicBox.HandleWmNclButtonDownHtCaption0)
     
End If
End Sub 
Ansonsten:
Kraizy​ is offline  
Thanks
1 User
Old 10/17/2011, 19:11   #11


 
Benhero's Avatar
 
elite*gold: 964
Join Date: Mar 2008
Posts: 2,634
Received Thanks: 1,637
geht leider nicht.
Code:
ReleaseCapture
SendMessage
Nicht Deklariert..

Mfg.
Benhero is offline  
Old 10/17/2011, 19:15   #12
 
Kraizy​'s Avatar
 
elite*gold: 0
The Black Market: 471/0/0
Join Date: Apr 2010
Posts: 9,696
Received Thanks: 1,811
Quote:
Originally Posted by Benhero View Post
geht leider nicht.
Code:
ReleaseCapture
SendMessage
Nicht Deklariert..

Mfg.
Bitte Grundlagen lernen..
Diese musste ja auch erstmal deklarieren.
Post von Demon-777:
Quote:
[DllImportAttribute("user32.dll")]
public static extern int SendMessage(IntPtr handle, int message, int wParam, int lParam);

[DllImportAttribute("user32.dll")]
public static extern bool ReleaseCapture();
Benutz die Seite, die ich dir gegeben habe und lass es nach VB.NET übersetzen.
Kraizy​ is offline  
Thanks
2 Users
Old 10/17/2011, 19:23   #13


 
Benhero's Avatar
 
elite*gold: 964
Join Date: Mar 2008
Posts: 2,634
Received Thanks: 1,637
Problem soweit gelöst...

Weiteres Problem.. Er verschiebt zwar das Bild. Aber die Form nicht mit :/
Ist dies irgendwie möglich?

Mfg.

##### EDIT
Code:
Imports System.Runtime.InteropServices
war erforderlich &
Code:
SendMessage(PictureBox1.Handle, WmNclButtonDown, HtCaption, 0)
Durch:
Code:
 SendMessage(Me.Handle, WmNclButtonDown, HtCaption, 0)
ersetzen Danke für eure Hilfe!!!
Benhero is offline  
Old 10/17/2011, 19:53   #14
 
Kraizy​'s Avatar
 
elite*gold: 0
The Black Market: 471/0/0
Join Date: Apr 2010
Posts: 9,696
Received Thanks: 1,811
Achso, dachte du willst die PicBox bewegen, und nicht über diese die komplette Form. Naja dann ist ja logisch, dass du das Handle der Form selbst nehmen musst.^^
Kraizy​ is offline  
Thanks
1 User
Old 07/26/2012, 03:37   #15



 
Sedrika's Avatar
 
elite*gold: 18
The Black Market: 103/0/0
Join Date: Sep 2009
Posts: 20,174
Received Thanks: 14,475
Ist zwar etwas her aber das hier ist die beste Methode find ich:
PHP Code:
    Private ptMouseDownLocation As Point
    
Private Sub f_MouseDown(ByVal sender As ObjectByVal e As System.Windows.Forms.MouseEventArgsHandles Me.MouseDown
        
If e.Button Windows.Forms.MouseButtons.Left Then
            ptMouseDownLocation 
e.Location
        End 
If
    
End Sub
    
Private Sub f_MouseMove(ByVal sender As ObjectByVal e As System.Windows.Forms.MouseEventArgsHandles Me.MouseMove
        
If e.Button Windows.Forms.MouseButtons.Left Then
            Me
.Location e.Location ptMouseDownLocation Me.Location
        End 
If
    
End Sub 
Sedrika is offline  
Reply


Similar Threads Similar Threads
Druid Cat Form -> FireLands Cat Form
08/01/2011 - World of Warcraft - 2 Replies
Hallo Leute, hat jemand die Möglichkeiten mir eine Tauren Katze zur Firelands Katze zu swappen - sofern dies in 4.2 FIRELANDS noch möglich ist. Wobei die Vergangenheit uns gelehrt hat, das es immer Mittel und Wege gibt. (: http://manaflask.com/images/galleries/scaled_1307 971939_flamecat.jpg LG Windkirsche
Von Form Zu Form Wechseln.
04/14/2011 - AutoIt - 2 Replies
Hallo Erstmal! Ich wollte mal etwas machen das von einer form zur anderen wechselt jetzt wollt ich das aber auch so machen das wenn man auf einen zurück button klickt es wieder zur ersten form kommt und dann alles neu einstellen kann. also bis zu dem zurück und neu einstellen hab ich geschafft aber wenn man dann wieder auf weiter klickt passiert nix ... Könntet ihr mir helfen? Hier ist ein beispiel script #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include...
Anonym im I-net bewegen
04/22/2010 - Off Topic - 1 Replies
Habe mal ne kleine Frage zu sogenannten Ip Verschlüsselungs programmen wie z.B. Tor/Jap und son Zeugs die deine Ip für andere Leute "relativ unsichtbar" machen?Hat jemand so ein Programm oder kann mir jemand eins raten weil google spuckt unmengen an Ergebnissen aus(muss natürlich Freeware sein) und ehrlich gesagt weis ich nicht was davon etwas taugt:confused:.Habe mir mal probeweise Tor runtergeladen(Link-Chip.de http://www.chip.de/downloads/Tor-amp-Privoxy-amp-V idalia-Paket_19408583.html)....
Druid Tree form buff without tree Form
11/11/2007 - WoW Exploits, Hacks, Tools & Macros - 5 Replies
My buddy and i were screwing around the other day in Mech and we figured out a way to have a working tree form buff for the party but not be in tree form. Which if anyone knows about druids allows them to cast all their other high healing spells. Anyway follow the instructions below its a bit tricky 1. Change your chest item to something else 2. Get into Combat.. Queue your chestpiece to switch back to your original 3. When the fights finishing, Get ready.. The second the...
Bot bewegen!!!
06/05/2006 - Lineage 2 - 11 Replies
Gott zum grusse, ich hab da mal eine frage wegen den L2-Walker ... wie kann ich den Bot sagen das wenn der gestorben ist... das der wieder in das Kampfgebiet zurück geht ??? Weil der KOmmt ja dann immer wieder in der nächsten stadt raus... ich will aber auch nicht alle 2 stunden meinen Char erst wieder dahin bringen damit der da weiter kämpfen kann!!! Ich hab gesehen das es sogar geht das die Selber handeln und bei den NPC einkaufen also muss das mit den gehen in das Kampsgeniet auch...



All times are GMT +1. The time now is 02:40.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.