(C # version) * Control * DataGrid with horizontal and vertical scroll bars (horizontal support from the quepse ")

xiaoxiao2021-03-06  50

(Add a reference Microsoft.VisualBasic) using System.ComponentModel; using System.Collections; using System.Web.UI; using System.Drawing; using System.Web; using Microsoft.VisualBasic; using System.Web.UI.WebControls;

namespace XYScrollDataGridcsharp {[DefaultProperty ( "Text"), ToolboxData ( "<{0}: XYScrollDataGridcsharp runat = server> ")] public class XYScrollDataGridcsharp: System.Web.UI.WebControls.DataGrid {private Unit MscrollWidth; Private DataModetype MDataMode; Private ShowscrollDataMode MshowscrollDataMode; Private Unit Ymscrollwidth;

Public Enum ShowscrollDataMode {Xscroll, Yscroll, Both, None,} PUBLIC ENUM DATAMODETYPE {可 変 変 変 変 変 変 変 s,}

[NotifyParentProperty (true), Browsable (false), EditorBrowsable (EditorBrowsableState.Advanced)] public override bool AutoGenerateColumns {get {return base.AutoGenerateColumns;} set {base.AutoGenerateColumns = false;}} [NotifyParentProperty (true)] public override bool AllowCustomPaging {get {return;} set {base.allowcustompaging = value;}}

[NotifyParentProperty] Public override bool allowpaging {get {return;} set {base.allowpaging = value;}}

[NotifyParentProperty (true), Browsable (false), EditorBrowsable (EditorBrowsableState.Advanced)] public override bool AllowSorting {get {return base.AllowSorting;} set {base.AllowSorting = value;}}

[NotifyParentProperty] Public override TableItemStyle AlternatingItemStyle {Get {Return Base.alternatingItemStyle;}}

[NotifyParentProperty (true)] public override Color BackColor {get {return base.BackColor;} set {base.BackColor = value;}} [NotifyParentProperty (true)] public override string BackImageUrl {get {return base.BackImageUrl;} set { Base.backimageurl = value;}}

[NotifyParentProperty (TRUE)] Public override color bordercolor {get {return base.bordercolor;} set {base.bordercolor = value;}}

[NotifyParentProperty] public override border {retturn base.bordersty;} set {base.borderstyle = value;}}

[NotifyParentProperty] public override unit borderwidth {get {return base.borderwidth;} set {base.borderwidth = value;}}

[NotifyParentProperty] public override int cellpadding {get {return base.cellpadding;} set {base.cellpadding = value;}}

[NotifyParentProperty] public override int cellspacing {get {return base.cellspacing;} set {base.cellspacing = value;}}

[NotifyParentProperty (TRUE)] Public Override DataGridColumnCollection Column {Get {Return Base.columns;}}

[NotifyParentProperty (TRUE)] public override int edititemindex {get {return;} set {base.edititemindex = value;}}

[NotifyParentProperty] Public override TableItemStyle EditItemStyle {Get {Return Base.editItemStyle;}}

[NotifyParentProperty (TRUE)] public override bool enabled {get {return.enabled;} set {base.enabled = value;}}

[NotifyParentProperty (true)] public override TableItemStyle FooterStyle {get {return base.FooterStyle;}} [NotifyParentProperty (true)] public override Color ForeColor {get {return base.ForeColor;} set {base.ForeColor = value;}}

[NotifyParentProperty] Public override gridlines gridlines {get {return base.gridlines;} set {base.gridlines = value;}}

[NotifyParentProperty] Public override TableItemStyle Headerstyle {Get {Return Base.Headerstyle;}}

[NotifyParentProperty] public override unit height {get {return base.height;} set {base.Height = value;}}

[NotifyParentProperty (TRUE)] Public override horizontalalign horizontalalign {get {return base.horizontalalign;} set {base.horizontalalign = value;}}

[NotifyParentProperty] Public override TableItemStyle ItemStyle {Get {Return Base.ItemStyle;}}

[NotifyParentProperty (TRUE)] Public override DataGridPagerstyle Pagerstyle {Get {Return Base.PagersTyle;}}

[NotifyParentProperty] public override int page.pageSize;} set {base.pageSize = value;}}}}}

