locked
Dealing with the width property of a custom web server control RRS feed

  • Question

  • User863329428 posted

    I have created a web server control that contains a textbox and two image buttons.  The images are a fixed size (in pixels).  I would like to have the textbox fill the entire controls width minus the size of the images.  This is not a problem if the unit type passed in is not a percentage; however, I cannot figure out how to set the width of my textbox when a percentage is passed to the control.

     For example, if each image is 20 pixels wide and the width property is set to 100%, how do I set my textbox width to 100% - 40 pixels.

     Any help would be great.

    Friday, April 24, 2009 6:22 PM

Answers

  • User-1226263862 posted

    Since it is a custom control you have to create a property for that width to have access to it on the front side.  Like this:

     

        Public Property TextBoxWidth() As Drawing.Size
            Get
                Return TextBox1.Size
            End Get
            Set(ByVal value As Drawing.Size)
                TextBox1.Size = value
            End Set
        End Property
     
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, April 24, 2009 11:46 PM