(添加引用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>{0}:XYScrollDataGridcsharp>")]
public class XYScrollDataGridcsharp :System.Web.UI.WebControls.DataGrid
{
private Unit mScrollWidth;
private DataModeType mDataMode;
private int mFixedColumns;
private ShowScrollDataMode mShowScrollDataMode;
private Unit ymScrollWidth;
public enum ShowScrollDataMode
{
XScroll,
YScroll,
Both,
None,
}
public enum DataModeType
{
可変行Scroll,
固定行Scroll,
}
[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 base.AllowCustomPaging;
}
set
{
base.AllowCustomPaging = value;
}
}
[NotifyParentProperty(true)]
public override bool AllowPaging
{
get
{
return base.AllowPaging;
}
set
{
base.AllowPaging = value;
}
}
[NotifyParentProperty(true), Browsable(false), EditorBrowsable(EditorBrowsableState.Advanced)]
public override bool AllowSorting
{
get
{
return base.AllowSorting;
}
set
{
base.AllowSorting = value;
}
}
[NotifyParentProperty(true)]
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(true)]
public override BorderStyle BorderStyle
{
get
{
return base.BorderStyle;
}
set
{
base.BorderStyle = value;
}
}
[NotifyParentProperty(true)]
public override Unit BorderWidth
{
get
{
return base.BorderWidth;
}
set
{
base.BorderWidth = value;
}
}
[NotifyParentProperty(true)]
public override int CellPadding
{
get
{
return base.CellPadding;
}
set
{
base.CellPadding = value;
}
}
[NotifyParentProperty(true)]
public override int CellSpacing
{
get
{
return base.CellSpacing;
}
set
{
base.CellSpacing = value;
}
}
[NotifyParentProperty(true)]
public override DataGridColumnCollection Columns
{
get
{
return base.Columns;
}
}
[NotifyParentProperty(true)]
public override int EditItemIndex
{
get
{
return base.EditItemIndex;
}
set
{
base.EditItemIndex = value;
}
}
[NotifyParentProperty(true)]
public override TableItemStyle EditItemStyle
{
get
{
return base.EditItemStyle;
}
}
[NotifyParentProperty(true)]
public override bool Enabled
{
get
{
return base.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(true)]
public override GridLines GridLines
{
get
{
return base.GridLines;
}
set
{
base.GridLines = value;
}
}
[NotifyParentProperty(true)]
public override TableItemStyle HeaderStyle
{
get
{
return base.HeaderStyle;
}
}
[NotifyParentProperty(true)]
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(true)]
public override TableItemStyle ItemStyle
{
get
{
return base.ItemStyle;
}
}
[NotifyParentProperty(true)]
public override DataGridPagerStyle PagerStyle
{
get
{
return base.PagerStyle;
}
}
[NotifyParentProperty(true)]
public override int PageSize
{
get
{
return base.PageSize;
}
set
{
base.PageSize = value;
}
}
[NotifyParentProperty(true)]
public override bool ShowFooter
{
get
{
return base.ShowFooter;
}
set
{
base.ShowFooter = value;
}
}
[NotifyParentProperty(true)]
public override bool ShowHeader
{
get
{
return base.ShowHeader;
}
set
{
base.ShowHeader = value;
}
}
[NotifyParentProperty(true)]
public override bool Visible
{
get
{
return base.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("モード選択"), DefaultValue(typeof(Unit), "0px"), Description("スクロールの幅")]
public Unit YScrollBarHeight
{
get
{
return ymScrollWidth;
}
set
{
ymScrollWidth = value;
}
}
[Category("モード選択"), DefaultValue(typeof(Unit), "0px"), Description("スクロールの幅")]
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 FixedColumns
{
get
{
if (this.mShowScrollDataMode == ShowScrollDataMode.XScroll)
{
return this.mFixedColumns;
}
return 0;
}
set
{
if (this.mShowScrollDataMode != ShowScrollDataMode.XScroll)
{
return;
}
if ((this.Columns.Count < value) & (this.Columns.Count != 0))
{
this.mFixedColumns = this.Columns.Count;
}
else if (value < 0)
{
this.mFixedColumns = 0;
}
else
{
this.mFixedColumns = value;
}
}
}
[Category("モード選択"), DefaultValue(typeof(ShowScrollDataMode), "XScroll"), Description("XScroll")]
public ShowScrollDataMode ShowScrollMode
{
get
{
return mShowScrollDataMode;
}
set
{
mShowScrollDataMode = value;
}
}
protected override void Render(HtmlTextWriter writer)
{
Hashtable hashtable1 = 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("
}
private void FixedColumnDataGrid(HtmlTextWriter output)
{
string text2;
string text4;
text2="";
text4="";
bool[] flagArray1 = new bool[(this.Columns.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) + (Conversion.Val(this.CellSpacing) * this.mFixedColumns));
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("
private void BothScroll(string width, HtmlTextWriter output)
{
output.Write("
private void ShowBottom(string height, HtmlTextWriter output)
{
output.Write("
private void ShowLeft(string width, HtmlTextWriter output)
{
output.Write("
private void ShowRight(string width, HtmlTextWriter output)
{
output.Write("
private void ShowTop(string height, HtmlTextWriter output)
{
output.Write("