<?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[2 Textzeilen in StringGrid-Zelle]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich habe folgendes Problem: Ich muß in einem StringGrid in jeder Zelle zwei Zahlen ausgeben. Diese sollen untereinander stehen.</p>
<p>Da StringGrid aber kein WordWarp unterstützt habe ich versucht den Text wie folgt auszugeben:</p>
<pre><code>void __fastcall TAusgabe::StringGridMatrixDrawCell(TObject *Sender,
      int ACol, int ARow, TRect &amp;Rect, TGridDrawState State)
{
   AnsiString Textcav;
   AnsiString Textcah;

   if(ARow &amp;&amp; ACol)    // erste Zeile und erste Spalte sollen frei bleiben
   {
      Textcav = FloatToStrF(Matrix[ARow - 1][ACol - 1].cav, (TFloatFormat)0, 7, 7);
      Textcah = FloatToStrF(Matrix[ARow - 1][ACol - 1].cah, (TFloatFormat)0, 7, 7);

      StringGridMatrix-&gt;Canvas-&gt;TextRect(
               Rect,
               Rect.Right - StringGridMatrix-&gt;Canvas-&gt;TextWidth(Textcav) - 5,
               Rect.Top + (((Rect.Bottom - Rect.Top) / 2) - StringGridMatrix-&gt;Canvas-&gt;TextHeight(Textcav)) / 2,
               Textcav);

      StringGridMatrix-&gt;Canvas-&gt;TextRect(
               Rect,
               Rect.Right - StringGridMatrix-&gt;Canvas-&gt;TextWidth(Textcah) - 5,
               Rect.Top + ((Rect.Bottom - Rect.Top) / 2) + (((Rect.Bottom - Rect.Top) / 2) - StringGridMatrix-&gt;Canvas-&gt;TextHeight(Textcah)) / 2,
               Textcah);

   }

}
</code></pre>
<p>Die Werte sind in einem 2 dimensionalen DynamicArray abgelegt, das aus einer Stuct aufgebaut ist.</p>
<p>Das Problem ist nun, dass der zweite Aufruf von TextRect die Ausgabe des ersten Aufrufs verdeckt oder löscht.<br />
Wie kann ich das Problem lösen, oder kann ich die Ausgabe anders realisieren?</p>
<p>Vielen Dank<br />
chris_f</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/81792/2-textzeilen-in-stringgrid-zelle</link><generator>RSS for Node</generator><lastBuildDate>Wed, 01 Jul 2026 00:32:30 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/81792.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 04 Aug 2004 10:56:27 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to 2 Textzeilen in StringGrid-Zelle on Wed, 04 Aug 2004 10:56:27 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich habe folgendes Problem: Ich muß in einem StringGrid in jeder Zelle zwei Zahlen ausgeben. Diese sollen untereinander stehen.</p>
<p>Da StringGrid aber kein WordWarp unterstützt habe ich versucht den Text wie folgt auszugeben:</p>
<pre><code>void __fastcall TAusgabe::StringGridMatrixDrawCell(TObject *Sender,
      int ACol, int ARow, TRect &amp;Rect, TGridDrawState State)
{
   AnsiString Textcav;
   AnsiString Textcah;

   if(ARow &amp;&amp; ACol)    // erste Zeile und erste Spalte sollen frei bleiben
   {
      Textcav = FloatToStrF(Matrix[ARow - 1][ACol - 1].cav, (TFloatFormat)0, 7, 7);
      Textcah = FloatToStrF(Matrix[ARow - 1][ACol - 1].cah, (TFloatFormat)0, 7, 7);

      StringGridMatrix-&gt;Canvas-&gt;TextRect(
               Rect,
               Rect.Right - StringGridMatrix-&gt;Canvas-&gt;TextWidth(Textcav) - 5,
               Rect.Top + (((Rect.Bottom - Rect.Top) / 2) - StringGridMatrix-&gt;Canvas-&gt;TextHeight(Textcav)) / 2,
               Textcav);

      StringGridMatrix-&gt;Canvas-&gt;TextRect(
               Rect,
               Rect.Right - StringGridMatrix-&gt;Canvas-&gt;TextWidth(Textcah) - 5,
               Rect.Top + ((Rect.Bottom - Rect.Top) / 2) + (((Rect.Bottom - Rect.Top) / 2) - StringGridMatrix-&gt;Canvas-&gt;TextHeight(Textcah)) / 2,
               Textcah);

   }

}
</code></pre>
<p>Die Werte sind in einem 2 dimensionalen DynamicArray abgelegt, das aus einer Stuct aufgebaut ist.</p>
<p>Das Problem ist nun, dass der zweite Aufruf von TextRect die Ausgabe des ersten Aufrufs verdeckt oder löscht.<br />
Wie kann ich das Problem lösen, oder kann ich die Ausgabe anders realisieren?</p>
<p>Vielen Dank<br />
chris_f</p>
]]></description><link>https://www.c-plusplus.net/forum/post/575014</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/575014</guid><dc:creator><![CDATA[chris_f]]></dc:creator><pubDate>Wed, 04 Aug 2004 10:56:27 GMT</pubDate></item><item><title><![CDATA[Reply to 2 Textzeilen in StringGrid-Zelle on Wed, 04 Aug 2004 11:16:18 GMT]]></title><description><![CDATA[<p>Verwende TextOut() an Stelle von TextRect(), dann klappt's auch mit'm Nachbarn. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/575026</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/575026</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Wed, 04 Aug 2004 11:16:18 GMT</pubDate></item><item><title><![CDATA[Reply to 2 Textzeilen in StringGrid-Zelle on Wed, 04 Aug 2004 11:26:50 GMT]]></title><description><![CDATA[<p>Tatsache... dann hat man den Durchblick. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
<p>Danke.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/575041</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/575041</guid><dc:creator><![CDATA[chris_f]]></dc:creator><pubDate>Wed, 04 Aug 2004 11:26:50 GMT</pubDate></item></channel></rss>