<?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[Punkte in Grafik ansprechen]]></title><description><![CDATA[<p>Hi zusammen,</p>
<p>habe mir eine PaintBox (Zeichenbox) erstellt und darauf quasi ein DrawingBoard (Bittmap) gezeichtnet...!!!</p>
<p>Graphics::TBitmap *DrawingBoard;</p>
<p>Jetzt zeichne ich mittels canvas ein KoordinatenSystem:</p>
<pre><code class="language-cpp">void __fastcall TForm1::Zeichnen()
{
   //Für Paintbox
   //werteArray.clear();

    DrawingBoard = new Graphics::TBitmap;
   DrawingBoard-&gt;Width = this-&gt;Zeichenbox-&gt;Width;
   DrawingBoard-&gt;Height = this-&gt;Zeichenbox-&gt;Height;

   //Setzt Koordinatenkreuz
   DrawingBoard-&gt;Canvas-&gt;MoveTo(30,30);
   DrawingBoard-&gt;Canvas-&gt;LineTo(30,Zeichenbox-&gt;Height-30);
   DrawingBoard-&gt;Canvas-&gt;MoveTo(30,Zeichenbox-&gt;Height-30);
   DrawingBoard-&gt;Canvas-&gt;LineTo(Zeichenbox-&gt;Width-30,Zeichenbox-&gt;Height-30);

   //Setzt Merker
   int x=30;
   int y=30;
   int zaehlen = 0;
   for(y = Zeichenbox-&gt;Height-30; y&gt;30; y-=30){
      DrawingBoard-&gt;Canvas-&gt;MoveTo(x-5,y);
      DrawingBoard-&gt;Canvas-&gt;LineTo(x+5,y);
            DrawingBoard-&gt;Canvas-&gt;TextOutA(x-25,y-5,zaehlen);
       zaehlen+=30;

   }

   x=30;
   y= Zeichenbox-&gt;Height-30;
   zaehlen=0;

   for(x = 30; x&lt;Zeichenbox-&gt;Width-30;x+=30){
      DrawingBoard-&gt;Canvas-&gt;MoveTo(x,y-5);
      DrawingBoard-&gt;Canvas-&gt;LineTo(x,y+5);
      if(skalierung == &quot;zehn&quot;){
       DrawingBoard-&gt;Canvas-&gt;TextOutA(x-5,y+5,zaehlen);
       zaehlen+=30;
      }
      if(skalierung == &quot;eins&quot;){
       DrawingBoard-&gt;Canvas-&gt;TextOutA(x-5,y+5,zaehlen);
       zaehlen+=3;
      }
   }

   DrawingBoard-&gt;Canvas-&gt;MoveTo(30,Zeichenbox-&gt;Height-30);
 }
</code></pre>
<p>Dann wird mittels der &quot;OnPaint&quot; der Paintbox das Board gezeichnet:</p>
<pre><code class="language-cpp">void __fastcall TForm1::PaintBoxPaint(TObject *Sender)
{
 Zeichenbox-&gt;Canvas-&gt;Draw(0, 0, DrawingBoard);
}
</code></pre>
<p>Jetzt kann man per Mausklick kleine Vierecke auf das Bitmap zeichnen mit der koordinantenanzeige:</p>
<pre><code class="language-cpp">void __fastcall TForm1::PaintBoxMousUp(TObject *Sender,
      TMouseButton Button, TShiftState Shift, int X, int Y)
{
         int x;
         int y;
         if(Skalierung1-&gt;Checked==true){
         x = (X-30)/10;
         y =((Zeichenbox-&gt;Height-30)-Y)/10;
         }else{
         x = X-30;
         y =(Zeichenbox-&gt;Height-30)-Y;
         }

        Zeichenbox-&gt;Canvas-&gt;Rectangle(X-3,Y+3,X+3,Y-3);
        String posx = x;
        String posy = y;
        String position = posx+&quot; - &quot;+posy;
        int arrayLange = sizeof(werteArray)+1;
        werteArray[arrayLange] =position;
        Zeichenbox-&gt;Canvas-&gt;TextOutA(X-5,Y+5,position);
        //Zeichenwerte-&gt;Items-&gt;Add(position);

}
</code></pre>
<p>das funktioniert auch wunderbar!!!</p>
<p>Jetzt habe ich das Problem, dass ich gerne die kleinen Vierecke, welche mit der Maus gezeichnet wurden, wieder ansprechen möchte und halt dann verschieben!!!!</p>
<p>Die Frage ist nur, die sind ja auf das Bitmap gezeichnet!!!</p>
<p>Habe ich da überhaupt eine CHance oder muss ich das anderst anpacken!!</p>
<p>Bitte um Hilfe, Beispielcode, Ansatzlösung,Ideen, etc.!!</p>
<p>Vielen Dank Bench</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/206099/punkte-in-grafik-ansprechen</link><generator>RSS for Node</generator><lastBuildDate>Wed, 19 Aug 2026 23:00:52 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/206099.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 21 Feb 2008 10:30:51 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Punkte in Grafik ansprechen on Thu, 21 Feb 2008 10:30:51 GMT]]></title><description><![CDATA[<p>Hi zusammen,</p>
<p>habe mir eine PaintBox (Zeichenbox) erstellt und darauf quasi ein DrawingBoard (Bittmap) gezeichtnet...!!!</p>
<p>Graphics::TBitmap *DrawingBoard;</p>
<p>Jetzt zeichne ich mittels canvas ein KoordinatenSystem:</p>
<pre><code class="language-cpp">void __fastcall TForm1::Zeichnen()
{
   //Für Paintbox
   //werteArray.clear();

    DrawingBoard = new Graphics::TBitmap;
   DrawingBoard-&gt;Width = this-&gt;Zeichenbox-&gt;Width;
   DrawingBoard-&gt;Height = this-&gt;Zeichenbox-&gt;Height;

   //Setzt Koordinatenkreuz
   DrawingBoard-&gt;Canvas-&gt;MoveTo(30,30);
   DrawingBoard-&gt;Canvas-&gt;LineTo(30,Zeichenbox-&gt;Height-30);
   DrawingBoard-&gt;Canvas-&gt;MoveTo(30,Zeichenbox-&gt;Height-30);
   DrawingBoard-&gt;Canvas-&gt;LineTo(Zeichenbox-&gt;Width-30,Zeichenbox-&gt;Height-30);

   //Setzt Merker
   int x=30;
   int y=30;
   int zaehlen = 0;
   for(y = Zeichenbox-&gt;Height-30; y&gt;30; y-=30){
      DrawingBoard-&gt;Canvas-&gt;MoveTo(x-5,y);
      DrawingBoard-&gt;Canvas-&gt;LineTo(x+5,y);
            DrawingBoard-&gt;Canvas-&gt;TextOutA(x-25,y-5,zaehlen);
       zaehlen+=30;

   }

   x=30;
   y= Zeichenbox-&gt;Height-30;
   zaehlen=0;

   for(x = 30; x&lt;Zeichenbox-&gt;Width-30;x+=30){
      DrawingBoard-&gt;Canvas-&gt;MoveTo(x,y-5);
      DrawingBoard-&gt;Canvas-&gt;LineTo(x,y+5);
      if(skalierung == &quot;zehn&quot;){
       DrawingBoard-&gt;Canvas-&gt;TextOutA(x-5,y+5,zaehlen);
       zaehlen+=30;
      }
      if(skalierung == &quot;eins&quot;){
       DrawingBoard-&gt;Canvas-&gt;TextOutA(x-5,y+5,zaehlen);
       zaehlen+=3;
      }
   }

   DrawingBoard-&gt;Canvas-&gt;MoveTo(30,Zeichenbox-&gt;Height-30);
 }
</code></pre>
<p>Dann wird mittels der &quot;OnPaint&quot; der Paintbox das Board gezeichnet:</p>
<pre><code class="language-cpp">void __fastcall TForm1::PaintBoxPaint(TObject *Sender)
{
 Zeichenbox-&gt;Canvas-&gt;Draw(0, 0, DrawingBoard);
}
</code></pre>
<p>Jetzt kann man per Mausklick kleine Vierecke auf das Bitmap zeichnen mit der koordinantenanzeige:</p>
<pre><code class="language-cpp">void __fastcall TForm1::PaintBoxMousUp(TObject *Sender,
      TMouseButton Button, TShiftState Shift, int X, int Y)
{
         int x;
         int y;
         if(Skalierung1-&gt;Checked==true){
         x = (X-30)/10;
         y =((Zeichenbox-&gt;Height-30)-Y)/10;
         }else{
         x = X-30;
         y =(Zeichenbox-&gt;Height-30)-Y;
         }

        Zeichenbox-&gt;Canvas-&gt;Rectangle(X-3,Y+3,X+3,Y-3);
        String posx = x;
        String posy = y;
        String position = posx+&quot; - &quot;+posy;
        int arrayLange = sizeof(werteArray)+1;
        werteArray[arrayLange] =position;
        Zeichenbox-&gt;Canvas-&gt;TextOutA(X-5,Y+5,position);
        //Zeichenwerte-&gt;Items-&gt;Add(position);

}
</code></pre>
<p>das funktioniert auch wunderbar!!!</p>
<p>Jetzt habe ich das Problem, dass ich gerne die kleinen Vierecke, welche mit der Maus gezeichnet wurden, wieder ansprechen möchte und halt dann verschieben!!!!</p>
<p>Die Frage ist nur, die sind ja auf das Bitmap gezeichnet!!!</p>
<p>Habe ich da überhaupt eine CHance oder muss ich das anderst anpacken!!</p>
<p>Bitte um Hilfe, Beispielcode, Ansatzlösung,Ideen, etc.!!</p>
<p>Vielen Dank Bench</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1460051</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1460051</guid><dc:creator><![CDATA[Bench_XProjects]]></dc:creator><pubDate>Thu, 21 Feb 2008 10:30:51 GMT</pubDate></item><item><title><![CDATA[Reply to Punkte in Grafik ansprechen on Thu, 21 Feb 2008 10:36:25 GMT]]></title><description><![CDATA[<p>Merke dir wo du die Vierecke gezeichnet hast (Koordinaten).<br />
Schau bei Mausklick auf das Image nach ob sich der Cursor in einem Viereck befindet.<br />
Zeichne dein Image mit den veränderten Koordinaten für das Viereck neu.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1460055</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1460055</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Thu, 21 Feb 2008 10:36:25 GMT</pubDate></item><item><title><![CDATA[Reply to Punkte in Grafik ansprechen on Thu, 21 Feb 2008 10:41:55 GMT]]></title><description><![CDATA[<p>Hi!</p>
<p>Ok, erstmal danke!!!!</p>
<p>Die gezeichneten Werte kann ich ja in einem Array abspeichern!!!!Das ist klar!</p>
<p>Wie schau ich dann, ob ich in dem viereck bin????<br />
Über Koordinaten, oder???</p>
<p>Neuzeichnen ist dann auch wieder klar!!!</p>
<p>Danke Bench</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1460063</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1460063</guid><dc:creator><![CDATA[Bench_XProjects]]></dc:creator><pubDate>Thu, 21 Feb 2008 10:41:55 GMT</pubDate></item><item><title><![CDATA[Reply to Punkte in Grafik ansprechen on Thu, 21 Feb 2008 10:46:13 GMT]]></title><description><![CDATA[<p>Bench_XProjects schrieb:</p>
<blockquote>
<p>Wie schau ich dann, ob ich in dem viereck bin????<br />
Über Koordinaten, oder???</p>
</blockquote>
<p>Wenn die Vierecke nicht gekippt sind ja<br />
left &lt; x &lt; right<br />
top &lt; y &lt; bottom</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1460069</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1460069</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Thu, 21 Feb 2008 10:46:13 GMT</pubDate></item><item><title><![CDATA[Reply to Punkte in Grafik ansprechen on Thu, 21 Feb 2008 10:51:54 GMT]]></title><description><![CDATA[<p>nein, die sind nicht gekippt!<br />
Aber ich habe ja nur einen aktuelle Koordinatenpunkt, und um den ist ja im 3-Pixelabstand das Viereck gezeichnet!<br />
Jetzt könnte ich den aktuellen Punkt mit dem Punkt im Array vergleichen!<br />
Aber es ist ziemlich schwierig, genau den gleichen punkt mit der Maus zu treffen!!!</p>
<p>Aber jetzt nochmals:</p>
<p>Wie kann ich den Bereich des Vierecks auslesen?<br />
Kannst du mir vielleicht einen kleinen COde schicken?</p>
<p>Wäre echt super cool!!</p>
<p>Danke Bench</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1460073</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1460073</guid><dc:creator><![CDATA[Bench_XProjects]]></dc:creator><pubDate>Thu, 21 Feb 2008 10:51:54 GMT</pubDate></item><item><title><![CDATA[Reply to Punkte in Grafik ansprechen on Thu, 21 Feb 2008 11:02:32 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>ok jetzt hab ichs!!!</p>
<p>Merk mir einfach alle vier Ecken und dann ...!!!</p>
<p>bench</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1460082</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1460082</guid><dc:creator><![CDATA[Bench_XProjects]]></dc:creator><pubDate>Thu, 21 Feb 2008 11:02:32 GMT</pubDate></item></channel></rss>