Using system; using system. collections. generic; using system. componentmodel; using system. LINQ; using system. text; using system. web; using system. web. ui; using system. web. UI. webcontrols; [Assembly: webresource ("votestar.star01.gif", "image/GIF")] [Assembly: webresource ("votestar.star02.gif", "image/GIF")] [assembly: webresource ("votestar.star03.gif", "image/GIF")] namespace votestar {[defaultproperty ("text")] [toolboxdata ("<{0 }: votestarcontrol runat = Server> </{0}: votestarcontrol> ")] public class votestarcontrol: webcontrol {int starwidth = 14; [category (" votestar ")] [description ("star width")] public int starwidth {get {return starwidth;} set {starwidth = value ;}} int starheight = 14; [category ("votestar")] [description ("star height")] public int starheight {get {return starheight;} set {starheight = value ;}} int starnum = 7; [category ("votestar")] [description ("number of stars")] public int starnum {get {return starnum ;} set {starnum = value ;}} int level = 1; [category ("votestar")] [description ("user level")] public int level {get {return level ;} set {level = value ;}} protected override void rendercontents (htmltextwriter output) {string imgurl1 = page. clientscript. getwebresourceurl (this. getType (), "votestar.star01.gif"); string imgurl2 = page. clientscript. getwebresourceurl (this. getType (), "votestar.star02.gif"); stringbuilder sb = new stringbuilder (); For (INT I = 0; I <level; I ++) Sb. append (" "); for (INT I = level; I <starnum; I ++) Sb. append (" "); output. write (sb. tostring ());}}}