<?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[Aufruf der Pfeil - Funktion: Problem mit Canvas]]></title><description><![CDATA[<p>Hi,</p>
<p>ich hab folgendes Problem,<br />
die Funktion, die einen Pfeil darstellen lässt, bringt beim Aufrufen zwei Fehlermeldungen:</p>
<pre><code>[C++ Fehler] Bitausgabe.cpp(111): E2034 Konvertierung von 'TCanvas *' nach 'TCanvas' nicht möglich

und 

[C++ Fehler] Bitausgabe.cpp(111): E2340 Keine Übereinstimmung des Typs beim Parameter 1 ('TCanvas' erwartet, 'TCanvas *' erhalten)
</code></pre>
<pre><code>void ZeichnePfeil(TCanvas, TColor Col, byte sLange, byte Beta, bool Filled, TPoint P1, TPoint P2)
{
        TPoint Punkte[2];              // Array für die Punkte der Pfeilspitze
        int Alpha, AlphaZ;             // Winkel zur horizontalen Achse durch P1

        //Farben einstellen
        Form2-&gt;Canvas-&gt;Brush-&gt;Color = Col;
        Form2-&gt;Canvas-&gt;Pen-&gt;Color = Col;

  //Linie zeichnen
  Form2-&gt;Canvas-&gt;Pen-&gt;Style = psSolid;
  Form2-&gt;Canvas-&gt;MoveTo(P1.x,P1.y);
  Form2-&gt;Canvas-&gt;LineTo(P2.x,P2.y);

  //Pfeilspitze (1.Punkt)
  Punkte[0].x = P2.x;
  Punkte[0].y = P2.y;

  //Winkel ermitteln

  Alpha = 0;
  if(P2.x == P1.x) AlphaZ = 0;
  else            AlphaZ = GetRAD(atan_d((P2.y - P1.y) / (P2.x - P1.x)));

  if((P2.x &gt; P1.x) &amp;&amp; (P2.y == P1.y)) Alpha = 0;
  else if((P2.x &gt; P1.x) &amp;&amp; (P2.y &lt; P1.y))  Alpha = 0 - AlphaZ;
  else if((P2.x == P1.x) &amp;&amp;(P2.y &lt; P1.y))  Alpha = 90;
  else if((P2.x &lt; P1.x) &amp;&amp; (P2.y &lt; P1.y))  Alpha = 180 - AlphaZ;
  else if((P2.x &lt; P1.x) &amp;&amp; (P2.y == P1.y))  Alpha = 180;
  else if((P2.x &lt; P1.x) &amp;&amp; (P2.y &gt; P1.y))  Alpha = 180 - AlphaZ;
  else if((P2.x == P1.x) &amp;&amp; (P2.y &gt; P1.y))  Alpha = 270;
  else if((P2.x &gt; P1.x) &amp;&amp; (P2.y &gt; P1.y))  Alpha = 360 - AlphaZ;

  //2.Punkt
  Punkte[1].x = (P2.x - sLange * cos(GetDEG(Alpha - Beta / 2)));
  Punkte[1].y = (P2.y + sLange * sin(GetDEG(Alpha - Beta / 2)));

  //3.Punkt
  Punkte[2].x = (P2.x - sLange * cos(GetDEG(Alpha + Beta / 2)));
  Punkte[2].y = (P2.y + sLange * sin(GetDEG(Alpha + Beta / 2)));

  //Pfeil zeichnen
  if(Filled)  Form2-&gt;Canvas-&gt;Polygon(Punkte,3);
  else
  {
    Form2-&gt;Canvas-&gt;MoveTo(Punkte[0].x, Punkte[0].y);
    Form2-&gt;Canvas-&gt;LineTo(Punkte[1].x, Punkte[1].y);
    Form2-&gt;Canvas-&gt;MoveTo(Punkte[0].x, Punkte[0].y);
    Form2-&gt;Canvas-&gt;LineTo(Punkte[2].x, Punkte[2].y);
  }
}
</code></pre>
<p>Funktion, die ich aufrufe:</p>
<pre><code>void __fastcall TForm2::Button1Click(TObject *Sender)
{
        ZeichnePfeil(Image1-&gt;Canvas,clBlue,10,50,FALSE,Point(50,50),Point(100,100));
        ZeichnePfeil(Image1-&gt;Canvas,clRed,10,50,TRUE,Point(50,50),Point(100,20));
}
//---------------------------------------------------------------------------
</code></pre>
<p>wie muss ich denn meine Funktion ZeichnePfeil aufrufen?<br />
der compiler meckert ja bei Image1-&gt;Canvas..</p>
<p>Vielen Dank!<br />
Max</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/129615/aufruf-der-pfeil-funktion-problem-mit-canvas</link><generator>RSS for Node</generator><lastBuildDate>Wed, 29 Jul 2026 18:26:33 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/129615.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 14 Dec 2005 22:44:11 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Aufruf der Pfeil - Funktion: Problem mit Canvas on Wed, 14 Dec 2005 22:44:11 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>ich hab folgendes Problem,<br />
die Funktion, die einen Pfeil darstellen lässt, bringt beim Aufrufen zwei Fehlermeldungen:</p>
<pre><code>[C++ Fehler] Bitausgabe.cpp(111): E2034 Konvertierung von 'TCanvas *' nach 'TCanvas' nicht möglich

und 

[C++ Fehler] Bitausgabe.cpp(111): E2340 Keine Übereinstimmung des Typs beim Parameter 1 ('TCanvas' erwartet, 'TCanvas *' erhalten)
</code></pre>
<pre><code>void ZeichnePfeil(TCanvas, TColor Col, byte sLange, byte Beta, bool Filled, TPoint P1, TPoint P2)
{
        TPoint Punkte[2];              // Array für die Punkte der Pfeilspitze
        int Alpha, AlphaZ;             // Winkel zur horizontalen Achse durch P1

        //Farben einstellen
        Form2-&gt;Canvas-&gt;Brush-&gt;Color = Col;
        Form2-&gt;Canvas-&gt;Pen-&gt;Color = Col;

  //Linie zeichnen
  Form2-&gt;Canvas-&gt;Pen-&gt;Style = psSolid;
  Form2-&gt;Canvas-&gt;MoveTo(P1.x,P1.y);
  Form2-&gt;Canvas-&gt;LineTo(P2.x,P2.y);

  //Pfeilspitze (1.Punkt)
  Punkte[0].x = P2.x;
  Punkte[0].y = P2.y;

  //Winkel ermitteln

  Alpha = 0;
  if(P2.x == P1.x) AlphaZ = 0;
  else            AlphaZ = GetRAD(atan_d((P2.y - P1.y) / (P2.x - P1.x)));

  if((P2.x &gt; P1.x) &amp;&amp; (P2.y == P1.y)) Alpha = 0;
  else if((P2.x &gt; P1.x) &amp;&amp; (P2.y &lt; P1.y))  Alpha = 0 - AlphaZ;
  else if((P2.x == P1.x) &amp;&amp;(P2.y &lt; P1.y))  Alpha = 90;
  else if((P2.x &lt; P1.x) &amp;&amp; (P2.y &lt; P1.y))  Alpha = 180 - AlphaZ;
  else if((P2.x &lt; P1.x) &amp;&amp; (P2.y == P1.y))  Alpha = 180;
  else if((P2.x &lt; P1.x) &amp;&amp; (P2.y &gt; P1.y))  Alpha = 180 - AlphaZ;
  else if((P2.x == P1.x) &amp;&amp; (P2.y &gt; P1.y))  Alpha = 270;
  else if((P2.x &gt; P1.x) &amp;&amp; (P2.y &gt; P1.y))  Alpha = 360 - AlphaZ;

  //2.Punkt
  Punkte[1].x = (P2.x - sLange * cos(GetDEG(Alpha - Beta / 2)));
  Punkte[1].y = (P2.y + sLange * sin(GetDEG(Alpha - Beta / 2)));

  //3.Punkt
  Punkte[2].x = (P2.x - sLange * cos(GetDEG(Alpha + Beta / 2)));
  Punkte[2].y = (P2.y + sLange * sin(GetDEG(Alpha + Beta / 2)));

  //Pfeil zeichnen
  if(Filled)  Form2-&gt;Canvas-&gt;Polygon(Punkte,3);
  else
  {
    Form2-&gt;Canvas-&gt;MoveTo(Punkte[0].x, Punkte[0].y);
    Form2-&gt;Canvas-&gt;LineTo(Punkte[1].x, Punkte[1].y);
    Form2-&gt;Canvas-&gt;MoveTo(Punkte[0].x, Punkte[0].y);
    Form2-&gt;Canvas-&gt;LineTo(Punkte[2].x, Punkte[2].y);
  }
}
</code></pre>
<p>Funktion, die ich aufrufe:</p>
<pre><code>void __fastcall TForm2::Button1Click(TObject *Sender)
{
        ZeichnePfeil(Image1-&gt;Canvas,clBlue,10,50,FALSE,Point(50,50),Point(100,100));
        ZeichnePfeil(Image1-&gt;Canvas,clRed,10,50,TRUE,Point(50,50),Point(100,20));
}
//---------------------------------------------------------------------------
</code></pre>
<p>wie muss ich denn meine Funktion ZeichnePfeil aufrufen?<br />
der compiler meckert ja bei Image1-&gt;Canvas..</p>
<p>Vielen Dank!<br />
Max</p>
]]></description><link>https://www.c-plusplus.net/forum/post/942467</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/942467</guid><dc:creator><![CDATA[Max__]]></dc:creator><pubDate>Wed, 14 Dec 2005 22:44:11 GMT</pubDate></item><item><title><![CDATA[Reply to Aufruf der Pfeil - Funktion: Problem mit Canvas on Wed, 14 Dec 2005 22:51:14 GMT]]></title><description><![CDATA[<p>void ZeichnePfeil(**TCanvas ***, ...)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/942474</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/942474</guid><dc:creator><![CDATA[Jansen]]></dc:creator><pubDate>Wed, 14 Dec 2005 22:51:14 GMT</pubDate></item><item><title><![CDATA[Reply to Aufruf der Pfeil - Funktion: Problem mit Canvas on Wed, 14 Dec 2005 22:51:33 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>du must den Parameter Canvas als Pointer definieren</p>
<pre><code class="language-cpp">void ZeichnePfeil(TCanvas *,
</code></pre>
<p>wobei ich mich frage, warum du den Parameter überhaupt brauchst, wenn du den gar nicht verwendest?</p>
<p>Desweitern würde ich diese Funktion als Member von Form2 deklarieren, damit du in der Funktion alle Verweise auf Form2 entfernen kannst.</p>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/942475</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/942475</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Wed, 14 Dec 2005 22:51:33 GMT</pubDate></item><item><title><![CDATA[Reply to Aufruf der Pfeil - Funktion: Problem mit Canvas on Thu, 15 Dec 2005 08:41:58 GMT]]></title><description><![CDATA[<p>akari schrieb:</p>
<blockquote>
<p>Desweitern würde ich diese Funktion als Member von Form2 deklarieren, damit du in der Funktion alle Verweise auf Form2 entfernen kannst.</p>
</blockquote>
<p>Oder aber den Parameter korrigieren und dann auch über diesen zeichnen. Das sieht mir eher nach der beabsichtigten Wirkung aus.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/942589</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/942589</guid><dc:creator><![CDATA[Dasd]]></dc:creator><pubDate>Thu, 15 Dec 2005 08:41:58 GMT</pubDate></item><item><title><![CDATA[Reply to Aufruf der Pfeil - Funktion: Problem mit Canvas on Thu, 15 Dec 2005 11:25:23 GMT]]></title><description><![CDATA[<p>danke für eure Antworten,</p>
<p>das ist mir im wesentlichen auch klar, hab es ja mit dem Zeiger bei TCanvas probiert, aber dann geht es ja auch net, dann erfolgt im wesentlichen die gleiche Fehlermeldung, hab ein bisschen rum gespielt, aber das hat alles nicht geklappt..</p>
<p>kennt jemand noch andre möglichkeiten pfeile zu zeichnen ??</p>
]]></description><link>https://www.c-plusplus.net/forum/post/942732</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/942732</guid><dc:creator><![CDATA[Maxl]]></dc:creator><pubDate>Thu, 15 Dec 2005 11:25:23 GMT</pubDate></item><item><title><![CDATA[Reply to Aufruf der Pfeil - Funktion: Problem mit Canvas on Thu, 15 Dec 2005 12:46:40 GMT]]></title><description><![CDATA[<p>im wesentlichen die gleiche fehlermeldung ist etwas anderes als die gleiche fehlermeldung! zeig doch mal deinen erfolglosen versuch.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/942806</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/942806</guid><dc:creator><![CDATA[Sunday]]></dc:creator><pubDate>Thu, 15 Dec 2005 12:46:40 GMT</pubDate></item></channel></rss>