Control the height of TreeView in IE WebControl

xiaoxiao2021-03-06  45

TreeView is a useful control in Microsoft IE WebControls, which is widely used. As TreeView opens and gatches, the height it actually occupies is also changing, in my project, the height of TreeView Control is required to form a "compact" layout. The implementation method is as follows:

First, modify TreeView.htc

TreeView.htc In http: // localhost / webctrl_client / 1_0 /, add as follows:

Function gettreeViewNode () {return treeviewNode;}

This is to pass hidden properties.

Second, define the JavaScript function

function AthosGetTreeViewCompactHeight (TreeviewID) {objTreeview = document.all [TreeviewID]; objTreeviewNode = objTreeview.TreeviewNode; objTreeviewDivs = objTreeviewNode.getElementsByTagName ( "DIV"); iCount = objTreeviewDivs.length; CompactHeight = -1; for (i = 0; i CompactHeight) CompactHeight = iBottom;} return CompactHeight;}

function AthosFitTreeViewHeight (TreeviewID) {objTreeview = document.all [TreeviewID]; objTreeview.style.height = String (AthosGetTreeViewCompactHeight (TreeviewID)) "px";}

The first function is the actual height of the tree. The second function is to reset the height of the tree control. The parameters are the ID of the tree control.

This allows the height of the tree control.

// AthossMTH copyright, please contact the author.

转载请注明原文地址:https://www.9cbs.com/read-117822.html

New Post(0)