<?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[DBCheckBox oder Bitmap im DBGrid für wahr&#x2F;falsch]]></title><description><![CDATA[<p>Hallo,</p>
<p>habe letztens mal herumexperimentiert, um eine dbcheckbox in einem dbgrid zu bekommen, anstelle des &quot;wahr/falsch&quot;. leider klappt es irgendwie nicht vernünftig.</p>
<p>hier mein code beispiel:</p>
<pre><code class="language-cpp">void __fastcall TfrmVerwaltung::dbMitgliederDrawColumnCell(TObject *Sender,
      const TRect &amp;Rect, int DataCol, TColumn *Column,
      TGridDrawState State)
{
    TColor BackColor,FontColor;
    TDBGrid* dbg=dynamic_cast&lt;TDBGrid *&gt;(Sender);
    try
    {
        //nur zum einfärben der Checkbox spalten
        if(Column-&gt;Field-&gt;DataType == ftBoolean)
        {
            BackColor = StringToColor(IntToStr(0x00f8f8f8));
            FontColor = StringToColor(IntToStr(0x00000000));
            dbMitglieder-&gt;Canvas-&gt;Brush-&gt;Color = BackColor;
            dbMitglieder-&gt;Canvas-&gt;Font-&gt;Color = FontColor;
        }
        dbMitglieder-&gt;DefaultDrawColumnCell(Rect,DataCol,Column,State);

        if(DataCol == SortColumn &amp;&amp; SameColumn == 1)
        {
            dbg-&gt;Canvas-&gt;Draw(Rect.right - bmpSortUp-&gt;Width - 2 , 5 , bmpSortUp);
        }
        else if(DataCol == SortColumn &amp;&amp; SameColumn == 0)
        {
            dbg-&gt;Canvas-&gt;Draw(Rect.right - bmpSortUp-&gt;Width - 2 , 5 , bmpSortDown);
        }
        if(Column-&gt;Field-&gt;DataType == ftBoolean &amp;&amp; tblMitglieder-&gt;RecordCount != 0)
        {
            dbcmbMitglieder-&gt;DataField = Column-&gt;Field-&gt;FieldName;
            UINT Checked = (Column-&gt;Field-&gt;AsBoolean &amp;&amp; !Column-&gt;Field-&gt;IsNull ?  DFCS_BUTTONCHECK | DFCS_CHECKED : DFCS_BUTTONCHECK);
            TRect DrawRect;
            if (State.Contains(gdFocused))
            {
                if (Column-&gt;Field-&gt;FieldName == dbcmbMitglieder-&gt;DataField)
                {
                    dbcmbMitglieder-&gt;Left = Rect.Left + dbg-&gt;Left + 2;
                    dbcmbMitglieder-&gt;Top = Rect.Top + dbg-&gt;Top + 2;
                    dbcmbMitglieder-&gt;Width = Rect.Right - Rect.Left;
                    dbcmbMitglieder-&gt;Height = Rect.Bottom - Rect.Top;
                    dbcmbMitglieder-&gt;Visible = True;
                }
            }
            else
            {
                if (Column-&gt;Field-&gt;FieldName == dbcmbMitglieder-&gt;DataField)
                {

                    DrawRect=Rect;
                    InflateRect(&amp;DrawRect,-1,-1);
                    dbg-&gt;Canvas-&gt;FillRect(Rect);
                    DrawFrameControl(dbg-&gt;Canvas-&gt;Handle, &amp;DrawRect, DFC_BUTTON, Checked);
                }
            }
        }
    }
    catch(...)
    {}
}
</code></pre>
<p>diese beispiel klappt leider nicht immer. irgendwie bleibt er an dieser stelle hängen, nur warum ist mir ein rätsel:</p>
<pre><code class="language-cpp">if(Column-&gt;Field-&gt;DataType == ftBoolean)
</code></pre>
<p>mir würde es völlig ausreichen, wenn ich zwei bitmaps anstelle der wahr/falsch werte bekommen könnte. die methode fände ich auch wesentlich besser, weil sie mir gleich das zeichnen in gewissen zellen aufzeigen kann.</p>
<p>könnte mir jemand ein solches beispiel (bitmaps, je nach true/false wert) zeigen? und auch so, dass es völlig egal ist, wieviele boolean spalten angezeigt werden? das umschalten von wahr/falsch bekomme ich selber leicht hin, dazu brauche ich nicht unbedingt die checkboxfunktionalität. mir geht es in erster linie um das aussehen.</p>
<p>danke im voraus!</p>
<p>gruß gerd</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/119220/dbcheckbox-oder-bitmap-im-dbgrid-für-wahr-falsch</link><generator>RSS for Node</generator><lastBuildDate>Sat, 25 Jul 2026 04:10:19 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/119220.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 29 Aug 2005 16:51:02 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to DBCheckBox oder Bitmap im DBGrid für wahr&#x2F;falsch on Mon, 29 Aug 2005 16:51:02 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>habe letztens mal herumexperimentiert, um eine dbcheckbox in einem dbgrid zu bekommen, anstelle des &quot;wahr/falsch&quot;. leider klappt es irgendwie nicht vernünftig.</p>
<p>hier mein code beispiel:</p>
<pre><code class="language-cpp">void __fastcall TfrmVerwaltung::dbMitgliederDrawColumnCell(TObject *Sender,
      const TRect &amp;Rect, int DataCol, TColumn *Column,
      TGridDrawState State)
{
    TColor BackColor,FontColor;
    TDBGrid* dbg=dynamic_cast&lt;TDBGrid *&gt;(Sender);
    try
    {
        //nur zum einfärben der Checkbox spalten
        if(Column-&gt;Field-&gt;DataType == ftBoolean)
        {
            BackColor = StringToColor(IntToStr(0x00f8f8f8));
            FontColor = StringToColor(IntToStr(0x00000000));
            dbMitglieder-&gt;Canvas-&gt;Brush-&gt;Color = BackColor;
            dbMitglieder-&gt;Canvas-&gt;Font-&gt;Color = FontColor;
        }
        dbMitglieder-&gt;DefaultDrawColumnCell(Rect,DataCol,Column,State);

        if(DataCol == SortColumn &amp;&amp; SameColumn == 1)
        {
            dbg-&gt;Canvas-&gt;Draw(Rect.right - bmpSortUp-&gt;Width - 2 , 5 , bmpSortUp);
        }
        else if(DataCol == SortColumn &amp;&amp; SameColumn == 0)
        {
            dbg-&gt;Canvas-&gt;Draw(Rect.right - bmpSortUp-&gt;Width - 2 , 5 , bmpSortDown);
        }
        if(Column-&gt;Field-&gt;DataType == ftBoolean &amp;&amp; tblMitglieder-&gt;RecordCount != 0)
        {
            dbcmbMitglieder-&gt;DataField = Column-&gt;Field-&gt;FieldName;
            UINT Checked = (Column-&gt;Field-&gt;AsBoolean &amp;&amp; !Column-&gt;Field-&gt;IsNull ?  DFCS_BUTTONCHECK | DFCS_CHECKED : DFCS_BUTTONCHECK);
            TRect DrawRect;
            if (State.Contains(gdFocused))
            {
                if (Column-&gt;Field-&gt;FieldName == dbcmbMitglieder-&gt;DataField)
                {
                    dbcmbMitglieder-&gt;Left = Rect.Left + dbg-&gt;Left + 2;
                    dbcmbMitglieder-&gt;Top = Rect.Top + dbg-&gt;Top + 2;
                    dbcmbMitglieder-&gt;Width = Rect.Right - Rect.Left;
                    dbcmbMitglieder-&gt;Height = Rect.Bottom - Rect.Top;
                    dbcmbMitglieder-&gt;Visible = True;
                }
            }
            else
            {
                if (Column-&gt;Field-&gt;FieldName == dbcmbMitglieder-&gt;DataField)
                {

                    DrawRect=Rect;
                    InflateRect(&amp;DrawRect,-1,-1);
                    dbg-&gt;Canvas-&gt;FillRect(Rect);
                    DrawFrameControl(dbg-&gt;Canvas-&gt;Handle, &amp;DrawRect, DFC_BUTTON, Checked);
                }
            }
        }
    }
    catch(...)
    {}
}
</code></pre>
<p>diese beispiel klappt leider nicht immer. irgendwie bleibt er an dieser stelle hängen, nur warum ist mir ein rätsel:</p>
<pre><code class="language-cpp">if(Column-&gt;Field-&gt;DataType == ftBoolean)
</code></pre>
<p>mir würde es völlig ausreichen, wenn ich zwei bitmaps anstelle der wahr/falsch werte bekommen könnte. die methode fände ich auch wesentlich besser, weil sie mir gleich das zeichnen in gewissen zellen aufzeigen kann.</p>
<p>könnte mir jemand ein solches beispiel (bitmaps, je nach true/false wert) zeigen? und auch so, dass es völlig egal ist, wieviele boolean spalten angezeigt werden? das umschalten von wahr/falsch bekomme ich selber leicht hin, dazu brauche ich nicht unbedingt die checkboxfunktionalität. mir geht es in erster linie um das aussehen.</p>
<p>danke im voraus!</p>
<p>gruß gerd</p>
]]></description><link>https://www.c-plusplus.net/forum/post/860819</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/860819</guid><dc:creator><![CDATA[gerd01]]></dc:creator><pubDate>Mon, 29 Aug 2005 16:51:02 GMT</pubDate></item><item><title><![CDATA[Reply to DBCheckBox oder Bitmap im DBGrid für wahr&#x2F;falsch on Mon, 29 Aug 2005 22:34:34 GMT]]></title><description><![CDATA[<p>Hallo Leute,</p>
<p>brauche keine Hilfe mehr, habe alle Fehler selber lokalisiert. Ebenfalls habe ich es hinbekommen eine Grafik als Anzeige für Wahr/Falsch einträge anzuzeigen.</p>
<p>Gruß Gerd</p>
]]></description><link>https://www.c-plusplus.net/forum/post/861004</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/861004</guid><dc:creator><![CDATA[gerd01]]></dc:creator><pubDate>Mon, 29 Aug 2005 22:34:34 GMT</pubDate></item><item><title><![CDATA[Reply to DBCheckBox oder Bitmap im DBGrid für wahr&#x2F;falsch on Tue, 30 Aug 2005 11:33:26 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">BackColor = StringToColor(IntToStr(0x00f8f8f8)); 
FontColor = StringToColor(IntToStr(0x00000000));
</code></pre>
<p>args, davon bekommt man ja augenkrebs! ineffizienter gehts glaub ich kaum noch!</p>
<pre><code class="language-cpp">BackColor = (TColor) 0x00f8f8f8;
FontColor = (TColor) 0x00000000;  // entspr.: FontColor = clBlack;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/861296</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/861296</guid><dc:creator><![CDATA[Sunday]]></dc:creator><pubDate>Tue, 30 Aug 2005 11:33:26 GMT</pubDate></item><item><title><![CDATA[Reply to DBCheckBox oder Bitmap im DBGrid für wahr&#x2F;falsch on Tue, 30 Aug 2005 12:09:02 GMT]]></title><description><![CDATA[<p>ich weiss, dass es so klappt, aber die warnings regen mich auf. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":-)"
      alt="🙂"
    /></p>
