利用HTML实现简单的统计图

RedYell_Bar.cs 控件一,显示两个Bar

RedYell_Bar.cs
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
using System.Drawing;

namespace RedYellBar
{
    
/**//// <summary>
    
/// RedYell_Bar の概要の説明です。
    
/// </summary>

    [ToolboxData("<{0}:RedYell_Bar runat=server Width=200 Height=55></{0}:RedYell_Bar>")]
    
public class RedYell_Bar : WebControl,System.Web.UI.INamingContainer
    
{
        
//公共属性
        private int redValue=-1;
        
private decimal yellValue=-1;
        
//広域変数
        public static Unit GlobalWidth=200;
        
public static Unit GlobalHeight=55;
        
public static int RedMax=999;
        
public static decimal YellMax=9999999;
        
public static int BarSize=9;
        
public static string RedBarColor="#FF0000";
        
public static string YellBarColor="#FFFF00";
        
//私有変数
        private string redText;
        
private string yellText;
        
private string yellMaxText;
        
private double redBarMaxWidth;
        
private double yellBarMaxWidth;
        
private double redBarWidth;
        
private double yellBarWidth;
        
private int commaCount;
        
//私有定数
        private const double SingleWidthRed=10.5;
        
private const double SingleWidthYell=9.0;
        
private const double SingleWidthComma=5.0;
    
        
公共属性#region 公共属性
        
public int RedValue 
        
{
            
get
            
{
                
return redValue;
            }

            
set
            
{
                redValue
=value;
                CreateChildControls();
            }

        }

        
public decimal YellValue 
        
{
            
get
            
{
                
return yellValue;
            }

            
set
            
{
                yellValue
=value;
                CreateChildControls();
            }

        }

        
#endregion


        
protected override void CreateChildControls()
        
{
            
this.Controls.Clear();
            
if(redValue!=-1&&yellValue!=-1)
            
{
                BuildControlHierarchy();
            }

        }


        
private void BuildControlHierarchy()
        
{
            TextBox TextBox_Red
=new TextBox();
            TextBox TextBox_Yell
=new TextBox();
            Label Label_Red
=new Label();
            Label Label_Yell
=new Label();

            TextBox_Red.ReadOnly
=true;
            TextBox_Red.BackColor
=ColorTranslator.FromHtml(RedBarColor);
            TextBox_Red.BorderStyle
=BorderStyle.None;
            
            TextBox_Yell.ReadOnly
=true;
            TextBox_Yell.BackColor
=ColorTranslator.FromHtml(YellBarColor);
            TextBox_Yell.BorderStyle
=BorderStyle.None;

            
//故障許容
            if(redValue>RedMax)
            
{
                redValue
=RedMax;
            }

            
else if(redValue<0)
            
{
                redValue
=0;
            }

            
if(yellValue>YellMax)
            
{
                yellValue
=YellMax;
            }

            
else if(yellValue<0)
            
{
                yellValue
=0;
            }

            
if(GlobalWidth.Value<100)
            
{
                GlobalWidth
=100;
            }


            redText
=redValue.ToString();
            yellText
=yellValue.ToString("C");
            yellMaxText
=YellMax.ToString("C");

            commaCount
=0;
            
for(int i=0;i<yellMaxText.Length;i++)
            
{
                
if(yellMaxText[i]==',')
                
{
                    commaCount
++;
                }

            }


            
//Barの最大の幅を計算します
            redBarMaxWidth=GlobalWidth.Value-RedMax.ToString().Length*SingleWidthRed;
            yellBarMaxWidth
=GlobalWidth.Value-(yellMaxText.Length-commaCount)*SingleWidthYell-commaCount*SingleWidthComma;
            
if(yellBarMaxWidth<0)
            
{
                yellBarMaxWidth
=(yellMaxText.Length-commaCount)*SingleWidthYell+commaCount*SingleWidthComma;
            }


            
//Barの幅を計算します
            redBarWidth=(redBarMaxWidth/RedMax)*redValue;
            yellBarWidth
=(yellBarMaxWidth/(double)YellMax)*(double)yellValue;

            
//内部のコンポーネントの属性を設けます
            Label_Red.Text=redText;
            Label_Yell.Text
=yellText;
            TextBox_Red.Width
=(Unit)redBarWidth;
            TextBox_Yell.Width
=(Unit)yellBarWidth;
            TextBox_Red.Height
=BarSize;
            TextBox_Yell.Height
=BarSize;

            
//UIを表示すります
            this.Controls.Add(new LiteralControl("<table align=\"right\"><tr><td align=\"right\">"));
            
this.Controls.Add(Label_Red);
            
this.Controls.Add(TextBox_Red);
            
this.Controls.Add(new LiteralControl("</td></tr><tr><td align=\"right\">"));
            
this.Controls.Add(Label_Yell);
            
this.Controls.Add(TextBox_Yell);
            
this.Controls.Add(new LiteralControl("</td></tr></table>"));
            
this.Width=GlobalWidth;
            
this.Height=GlobalHeight;
        }

    }

}



