DataGrid. New function "scroll bar, fixed list and the first row, with mouse to adjust the list

zhaozj2021-02-16  167

New features: 1, scroll bar 2, fixed list, first column and last row, use mouse to adjust the column

Written things, I haven't been tested, I don't know if it is useful for everyone, please also ask for a valuable opinion, there is only one thing! Oh, there is egg to fly ...

Note: 1. When using new features 2, set it to set it. Otherwise, it is transparent, you can see the content below it. 2. When adjusting with a mouse, don't be too close to the side line, otherwise it is not easy to adjust. ***************************************** USING SYSTEM; Using System.Web.ui; use system.web.ui .Webcontrols; using system.componentmodel; using system.drawing;

Namespace Sydg {///

/// WebcustomControl1 Summary Description.

/// [DefaultProperty ("text"), ToolboxData ("<{0}: sydatagrid runat = server> ")] public class sydataGrid: system.web.ui.webcontrols .DataGrid {private bool showScroll = true; [Category ( "attribute"), Description ( "whether to display a scroll bar"), DefaultValue (true)] public bool showScroll {get {return showScroll;} set {showScroll = value;}} private string scrollClassName = ""; [Category ( "attribute"), Description ( "scroll bar style, may be provided on the outer border style"), DefaultValue ( "")] public string scrollClassName {get {return scrollClassName;} set {scrollClassName = value;}} private bool fixfoot = false; [category ", Description (" Whether to fix the last row at the bottom "), defaultValue (false)] public bool fixfoot {get {return fixfoot;} set {fixfoot = value;}} private bool fixfirst = true; [category ", Description (" Whether fixed display first list in the left "), defaultValue] public bool fixfirst {get {return fixfirst;} set { Fixfirst = value;}} private bool resizecolumn = true; [category ( "Attribute"), Description ( "Allow mouse Column Width"), DefaultValue (true)] public bool ResizeColumn {get {return resizeColumn;} set {resizeColumn = value;}} private Unit tableWidth = new Unit (null [Category), Description ("The actual width" used to display the table ")] Public unit TableWidth {Get {returnTWidth;} set {TableWidth = value;}} private string ColorToString (Color Color) {If (color.isempty) return "#fffffff"; else {if (color.isknowncolor) return color.name; Else Return "#"

Color.name.substring (2);}} ///

/// The control is presented to the specified output parameter.

/// /// HTML writer to write protected override void render (HTMLTextWriter output) {Output.writeline (" "); // ********************************* ****************************** If (this.showscroll) // If the scroll bar is displayed, the output div {// judgment is Whether the script IF has been output in the current page (this.page.isstartupScriptregistered ("Sydg_JScript") == false) {this.page.registerStartupScript ("Sydg_jscript", "); // Set the output script tag String script =" "; Script = @"