﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » .NET Forums » General .NET Discussion  » How to "ownerdraw" a textbox</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Tue, 09 Jun 2026 01:39:35 GMT</lastBuildDate><ttl>20</ttl><item><title>How to "ownerdraw" a textbox</title><link>http://forum.strataframe.net/FindPost14203.aspx</link><description>I'd like to have a TextBox with a button beside it (it will "zoom" in on the contents by opening another form).  However, as you know, there is no OwnerDraw for text boxes (at least I couldn't find it).  I attempted a UserControl, that that was waaaaay too much work and a bit wanky to boot because I need a TextBox in all its glory, plus a something clickable right beside it.  &lt;br&gt;
&lt;br&gt;
To recap:  I want a SF TextBox with some clickable element beside it (maybe a label with an image or a button).  I'd like this to be a single control that I drop on the form, rather than two (I use this a lot).  &lt;br&gt;
&lt;br&gt;
So, any ideas on how I might do this?&lt;br&gt;
&lt;br&gt;
Thanks!</description><pubDate>Fri, 08 Feb 2008 11:41:59 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: How to "ownerdraw" a textbox</title><link>http://forum.strataframe.net/FindPost14208.aspx</link><description>Thanks!  I'll look into this.</description><pubDate>Fri, 08 Feb 2008 11:41:59 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: How to "ownerdraw" a textbox</title><link>http://forum.strataframe.net/FindPost14207.aspx</link><description>One other thought....you may want to use the TextBoxRenderer class to help you generate the standard background, etc instead of manually reinventing the wheel.&amp;nbsp; You can have it draw the standard background to a device context (graphics) so this way you can just render what the text and what you want to add.</description><pubDate>Fri, 08 Feb 2008 11:31:48 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: How to "ownerdraw" a textbox</title><link>http://forum.strataframe.net/FindPost14206.aspx</link><description>Inherit a textbox, the in the constructor call the SetStyle method:&lt;/P&gt;&lt;P&gt;[codesnippet]SetStyle(UserPaint, True)[/codesnippet]&lt;/P&gt;&lt;P&gt;When you do this, you can then override the OnPaint method and get to rendering:&lt;/P&gt;&lt;P&gt;[codesnippet]Protected Overrides Sub OnPaint(...)&lt;BR&gt;&amp;nbsp;&amp;nbsp; '-- e.Graphics.GetToRendering &lt;BR&gt;End Sub[/codesnippet]</description><pubDate>Fri, 08 Feb 2008 11:08:07 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item></channel></rss>