Red_Bar.cs 控件二,显示多个Bar

Red_Bar.cs
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
using System.Collections;
using System.Drawing;

namespace RedYellBar
{
    
/**//// <summary>
    
/// Red_Bar の概要の説明です。
    
/// </summary>

    [ToolboxData("<{0}:Red_Bar runat=server Width=200 Height=20></{0}:Red_Bar>")]
    
public class Red_Bar : WebControl,System.Web.UI.INamingContainer
    
{
        
//公共属性
        private ArrayList redValues=new ArrayList();
        
//広域変数
        public static int MaxValue=999;
        
public static int BarSize=9;
        
public static Unit GlobalWidth=200;
        
public static string BarColor="#FF0000";
        
//私有変数
        private string maxValueText;
        
private int red_value;
        
private string lableText;
        
private double barMaxWidth;
        
private double barWidth;
        
//私有定数
        private const double SingleWidth=10;
    
        
公共属性#region 公共属性
        
public ArrayList RedValues 
        
{
            
get
            
{
                
return redValues;
            }

            
set
            
{
                redValues 
= value;
                CreateChildControls();
            }

        }
    
        
#endregion


        
protected override void CreateChildControls()
        
{
            
this.Controls.Clear();
            
if(GlobalWidth.Value <100)
            
{
                GlobalWidth
=100;
            }


            
//Barの最大の幅を計算します
            maxValueText=MaxValue.ToString();
            barMaxWidth
=GlobalWidth.Value-maxValueText.ToString().Length*SingleWidth;
            
if(barMaxWidth<0)
            
{
                barMaxWidth
=maxValueText.ToString().Length*SingleWidth;
            }


            
for(int i=0;i<redValues.Count;i++)
            
{
                red_value
=Int32.Parse(redValues[i].ToString());

                
//故障許容
                if(red_value>MaxValue)
                
{
                    red_value
=MaxValue;
                }

                
else if(red_value<0)
                
{
                    red_value
=0;
                }


                lableText
=red_value.ToString();
                
//Barの幅を計算します
                barWidth=(barMaxWidth/MaxValue)*red_value;

                TextBox textbox
=new TextBox();
                textbox.ReadOnly
=true;
                textbox.BackColor
=ColorTranslator.FromHtml(BarColor);
                textbox.BorderStyle
=BorderStyle.None;
                textbox.Width
=(Unit)barWidth;
                textbox.Height
=BarSize;

                Label lable
=new Label();
                lable.Text
=lableText;
                
                
//UIを表示すります
                this.Controls.Add(textbox);
                
this.Controls.Add(lable);
                
this.Controls.Add(new LiteralControl("<br>"));
                
this.Width=GlobalWidth;
            }

        }

    }

}




WebForm1.aspx 测试页面

WebForm1.aspx
<%@ Register TagPrefix="cc1" Namespace="RedYellBar" Assembly="RedYellBar" %>
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="RedYellBar.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
    
<HEAD>
        
<title>WebForm1</title>
        
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
        
