<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Drag&amp;amp;Drop simulieren]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich habe Panel1 und Panel2 auf meiner Form. Das Panel2 kann ich mit der Maus auf meiner Form verschieben (s.u.), nun möchte ich das Panel2 auf Panel1 &quot;ablegen&quot;.</p>
<p>Wie kann ich erreichen, dass bei Panel1 ein Ereignis ausgelöst wird wenn ich &quot;mit&quot; Panel 2 darüber fahre?</p>
<p>Was ich brauche ist eine Art von &quot;Drag &amp; Drop&quot; aber wo gleichzeitig eben das Panel mitbewegt wird und nicht nur ein anderer Mauszeiger angezeigt wird.</p>
<pre><code class="language-cpp">TForm1 *Form1;
int lastx, lasty;
bool b_move = false;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)     : TForm(Owner){}
//---------------------------------------------------------------------------
void __fastcall TForm1::Panel2MouseDown(TObject *Sender,
      TMouseButton Button, TShiftState Shift, int X, int Y)
{
        b_move = true;
        lastx = X;
        lasty = Y;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Panel2MouseUp(TObject *Sender, TMouseButton Button,
      TShiftState Shift, int X, int Y)
{
        b_move = false;
        this-&gt;DockDrop()
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Panel2MouseMove(TObject *Sender, TShiftState Shift,
      int X, int Y)
{
        if ( b_move == true )
        {
          Panel2-&gt;Left = Panel2-&gt;Left + X - lastx;
          Panel2-&gt;Top = Panel2-&gt;Top + Y - lasty;
        }
}
//---------------------------------------------------------------------------
</code></pre>
<p>Danke im Voraus<br />
teaseMe</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/128106/drag-amp-drop-simulieren</link><generator>RSS for Node</generator><lastBuildDate>Wed, 29 Jul 2026 06:13:53 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/128106.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 30 Nov 2005 13:35:40 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Drag&amp;amp;Drop simulieren on Wed, 30 Nov 2005 13:35:40 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich habe Panel1 und Panel2 auf meiner Form. Das Panel2 kann ich mit der Maus auf meiner Form verschieben (s.u.), nun möchte ich das Panel2 auf Panel1 &quot;ablegen&quot;.</p>
<p>Wie kann ich erreichen, dass bei Panel1 ein Ereignis ausgelöst wird wenn ich &quot;mit&quot; Panel 2 darüber fahre?</p>
<p>Was ich brauche ist eine Art von &quot;Drag &amp; Drop&quot; aber wo gleichzeitig eben das Panel mitbewegt wird und nicht nur ein anderer Mauszeiger angezeigt wird.</p>
<pre><code class="language-cpp">TForm1 *Form1;
int lastx, lasty;
bool b_move = false;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)     : TForm(Owner){}
//---------------------------------------------------------------------------
void __fastcall TForm1::Panel2MouseDown(TObject *Sender,
      TMouseButton Button, TShiftState Shift, int X, int Y)
{
        b_move = true;
        lastx = X;
        lasty = Y;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Panel2MouseUp(TObject *Sender, TMouseButton Button,
      TShiftState Shift, int X, int Y)
{
        b_move = false;
        this-&gt;DockDrop()
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Panel2MouseMove(TObject *Sender, TShiftState Shift,
      int X, int Y)
{
        if ( b_move == true )
        {
          Panel2-&gt;Left = Panel2-&gt;Left + X - lastx;
          Panel2-&gt;Top = Panel2-&gt;Top + Y - lasty;
        }
}
//---------------------------------------------------------------------------
</code></pre>
<p>Danke im Voraus<br />
teaseMe</p>
]]></description><link>https://www.c-plusplus.net/forum/post/930576</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/930576</guid><dc:creator><![CDATA[teaseMe]]></dc:creator><pubDate>Wed, 30 Nov 2005 13:35:40 GMT</pubDate></item></channel></rss>