<p>gruß gerd</p>
]]></description><link>https://www.c-plusplus.net/forum/post/861322</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/861322</guid><dc:creator><![CDATA[gerd01-off]]></dc:creator><pubDate>Tue, 30 Aug 2005 12:09:02 GMT</pubDate></item><item><title><![CDATA[Reply to DBCheckBox oder Bitmap im DBGrid für wahr&#x2F;falsch on Tue, 30 Aug 2005 12:50:16 GMT]]></title><description><![CDATA[<p>da kommt kein warning!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/861362</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/861362</guid><dc:creator><![CDATA[Sunday]]></dc:creator><pubDate>Tue, 30 Aug 2005 12:50:16 GMT</pubDate></item><item><title><![CDATA[Reply to DBCheckBox oder Bitmap im DBGrid für wahr&#x2F;falsch on Tue, 30 Aug 2005 13:59:08 GMT]]></title><description><![CDATA[<p>etwas C++ konformer</p>
<pre><code class="language-cpp">BackColor = static_cast&lt;TColor&gt;(0x00f8f8f8);
FontColor = static_cast&lt;TColor&gt;(0x00000000);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/861452</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/861452</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Tue, 30 Aug 2005 13:59:08 GMT</pubDate></item><item><title><![CDATA[Reply to DBCheckBox oder Bitmap im DBGrid für wahr&#x2F;falsch on Tue, 30 Aug 2005 19:48:47 GMT]]></title><description><![CDATA[<p>gerd01 schrieb:</p>
<blockquote>
<p>brauche keine Hilfe mehr, habe alle Fehler selber lokalisiert. Ebenfalls habe ich es hinbekommen eine Grafik als Anzeige für Wahr/Falsch einträge anzuzeigen.</p>
</blockquote>
<p>Es gehört zum guten Ton, auch selbstgefundene und/oder triviale Lösungen mitzuteilen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/861663</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/861663</guid><dc:creator><![CDATA[Jansen]]></dc:creator><pubDate>Tue, 30 Aug 2005 19:48:47 GMT</pubDate></item></channel></rss>