<meta content="C#" name="CODE_LANGUAGE">
        
<meta content="JavaScript" name="vs_defaultClientScript">
        
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
    
</HEAD>
    
<body MS_POSITIONING="GridLayout">
        
<form id="Form1" method="post" runat="server">
            
<asp:TextBox id="TextBox_Height" style="Z-INDEX: 116; LEFT: 360px; POSITION: absolute; TOP: 24px"
                runat
="server" Width="56px" tabIndex="2">55</asp:TextBox>
            
<asp:TextBox id="TextBox_BarColor" style="Z-INDEX: 151; LEFT: 584px; POSITION: absolute; TOP: 144px"
                runat
="server">#FF0000</asp:TextBox>
            
<asp:TextBox id="TextBox_YellBarColor" style="Z-INDEX: 150; LEFT: 584px; POSITION: absolute; TOP: 104px"
                runat
="server">#FFFF00</asp:TextBox>
            
<asp:Label id="Label27" style="Z-INDEX: 147; LEFT: 480px; POSITION: absolute; TOP: 144px" runat="server">Barの色(B):</asp:Label>
            
<asp:Label id="Label26" style="Z-INDEX: 146; LEFT: 480px; POSITION: absolute; TOP: 104px" runat="server">Bar2の色(A):</asp:Label>
            
<asp:Button id="Button2" style="Z-INDEX: 144; LEFT: 856px; POSITION: absolute; TOP: 104px" tabIndex="50"
                runat
="server" Width="60px" Height="60px" Text="初期化"></asp:Button>
            
<asp:TextBox id="TextBox_B2_Values" style="Z-INDEX: 142; LEFT: 208px; POSITION: absolute; TOP: 712px"
                tabIndex
="14" runat="server" Width="152px">400,300,200,100</asp:TextBox>
            
<asp:Label id="Label24" style="Z-INDEX: 141; LEFT: 136px; POSITION: absolute; TOP: 720px" runat="server">件数値:</asp:Label>
            
<asp:Label id="Label23" style="Z-INDEX: 140; LEFT: 64px; POSITION: absolute; TOP: 720px" runat="server">例2:</asp:Label>
            
<asp:Label id="Label22" style="Z-INDEX: 139; LEFT: 24px; POSITION: absolute; TOP: 720px" runat="server">B:</asp:Label>
            
<asp:Label id="Label21" style="Z-INDEX: 137; LEFT: 136px; POSITION: absolute; TOP: 544px" runat="server">件数値:</asp:Label>
            
<asp:Label id="Label20" style="Z-INDEX: 136; LEFT: 24px; POSITION: absolute; TOP: 456px" runat="server">A:</asp:Label>
            
<asp:Label id="Label19" style="Z-INDEX: 135; LEFT: 24px; POSITION: absolute; TOP: 352px" runat="server">A:</asp:Label>
            
<asp:Label id="Label18" style="Z-INDEX: 134; LEFT: 24px; POSITION: absolute; TOP: 544px" runat="server">B:</asp:Label>
            
<asp:Label id="Label17" style="Z-INDEX: 133; LEFT: 24px; POSITION: absolute; TOP: 232px" runat="server">A:</asp:Label>
            
<asp:TextBox id="TextBox_B1_Values" style="Z-INDEX: 132; LEFT: 208px; POSITION: absolute; TOP: 536px"
                tabIndex
="13" runat="server" Width="152px">999,200,300,400</asp:TextBox>
            
<asp:Label id="Label16" style="Z-INDEX: 131; LEFT: 64px; POSITION: absolute; TOP: 544px" runat="server">例1:</asp:Label>
            
<asp:TextBox id="TextBox_BarSize" style="Z-INDEX: 130; LEFT: 264px; POSITION: absolute; TOP: 64px"
                runat
="server" tabIndex="4">9</asp:TextBox>
            
<asp:TextBox id="TextBox_RedValue3" style="Z-INDEX: 123; LEFT: 208px; POSITION: absolute; TOP: 440px"
                runat