[NotifyParentProperty (TRUE)] public override bool showfooter {get {returnrate.showfooter;} set {base.showfooter = value;}}

[NotifyParentProperty] public override bool showhead {get {return base.showheader;} set {base.showheader = value;}}

[NotifyParentProperty] public override bool visible {get {ras.visible;} set {base.visible = value;}}

[NotifyParentProperty (true)] public override Unit Width {get {return base.Width;} set {base.Width = value;}} [NotifyParentProperty (true)] public override string CssClass {get {return base.CssClass;} set { Base.cssclass = value;}}

[Category ( "holds one then selected Ze"), DefaultValue (typeof (Unit), "0px"), Description ( "su ku ro Hikaru の web")] public Unit YScrollBarHeight {get {return ymScrollWidth;} set {ymScrollWidth = value;}}

[Category ("モ モ ド ド ド"), DefaultValue ("ロ ー ル")] public unit xscrollbarwidth {get {return mscrollwidth;} set {mscrollwidth = value;}}

[Category ("/ U30E2 / U30FC / U30C9 / U9078 / U629E"), Description ("/ U56FA / U5B9A / U884C / U306E / U500B / U6570"), DefaultValue (0)] public int fixedcolumn {get {ix (this. mShowScrollDataMode == ShowScrollDataMode.XScroll) {return this.mFixedColumns;} return 0;} set {if (! this.mShowScrollDataMode = ShowScrollDataMode.XScroll) {return;} if ((this.Columns.Count

[Category ( "holds one then selected Ze"), DefaultValue (typeof (ShowScrollDataMode), "XScroll"), Description ( "XScroll")] public ShowScrollDataMode ShowScrollMode {get {return mShowScrollDataMode;} set {mShowScrollDataMode = value;}}

Protected Override Void Render (HSLTEXTWRITER WRITER) {Hashtable HaashTable1 = New HashTable (); HashTable1.Add ("Z-Index", this.style ["Z-Index"]); Hashtable1.Add ("Left", this.style ["Left"]); Hashtable1.Add ("position", this.style ["position"]); Hashtable1.Add ("TOP", this.style ["TOP"]); this.style.remove (" Z-index "); this.style.remove (" left "); this.style.remove (" position "); this.style.remove (" TOP "); Writer.write ("

"); this.fixedColumndataGrid ( Writer; Writer.write ("");}

Private void fixedcolumndataGrid (htmlTextWriter output) {string text2; string text4; text2 = "; text4 =" "; bool [] flagarray1 = new bool [(this.column.count - 1) 1];

INT Num7 = this.columns.count - 1;

For (int NUM2 = 0; Num2 <= Num7; Num2 ) {FlagarRay1 [Num2] = this.columns [Num2] .visible;} int Num1 = 0; int Num6 = this.mfixedColumns - 1; for (int Num3 = 0 Num3 <= NUM6; Num3 ) {INT Num5 = this.columns.count - 1; for (int Num4 = Num1; Num4 <= Num5; Num4 ) {if (this.columns [Num4] .visible) {text4 = system .Convert.tostring (Conversion.val (TEXT4) Conversion.val (this.columns [Num4] .Headerstyle.Width.toString ())); Num1 = Num4 1; Break;}}} text4 = system.convert. TOSTRING (Conversion.val (TEXT4) 1) (THIS.Cellspacing) * this.mfixedColumn); if (this.mfixedColumns == 0) {text4 = "0";} string text5 = this .mscrollwidth.toString (); string text3 = this.mscrollwidth.tostring (); this.outputLayout (Text4, Text5, Text2, text3, flagarray1, output);}

private void OutPutLayout (string widthOne, string widthTwo, string heightOne, string heightTwo, bool [] visiableColumn, HtmlTextWriter output) {output.Write ( "

") ; If (this.showscrollmode == ShowscrollDataMode.none) {Output.write ("" "); if (this.columns.count> this.mfixedColumn) {this.showleft (" ", output;} Output. Write ("");} else if (this.showscrollmode == showscrollDataMode.xscroll) {Output.write (""); this.Showleft (widthone, Output); if (this.columns. Count> this.mFixedColumns) {this.ShowRight (widthTwo, output);} output.Write ( "");} else if (this.ShowScrollMode == ShowScrollDataMode.YScroll) {output.Write ( " "); This.Showtop (Heightone, Output); Output.write (" "); if (this.columns.count> this.mfixedColumns) {Output.write (" "); this .Showbottom (Heighttwo, Output); Output.write ("");}} else f (this.showscr OllMode == ShowscrollDataMode.both {Output.write (""); this.showtop (Heightone, Output); Output.write (""); if (this.mfixedcolumns == 0) { Output.write (""); this.bothscroll (HeighttWo, Output); Output.write ("");}}} Int Num2 = this.columns.count - 1; for (INT NUM1 = 0; Num1 <= Num2; Num1 ) {this.columns [Num1] .visible = visiableColumn [Num1];} Output.write ("");

Private void Bothscroll (String Width, HtmlTextWriter Output) {Output.write ("

"); String [] TextArray1 = New String [6] {"
"; Output.write (text1); int Num4 = this.items.count - 1; for (int Num1 = 0; Num1 <= Num4; Num1 ) {this.items [Num1] .visible = true;} int Num3 = this.Items.count - 1; for (int) Num2 = 0; Num2 <= Num3; Num2 ) {this.items [Num2] .attributes ["ID"] = this.id "TRD" Num2;} this.style ["Border-style"] = "NONE "; .SHOWHEADER = false; base.render (output); this.showheader = true; output.write (" "); Output.write (" ");}

Private void showbottom (string height, htmltextwriter output) {Output.write ("

"); string text1 = ("
"; OUTPUT.WRITE (TEXT1); int Num4 = this.items.count - 1; for (int Num1 = 0; Num1 <= Num4; Num1 ) {this.items [Num1] .visible = true;} int Num3 = this.items.count - 1; for (int Num2 = 0; NUM2 <= Num3; Num2 ) {this.items [Num2] .attributes ["ID"] = this.id "trd" Num2;} this .Style ["border-style"] = "none"; this.showhead = false; base.render (output); this.showhead = true; Output.write (""); Output.write ("" ");

Private void showleft (string width, htmltextwriter output) {Output.write ("

"); string text1 = ("
"; Output.write (TEXT1); if (this.mshowscrollDataMode == showscrollDataMode.none) {int Num4 = this.Items.count - 1; for (int Num1 = 0; Num1 <= Num4; Num1 ) {this.items [Num1] .attributes ["ID"] = this.id "TRD" Num1;}} else {Int Num3 = this.items.count - 1; for (int Num2 = 0; Num2 <= Num3; Num2 ) {this.items [ Num2] .attributes ["ID"] = this.id "TRL" Num2;}} this.style ["Border-style"] = "none"; base.render (Output); Output.write ("< / Div> "); Output.write (" ");}

Private void showright (string width, htmltextwriter output) {Output.write ("

"); string text1 = ("
"; Output.write (TEXT1); if (this.showscrollmode! = ShowscrollDataMode.none) {Int Num6 = this.mfixedColumns - 1; for (int Num1 = 0; Num1 <= Num6; Num1 ) {int Num5 = this.columns.count - 1 For (int NUM2 = 0; Num2 <= Num5; Num2 ) {IF (this.columns [num2] .visible) {this.columns [Num2] .visible = false; bud;}}}} int Num4 = this. Items.count - 1; for (int NUM3 = 0; Num3 <= Num4; Num3 ) {this.items [Num3] .attributes ["ID"] = this.id "TRR" Num3;} this.style [ "Border-style"] = "none"; base.render (output); Output.write (""); Output.write ("");}

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

New Post(0)
CopyRight © 2020 All Rights Reserved
Processed: 0.044, SQL: 9