Set the node icon of the treelist control. Either set it to display all or not display all in the display attribute.
The current project requirement is that some nodes are set to unavailable, and some nodes are set to show only lines without selecting boxes. Therefore, you can only discard the checkbox display settings of treelist and draw your own icons.
Use the stateimage attribute to set the icon display. First, perform an icon enumeration to read from the resource file:
/// <Summary> // select the status of the node on the treelist page /// </Summary> Public Enum treenodecheckimage {checkedbranch = 0, // select the branch uncheckedbranch = 1, // unselected branch checkedleaf = 2, // selected leaf (not used for the moment, same as 0) uncheckedleaf = 3, // unselected middle (not used for the moment, same as 1) branchline = 4, // branch leafline = 5, // leaf line discheckedbranch = 6, // do not allow the selected branch discheckedleaf = 7, // do not select leaf loading = 8} /// <summary> // treelist node icon /// </Summary> public class treelistimagestate {// <summary> // /customize the treelist node icon /// </Summary> /// <returns> </returns> Public static imagelist getimagelist () {imagelist treelistimagelist = new imagelist (); treelistimagelist. transparentcolor = system. drawing. color. transparent; treelistimagelist. images. add ("0", orgcertificate. properties. resources. tree_checkedbranch); treelistimagelist. images. add ("1", orgcertificate. properties. resources. tree_uncheckedbranch); treelistimagelist. images. add ("2", orgcertificate. properties. resources. tree_checkedleaf); treelistimagelist. images. add ("3", orgcertificate. properties. resources. tree_uncheckedleaf); treelistimagelist. images. add ("4", orgcertificate. properties. resources. tree_branchline); treelistimagelist. images. add ("5", orgcertificate. properties. resources. tree_leafline); treelistimagelist. images. add ("6", orgcertificate. properties. resources. tree_discheckedbranch); treelistimagelist. images. add ("7", orgcertificate. properties. resources. tree_discheckedleaf); treelistimagelist. images. add ("8", orgcertificate. properties. resources. tree_loading); treelistimagelist. imagesize = new system. drawing. size (20, 20); Return treelistimagelist ;} /// <summary> /// custom treelist node icon /// </Summary> /// <returns> </returns> Public static imagecollection getimagecollection () {imagecollection treelistimagecol = new imagecollection (); treelistimagecol. transparentcolor = system. drawing. color. transparent; treelistimagecol. images. add (orgcertificate. properties. resources. tree_checkedbranch, "0"); treelistimagecol. images. add (orgcertificate. properties. resources. tree_uncheckedbranch, "1"); treelistimagecol. images. add (orgcertificate. properties. resources. tree_checkedleaf, "2"); treelistimagecol. images. add (orgcertificate. properties. resources. tree_uncheckedleaf, "3"); treelistimagecol. images. add (orgcertificate. properties. resources. tree_branchline, "4"); treelistimagecol. images. add (orgcertificate. properties. resources. tree_leafline, "5"); treelistimagecol. images. add (orgcertificate. properties. resources. tree_discheckedbranch, "6"); treelistimagecol. images. add (orgcertificate. properties. resources. tree_discheckedleaf, "7"); treelistimagecol. images. add (orgcertificate. properties. resources. tree_loading, "8"); treelistimagecol. imagesize = new system. drawing. size (20, 20); Return treelistimagecol ;}}}