="server" tabIndex="11">400</asp:TextBox>
            
<asp:Label id="Label14" style="Z-INDEX: 111; LEFT: 136px; POSITION: absolute; TOP: 480px" runat="server">銭数値:</asp:Label>
            
<asp:Label id="Label13" style="Z-INDEX: 103; LEFT: 136px; POSITION: absolute; TOP: 440px" runat="server">件数値:</asp:Label>
            
<asp:TextBox id="TextBox_YellValue3" style="Z-INDEX: 107; LEFT: 208px; POSITION: absolute; TOP: 480px"
                runat
="server" tabIndex="12">4561235</asp:TextBox>
            
<asp:Label id="Label12" style="Z-INDEX: 120; LEFT: 64px; POSITION: absolute; TOP: 456px" runat="server">例3:</asp:Label>
            
<asp:TextBox id="TextBox_RedValue2" style="Z-INDEX: 122; LEFT: 208px; POSITION: absolute; TOP: 328px"
                runat
="server" tabIndex="9">800</asp:TextBox>
            
<asp:Label id="Label11" style="Z-INDEX: 110; LEFT: 136px; POSITION: absolute; TOP: 368px" runat="server">銭数値:</asp:Label>
            
<asp:Label id="Label10" style="Z-INDEX: 102; LEFT: 136px; POSITION: absolute; TOP: 328px" runat="server">件数値:</asp:Label>
            
<asp:TextBox id="TextBox_YellValue1" style="Z-INDEX: 105; LEFT: 208px; POSITION: absolute; TOP: 248px"
                runat
="server" tabIndex="8">9999999</asp:TextBox>
            
<asp:Label id="Label9" style="Z-INDEX: 118; LEFT: 64px; POSITION: absolute; TOP: 232px" runat="server">例1:</asp:Label>
            
<asp:TextBox id="TextBox_RedValue1" style="Z-INDEX: 121; LEFT: 208px; POSITION: absolute; TOP: 208px"
                runat
="server" tabIndex="7">999</asp:TextBox>
            
<asp:Label id="Label8" style="Z-INDEX: 109; LEFT: 136px; POSITION: absolute; TOP: 256px" runat="server">銭数値:</asp:Label>
            
<asp:Label id="Label7" style="Z-INDEX: 101; LEFT: 136px; POSITION: absolute; TOP: 216px" runat="server">件数値:</asp:Label>
            
<asp:TextBox id="TextBox_RedMax" style="Z-INDEX: 104; LEFT: 264px; POSITION: absolute; TOP: 104px"
                runat
="server" tabIndex="5">999</asp:TextBox>
            
<asp:Label id="Label4" style="Z-INDEX: 115; LEFT: 280px; POSITION: absolute; TOP: 24px" runat="server">高さ(A):</asp:Label>
            
<asp:TextBox id="TextBox_YellMax" style="Z-INDEX: 112; LEFT: 264px; POSITION: absolute; TOP: 144px"
                runat
="server" tabIndex="6">9999999</asp:TextBox>
            
<asp:Label id="Label2" style="Z-INDEX: 108; LEFT: 136px; POSITION: absolute; TOP: 144px" runat="server">銭数最大値(A):</asp:Label>
            
<asp:Label id="Label1" style="Z-INDEX: 100; LEFT: 136px; POSITION: absolute; TOP: 104px" runat="server">件数最大値(AB):</asp:Label>
            
<asp:TextBox id="TextBox_YellValue2" style="Z-INDEX: 106; LEFT: 208px; POSITION: absolute; TOP: 368px"
                runat
="server" tabIndex="10">8564253</asp:TextBox>
            
<asp:Label id="Label3" style="Z-INDEX: 113; LEFT: 136px; POSITION: absolute; TOP: 24px" runat="server">幅(AB):</asp:Label>
            
<asp:TextBox id="TextBox_Width" style="Z-INDEX: 114; LEFT: 208px; POSITION: absolute; TOP: 24px"
                runat
="server" Width="56px" tabIndex="1">200</asp:TextBox>
            
