TreeView positive color

xiaoxiao2021-03-06  92

During this time, you need to use the tree menu, and you will find TreeView, build menu data sheet - read and generate nodes ... everything is smooth, but when it is applied to the page, the color problem makes me a headache for a long time : The color of the Selected node and the HOVER node is in ugly (if it is a light color, it is better, but the bottom color in the project is difficult to identify the words above the norms (if the display is aging or If the color is dark, it is a dark ...) No matter how SELECTEDSTYLE and HOVERSTYLE are no good, in the end, I have to post for help at 9CBS, huh, I haven't long been, there is no Mencius Labor and I am awake - "Modify the relevant style in HTC" I didn't expect to open /Webctrl_client/1_0/treeview.htc file, good guy 3000 lines ... Since it is a mixed color, it should be alpha, search ... find the following line [code] VAR Ofilter = OITEM.FILTERS.ITEM ("DxImageTransform.microsoft.alpha"); if (Ofilter) {Ofilter.Opacity * = 2; // This is changed to Ofilter.opacity = 100, and there is a place is Ofilter.opacity / = 2, the same 100} g_styles ["HOVERSTYLE"] = "color: highlighttext; background-color: highlight; filter: progid: DxImageTransform.microsoft.alpha (Opacity = 50, style = 0);"; // Here Opacity Also 100 [/ code] They are the default style and change style, huh, everything is OK; it is not so fast at the time: http://community.9cbs.net/Expert/topic/3443/3443524.xml ? Temp = .9843408 Also attached to a tree generation algorithm: [code] private void createdv () {string c = "select classid, class, parentid from aclass order by order); DB D = New DB (STR_CONN, C) ; // written by a database link class D.initialDbConnection (); D.Objsconn.open (); sqldatarader SDR = D.Objscomm.executeReader (); DataTable DT = New DataTable ("Table"); DT.COLUMNS.ADD ("ClassID", System.Type.gettype ("System.String ")); Dt.columns.add (" class ", system.type.gettype (" system.string "))); DT.COLUMNS.ADD (" PID ", System.Type.gettype (" System.String ") );

While (SDR.READ ()) {DATAROW DR = DT.NEWROW (); DR ["ClassID"] = SDR ["ClassID"]. TOSTRING (); DR ["class"] = SDR ["class"]. Tostring (); DR ["PID"] = SDR ["ParentID"]. TOSTRING (); dt.Rows.add (DR);} D.Objsconn.close (); dataview dv = dt.defaultView; CreateTree (TV .Nodes, 0, dv);} private void CreateTree (TreeNodeCollection classNodeCollection, int pID, DataView dv) {dv.RowFilter = "pID =" pID; int tmpParentFolderID = 0; foreach (DataRowView drv in dv) {TreeNode tn = New treenode (); tn.id = drv.row ["classid"]. TOSTRING (); tn.nodedata = drv.row ["classid"]. toString (); tn.text = drv.row ["class" ] .Tostring (). Trim (); TMPParentFolderid = int32.parse (DRV.ROW ["PID"]. TOSSNODECOLLECTION.ADD (TN); CreateTree (ClassNodeCollection); CreateTree (ClassnodeNodeCollection]; CreateTree ] .Nodes, int32.parse (tn.id), dv);}} [/ code] is mainly a recursive function PS: I wrote something in my blog, I read a lot of heroes BLOG benefits Many, you can't let your blog are always empty, it's a wasteland.

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

New Post(0)