Ajax controltoolkit Learning Log-resizablecontrolextender (23)

Source: Internet
Author: User
The resizablecontrolextender control is used to scale a web control.

Here is an example:

1) Create an ASP. NET Ajax-enabled web project in vs2005 and name it resizablecontrolextender1.

2) drag and drop a panel on the page and name it panel1. Drag and Drop a resizablecontrolextender under Panel1 and associate it with panel1.

CodeAs follows: 1 < ASP: Panel ID = "Panel1" Runat = "Server" Height = "100px" Width = "100px" Bordercolor = "Navajowhite" Borderstyle = "Solid" Borderwidth = "1px" >
2 Fjffoeijfioejfie < BR />
3 Joefjio < BR />
4 Efjoefjiojfiojfe < BR />
5 </ ASP: Panel >
6 < BR />
7 & Nbsp; </ Div >
8 < C0: resizablecontrolextender ID = "Resizablecontrolextender1" Runat = "Server" Maximumheight = "500"
9 Maximumwidth = "500" Minimumheight = "100" Minimumwidth = "100" Targetcontrolid = "Panel1" Handlecssclass = "Handletext" Resizablecssclass = "Resizingtext" Onclientresize = "Onclientresizetext" > </ C0: resizablecontrolextender >
10


3) Add the onclientresizetext script content on the page.

The Code is as follows: 1 VaR Fontsize = 12 ;
2 Function Onclientresizetext (sender, eventargs)
3 {
4 VaR E = Sender. get_element ();
5 While (E. scrollwidth <= E. clientwidth) | (E. scrollheight <= E. clientheight ))
6 {
7E. style. fontsize=(Fontsize++)+'Pt ';
8}
9 VaR Lastscrollwidth =- 1 ;
10 VaR Lastscrollheight =- 1 ;
11 While (E. clientwidth < E. scrollwidth | E. clientheight < E. scrollheight) && (E. scrollheight ! = Lastscrollwidth | E. scrollwidth ! = Lastscrollheight ))
12 {
13 Lastscrollwidth = E. scrollwidth;
14 Lastscrollheight = E. scrollheight;
15 E. style. fontsize = (Fontsize -- ) + 'Pt ';
16 }
17 }

4) press Ctrl + F5 to view the effect in the browser.

As follows:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.