<asp:Label id="Label5" style="Z-INDEX: 117; LEFT: 16px; POSITION: absolute; TOP: 104px" runat="server">全体設置:</asp:Label>
            
<asp:Label id="Label6" style="Z-INDEX: 119; LEFT: 64px; POSITION: absolute; TOP: 352px" runat="server">例2:</asp:Label>
            
<cc1:RedYell_Bar id="RedYell_Bar1" style="Z-INDEX: 124; LEFT: 384px; POSITION: absolute; TOP: 216px"
                runat
="server" Height="55" Width="200"></cc1:RedYell_Bar>
            
<cc1:RedYell_Bar id="RedYell_Bar2" style="Z-INDEX: 125; LEFT: 384px; POSITION: absolute; TOP: 328px"
                runat
="server" Height="55" Width="200"></cc1:RedYell_Bar>
            
<cc1:RedYell_Bar id="RedYell_Bar3" style="Z-INDEX: 126; LEFT: 384px; POSITION: absolute; TOP: 440px"
                runat
="server" Height="55" Width="200"></cc1:RedYell_Bar>
            
<asp:CheckBox id="CheckBox_Border" style="Z-INDEX: 127; LEFT: 432px; POSITION: absolute; TOP: 24px"
                runat
="server" Text="へり(AB)" Checked="True" tabIndex="3"></asp:CheckBox>
            
<asp:Button id="Button1" style="Z-INDEX: 128; LEFT: 776px; POSITION: absolute; TOP: 104px" runat="server"
                Height
="60px" Width="60px" Text="OK" tabIndex="100"></asp:Button>
            
<asp:Label id="Label15" style="Z-INDEX: 129; LEFT: 136px; POSITION: absolute; TOP: 64px" runat="server">Barの高さ(AB):</asp:Label>
            
<cc1:Red_Bar id="Red_Bar1" style="Z-INDEX: 138; LEFT: 384px; POSITION: absolute; TOP: 544px"
                runat
="server" Width="200" Height="20px"></cc1:Red_Bar>
            
<cc1:Red_Bar id="Red_Bar2" style="Z-INDEX: 143; LEFT: 384px; POSITION: absolute; TOP: 720px"
                runat
="server" Width="200" Height="20px"></cc1:Red_Bar>
            
<asp:Label id="Label25" style="Z-INDEX: 145; LEFT: 480px; POSITION: absolute; TOP: 64px" runat="server">Bar1の色(A):</asp:Label>
            
<asp:TextBox id="TextBox_RedBarColor" style="Z-INDEX: 148; LEFT: 584px; POSITION: absolute; TOP: 64px"
                runat
="server">#FF0000</asp:TextBox></form>
    
</body>
</HTML>



WebForm1.aspx.cs 测试页面后台

