Export (0) Print
Expand All
1 out of 4 rated this helpful - Rate this topic

How to: Set Web Server Control Unit Properties

Width, height, and similar properties for Web server controls are set in units. Units are implemented as objects (the Unit structure), which allows you to specify a value and the measurement unit in various ways.

To set unit-based properties

  • Assign a reference to the Unit structure to your control.

    The following code examples show variations on how to do this.

    
    // Default is pixels.
    TextBox1.Width = new Unit(100);
    TextBox1.Width = new Unit(100, UnitType.Pixel);
    TextBox1.Width = new Unit("100px");
    // Centimeters
    TextBox1.Width = new Unit("2cm");
    TextBox1.Width = new Unit(10, UnitType.Percentage);
    TextBox1.Width = new Unit("10%");
    
    
    
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.