<?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[Problem bei Button mit Image]]></title><description><![CDATA[<p>Ich möchte einen Button mit einem Bild haben. Dazu habe ich bis jetzt folgenden Quelltext:</p>
<p>imgButton.cpp:</p>
<pre><code class="language-cpp">//---------------------------------------------------------------------------
#include &lt;vcl\vcl.h&gt;
#pragma hdrstop

#include &quot;imgButton.h&quot;
//---------------------------------------------------------------------------
static inline TimgButton *ValidCtrCheck()
{
	return new TimgButton(NULL);
}
//---------------------------------------------------------------------------
__fastcall TimgButton::TimgButton(TComponent* Owner)
	: TButton(Owner)
{
 buttonImage = new TImage(this);
 buttonImage-&gt;Parent = this;
 buttonImage-&gt;Left = 4;
 buttonImage-&gt;Top = 4;
 buttonImage-&gt;Width = Width-8;
 buttonImage-&gt;Height = Height-8;
}
//---------------------------------------------------------------------------
namespace Imgbutton
{
	void __fastcall Register()
	{
		TComponentClass classes[1] = {__classid(TimgButton)};
		RegisterComponents(&quot;Zusätzlich&quot;, classes, 0);
	}
}
//---------------------------------------------------------------------------
</code></pre>
<p>imgButton.h:</p>
<pre><code class="language-cpp">//---------------------------------------------------------------------------
#ifndef imgButtonH
#define imgButtonH
//---------------------------------------------------------------------------
#include &lt;vcl\SysUtils.hpp&gt;
#include &lt;vcl\Controls.hpp&gt;
#include &lt;vcl\Classes.hpp&gt;
#include &lt;vcl\Forms.hpp&gt;
//---------------------------------------------------------------------------
class TimgButton : public TButton
{
private:
protected:
    TImage *buttonImage;
public:
	__fastcall TimgButton(TComponent* Owner);
__published:
};
//---------------------------------------------------------------------------
#endif
</code></pre>
<p>Das Problem ist nun, dass ich nur am Rand daraufklicken kann, weil ansonsten TImage dadrüber ist.<br />
Außerdem werden die Optionen von TImage nicht angezeigt (wenn ich das ganze als Komponente im Borland c++ Builder installiert hab und in einem Neue Form einfüge)</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/179258/problem-bei-button-mit-image</link><generator>RSS for Node</generator><lastBuildDate>Thu, 09 Jul 2026 15:33:54 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/179258.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 19 Apr 2007 19:45:44 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problem bei Button mit Image on Thu, 19 Apr 2007 19:45:44 GMT]]></title><description><![CDATA[<p>Ich möchte einen Button mit einem Bild haben. Dazu habe ich bis jetzt folgenden Quelltext:</p>
<p>imgButton.cpp:</p>
<pre><code class="language-cpp">//---------------------------------------------------------------------------
#include &lt;vcl\vcl.h&gt;
#pragma hdrstop

#include &quot;imgButton.h&quot;
//---------------------------------------------------------------------------
static inline TimgButton *ValidCtrCheck()
{
	return new TimgButton(NULL);
}
//---------------------------------------------------------------------------
__fastcall TimgButton::TimgButton(TComponent* Owner)
	: TButton(Owner)
{
 buttonImage = new TImage(this);
 buttonImage-&gt;Parent = this;
 buttonImage-&gt;Left = 4;
 buttonImage-&gt;Top = 4;
 buttonImage-&gt;Width = Width-8;
 buttonImage-&gt;Height = Height-8;
}
//---------------------------------------------------------------------------
namespace Imgbutton
{
	void __fastcall Register()
	{
		TComponentClass classes[1] = {__classid(TimgButton)};
		RegisterComponents(&quot;Zusätzlich&quot;, classes, 0);
	}
}
//---------------------------------------------------------------------------
</code></pre>
<p>imgButton.h:</p>
<pre><code class="language-cpp">//---------------------------------------------------------------------------
#ifndef imgButtonH
#define imgButtonH
//---------------------------------------------------------------------------
#include &lt;vcl\SysUtils.hpp&gt;
#include &lt;vcl\Controls.hpp&gt;
#include &lt;vcl\Classes.hpp&gt;
#include &lt;vcl\Forms.hpp&gt;
//---------------------------------------------------------------------------
class TimgButton : public TButton
{
private:
protected:
    TImage *buttonImage;
public:
	__fastcall TimgButton(TComponent* Owner);
__published:
};
//---------------------------------------------------------------------------
#endif
</code></pre>
<p>Das Problem ist nun, dass ich nur am Rand daraufklicken kann, weil ansonsten TImage dadrüber ist.<br />
Außerdem werden die Optionen von TImage nicht angezeigt (wenn ich das ganze als Komponente im Borland c++ Builder installiert hab und in einem Neue Form einfüge)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1269589</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1269589</guid><dc:creator><![CDATA[*gt*Bocky*lt*]]></dc:creator><pubDate>Thu, 19 Apr 2007 19:45:44 GMT</pubDate></item><item><title><![CDATA[Reply to Problem bei Button mit Image on Tue, 24 Apr 2007 13:23:11 GMT]]></title><description><![CDATA[<p>Gibt es bei TImage eine OnClick-Methode?<br />
Wenn ja, wie kann ich in ihr die OnClick-Methode vom Button aufrufen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1272452</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1272452</guid><dc:creator><![CDATA[*gt*Bocky*lt*]]></dc:creator><pubDate>Tue, 24 Apr 2007 13:23:11 GMT</pubDate></item></channel></rss>