WebForm1.aspx.cs
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace RedYellBar
{
    
/**//// <summary>
    
/// WebForm1 の概要の説明です。
    
/// </summary>

    public class WebForm1 : System.Web.UI.Page
    
{
        
protected System.Web.UI.WebControls.Label Label1;
        
protected System.Web.UI.WebControls.Label Label2;
        
protected System.Web.UI.WebControls.Label Label3;
        
protected System.Web.UI.WebControls.Label Label4;
        
protected System.Web.UI.WebControls.Label Label5;
        
protected System.Web.UI.WebControls.Label Label6;
        
protected System.Web.UI.WebControls.Label Label7;
        
protected System.Web.UI.WebControls.Label Label8;
        
protected System.Web.UI.WebControls.Label Label9;
        
protected System.Web.UI.WebControls.Label Label10;
        
protected System.Web.UI.WebControls.Label Label11;
        
protected System.Web.UI.WebControls.Label Label12;
        
protected System.Web.UI.WebControls.Label Label13;
        
protected System.Web.UI.WebControls.Label Label14;
        
protected RedYellBar.RedYell_Bar RedYell_Bar1;
        
protected RedYellBar.RedYell_Bar RedYell_Bar2;
        
protected RedYellBar.RedYell_Bar RedYell_Bar3;
        
protected System.Web.UI.WebControls.TextBox TextBox_Width;
        
protected System.Web.UI.WebControls.TextBox TextBox_Height;
        
protected System.Web.UI.WebControls.CheckBox CheckBox_Border;
        
protected System.Web.UI.WebControls.TextBox TextBox_YellValue2;
        
protected System.Web.UI.WebControls.TextBox TextBox_YellMax;
        
protected System.Web.UI.WebControls.TextBox TextBox_RedMax;
        
protected System.Web.UI.WebControls.TextBox TextBox_RedValue1;
        
protected System.Web.UI.WebControls.TextBox TextBox_RedValue2;
        
protected System.Web.UI.WebControls.TextBox TextBox_YellValue3;
        
protected System.Web.UI.WebControls.TextBox TextBox_RedValue3;
        
protected System.Web.UI.WebControls.Label Label15;
        
protected System.Web.UI.WebControls.TextBox TextBox_BarSize;
        
protected System.Web.UI.WebControls.TextBox TextBox_YellValue1;
        
protected System.Web.UI.WebControls.Label Label16;
        
protected System.Web.UI.WebControls.TextBox TextBox_B1_Values;
        
protected System.Web.UI.WebControls.Label Label17;
        
protected System.Web.UI.WebControls.Label Label18;
        
protected System.Web.UI.WebControls.Label Label19;
        
protected System.Web.UI.WebControls.Label Label20;
        
protected System.Web.UI.WebControls.Label Label21;
        
protected RedYellBar.Red_Bar Red_Bar1;
        
protected System.Web.UI.WebControls.Label Label22;
        
protected System.Web.UI.WebControls.Label Label23;
        
protected System.Web.UI.WebControls.Label Label24;
        
protected System.Web.UI.WebControls.TextBox TextBox_B2_Values;
        
protected RedYellBar.Red_Bar Red_Bar2;
        
protected System.Web.UI.WebControls.Button Button2;
        
protected System.Web.UI.WebControls.Label Label25;
        
protected System.Web.UI.WebControls.Label Label26;
        
protected System.Web.UI.WebControls.Label Label27;
        
protected System.Web.UI.WebControls.TextBox TextBox_RedBarColor;
        
protected System.Web.UI.WebControls.TextBox TextBox_YellBarColor;
        
protected System.Web.UI.WebControls.TextBox TextBox_BarColor;
        
protected System.Web.UI.WebControls.Button Button1;
    
        
private void Page_Load(object sender, System.EventArgs e)
        
{
            
// ページを初期化するユーザー コードをここに挿入します。
        }


        
Web フォーム デザイナで生成されたコード#region Web フォーム デザイナで生成されたコード 
        
override protected void OnInit(EventArgs e)
        
{
            
//
            
// CODEGEN: この呼び出しは、ASP.NET Web フォーム デザイナで必要です。
            
//
            InitializeComponent();
            
base.OnInit(e);
        }

        
        
/**//// <summary>
        
/// デザイナ サポートに必要なメソッドです。このメソッドの内容を
        
/// コード エディタで変更しないでください。
        
/// </summary>

        private void InitializeComponent()
        
{    
            
this.Load += new System.EventHandler(this.Page_Load);

        }

        
#endregion


        
private void Button1_Click(object sender, System.EventArgs e)
        
{
            RedYell_Bar.GlobalWidth
=Unit.Parse(TextBox_Width.Text);
            RedYell_Bar.GlobalHeight
=Unit.Parse(TextBox_Height.Text);
            RedYell_Bar.RedMax 
=Int32.Parse(TextBox_RedMax.Text);
            RedYell_Bar.YellMax
=Decimal.Parse(TextBox_YellMax.Text);
            RedYell_Bar.BarSize
=Int32.Parse(TextBox_BarSize.Text);
            RedYell_Bar.RedBarColor
=TextBox_RedBarColor.Text;
            RedYell_Bar.YellBarColor
=TextBox_YellBarColor.Text;
    
            RedYell_Bar1.RedValue
=Int32.Parse(TextBox_RedValue1.Text);
            RedYell_Bar1.YellValue
=Decimal.Parse(TextBox_YellValue1.Text);

            RedYell_Bar2.RedValue
=Int32.Parse(TextBox_RedValue2.Text);
            RedYell_Bar2.YellValue
=Decimal.Parse(TextBox_YellValue2.Text);

            RedYell_Bar3.RedValue
=Int32.Parse(TextBox_RedValue3.Text);
            RedYell_Bar3.YellValue
=Decimal.Parse(TextBox_YellValue3.Text);
            
            Red_Bar.GlobalWidth
=Unit.Parse(TextBox_Width.Text);
            Red_Bar.MaxValue
=Int32.Parse(TextBox_RedMax.Text);
            Red_Bar.BarSize
=Int32.Parse(TextBox_BarSize.Text);
            Red_Bar.BarColor
=TextBox_BarColor.Text;
            
            Red_Bar1.RedValues
=ArrayList.Adapter(TextBox_B1_Values.Text.Split(','));
            Red_Bar2.RedValues
=ArrayList.Adapter(TextBox_B2_Values.Text.Split(','));

            
if(CheckBox_Border.Checked)
            
{
                RedYell_Bar1.BorderWidth
=1;
                RedYell_Bar2.BorderWidth
=1;
                RedYell_Bar3.BorderWidth
=1;
                Red_Bar1.BorderWidth
=1;
                Red_Bar2.BorderWidth
=1;
            }

            
else
            
{
                RedYell_Bar1.BorderWidth
=0;
                RedYell_Bar2.BorderWidth
=0;
                RedYell_Bar3.BorderWidth
=0;
                Red_Bar1.BorderWidth
=0;
                Red_Bar2.BorderWidth
=0;
            }


        }


        
private void Button2_Click(object sender, System.EventArgs e)
        
{
            Response.Redirect(
"WebForm1.aspx");
        }

    }

}




