Getting the text property to appear in a custom button 
Author Message
 Getting the text property to appear in a custom button

Hello,
I'm trying to create a custom flat button control, kind of like what
is used on the VS.NET toolbar. Everything is working well so far,
except that I can't get the stupid thing to expose the Text property
for the control. I declared the property as an override of the
UserControl's text property, so it should work, shouldn't it? Is there
something I'm missing here? I did declare the property to be public
and it isn't any different than any other property declaration in the
class, except that it is an override. I also tried shadowing the base
class method. What was interesting was that I could get the property
to appear if I changed its name to "Caption". Any ideas?

Thanks,
Will Gant



Mon, 09 May 2005 14:15:12 GMT  
 Getting the text property to appear in a custom button
Here's the code that creates a button and puts it ont the form

Dim button As New System.Windows.Forms.Button()

With button

.Text = "Hello World"

.Left = 20

.Top = 20

.Width = 120

.Height = 44

.Visible = True

End With

Me.Controls.Add(button)

I already know what you're going to say, so,  make an array out of the
button and:

Button1(0).Caption = "Hello World"

HTH


Quote:
> Hello,
> I'm trying to create a custom flat button control, kind of like what
> is used on the VS.NET toolbar. Everything is working well so far,
> except that I can't get the stupid thing to expose the Text property
> for the control. I declared the property as an override of the
> UserControl's text property, so it should work, shouldn't it? Is there
> something I'm missing here? I did declare the property to be public
> and it isn't any different than any other property declaration in the
> class, except that it is an override. I also tried shadowing the base
> class method. What was interesting was that I could get the property
> to appear if I changed its name to "Caption". Any ideas?

> Thanks,
> Will Gant



Mon, 09 May 2005 16:57:17 GMT  
 Getting the text property to appear in a custom button
Confusing, eh? Use
<Browsable(True)> Public Overrides Property Text() As String
The underlying class appears to have the browsable set to false on that
property.

Cheers,
  Jason


Quote:
> Hello,
> I'm trying to create a custom flat button control, kind of like what
> is used on the VS.NET toolbar. Everything is working well so far,
> except that I can't get the stupid thing to expose the Text property
> for the control. I declared the property as an override of the
> UserControl's text property, so it should work, shouldn't it? Is there
> something I'm missing here? I did declare the property to be public
> and it isn't any different than any other property declaration in the
> class, except that it is an override. I also tried shadowing the base
> class method. What was interesting was that I could get the property
> to appear if I changed its name to "Caption". Any ideas?

> Thanks,
> Will Gant



Mon, 09 May 2005 20:20:28 GMT  
 Getting the text property to appear in a custom button
I'm actually inheriting from the UserControl class. The button is
totally custom, I'm not even inheriting from ButtonBase.

Will


Quote:
> Here's the code that creates a button and puts it ont the form

> Dim button As New System.Windows.Forms.Button()

> With button

> .Text = "Hello World"

> .Left = 20

> .Top = 20

> .Width = 120

> .Height = 44

> .Visible = True

> End With

> Me.Controls.Add(button)

> I already know what you're going to say, so,  make an array out of the
> button and:

> Button1(0).Caption = "Hello World"

> HTH



> > Hello,
> > I'm trying to create a custom flat button control, kind of like what
> > is used on the VS.NET toolbar. Everything is working well so far,
> > except that I can't get the stupid thing to expose the Text property
> > for the control. I declared the property as an override of the
> > UserControl's text property, so it should work, shouldn't it? Is there
> > something I'm missing here? I did declare the property to be public
> > and it isn't any different than any other property declaration in the
> > class, except that it is an override. I also tried shadowing the base
> > class method. What was interesting was that I could get the property
> > to appear if I changed its name to "Caption". Any ideas?

> > Thanks,
> > Will Gant



Tue, 10 May 2005 00:39:49 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. tab strip custom properties page appearing in my finished exe

2. Getting Page Custom Properties onto a new page

3. Getting 0.0000 from custom property ??

4. Trapping Custom Property Dialog Buttons

5. Overridden property doesn't appear in Properties window

6. Custom text on MsgBox buttons?

7. Custom Text on Buttons in a Message Box?

8. Returning "Text" custom properties

9. Custom Document properties and text boxes.

10. how to add tooltips to custom buttons on custom toolbar

11. Custom Command Button or Custom Label

12. Text in text box appears inconsistently

 

 
Powered by phpBB® Forum Software