RedYellBar.xls 控件说明文档

RedYellBar.xls
RedYell_Bar クラス                    
    Web ページ上に統計図を表示します。                
                    
    広域変数:                
                    
        属性名    タイプ    既定値    説明
        GlobalWidth    Unit    
200    統計図の幅を取得または設定します。
        GlobalHeight    Unit    
55    統計図の高さを取得または設定します。
        RedMax    int    
999    件数最大値を取得または設定します。
        YellMax    decimal    
9999999    銭数最大値を取得または設定します。
        BarSize    int    
9    Barの高さを取得または設定します。
        RedBarColor    string    
#FF0000    件数Barの色さを取得または設定します。
        YellBarColor    string    #FFFF00    銭数Barの色さを取得または設定します。
                    
    カスタムパブリック プロパティ:                

        属性名    タイプ    既定値    説明
        RedValue    int    
-1    件数値を取得または設定します。
        YellValue    decimal    
-1    銭数値を取得または設定します。
                    
                    
Red_Bar クラス                    
    Web ページ上に統計図を表示します。                
                    
    広域変数:                
                    
        属性名    タイプ    既定値    説明
        GlobalWidth    Unit    
200    統計図の幅を取得または設定します。
        MaxValue    int    
999    件数最大値を取得または設定します。
        BarSize    int    
9    Barの高さを取得または設定します。
        BarColor    string    
#FF0000    Barの色さを取得または設定します。
                    
    カスタムパブリック プロパティ:                                    

        属性名    タイプ    既定値    説明                    
        RedValues    ArrayList    なし    件数値の配列を取得または設定します。配列要素はstringタイプです。                    

継承メンバ:                                        

    .NET Framework クラス ライブラリ                                    
    System.Web.UI.WebControls                WebControl メンバ を参照してください。                    

注意事項:                                        
    ①広域変数は一回設ける、広域で発効します。クラスの名称を通じて訪問します(例えば:RedYell_Bar.GlobalWidth
=300)。                                    

转载于:https://www.cnblogs.com/hbbpb/archive/2007/08/20/862851.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值