编译自定义控件的运行时版本
1. 在解决方案资源管理器中,右击 Class1.cs 并单击"重命名"。
2. 重命名文件 PDAChartControlControl.cs。
注意 如果没有打开解决方案资源管理器,请单击"视图"菜单上的"解决方案资源管理器"。
用下列代码替换 PDAChartControlControl.cs 中的代码:
//********************************************************************
*********
// PDAChartControlControl
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
#if NETCFDESIGNTIME
[assembly: System.CF.Design.RuntimeAssemblyAttribute("PDAChartControl, Version=1.10.0.0, _
Culture=neutral, PublicKeyToken=null")]
namespace PDAChartControl
{
///
/// Summary description for UserControl1.
///
public class PDAChart : System.Windows.Forms.Control
{
public System.Windows.Forms.HScrollBar hScrollBar1;
///
/// Required designer variable.
///
// Delegate declaration.
// public delegate void EventHandler(string text,Color BackColor,int
Height);
//
// //声明事件的委托:
// //public delegate void MyEventHandler(string text,Color BackColor,
int Height);
// //定义一个公共事件成员
// public event EventHandler AddCube;
// protected virtual void OnAddCube(EventArgs e)
// {
//
// }
//
private PDAChartControl.MyGraph objGraph=new MyGraph();
private Point mBeginPoint=new Point(0,0) ;
private System.ComponentModel.Container components = null;
public PDAChart()
{
InitializeComponent();
}
public enum ChartTypeEnum { PillarChart, CakeChart ,BreakLinkChart};
#region Windows 属性定义
private bool mhScrollBarVisible=true;
#if NETCFDESIGNTIME
[System.ComponentModel.Category("PDAChart")]
[System.ComponentModel.DefaultValueAttribute(0)]
[System.ComponentModel.Description("设置/读取滚动条是否可见")]
#endif
public bool hScrollBarVisible
{
get
{
return mhScrollBarVisible;
}
set
{
mhScrollBarVisible =value;
this.Invalidate();
}
}
private ChartTypeEnum mChartType=ChartTypeEnum.PillarChart;
#if NETCFDESIGNTIME
[System.ComponentModel.Category("PDAChart")]
[System.ComponentModel.DefaultValueAttribute(0)]
[System.ComponentModel.Description("设置/读取图形类型")]
#endif
public ChartTypeEnum ChartType
{
get
{
return mChartType;
}
set
{
mChartType =value;
this.Invalidate();
}
}
private int mPicHeight=20;
#if NETCFDESIGNTIME
[System.ComponentModel.Category("PDAChart")]
[System.ComponentModel.DefaultValueAttribute(0)]
[System.ComponentModel.Description("设置/读取饼图高")]
#endif
public int PicHeight
{
get
{
return mPicHeight;
}
set
{
mPicHeight =value;
this.Invalidate();
}
}
private Font mTitleFont =new Font("Arial", 9, FontStyle.Regular);
#if NETCFDESIGNTIME
[System.ComponentModel.Category("PDAChart")]
[System.ComponentModel.Description("设置/读取文本字体")]
#endif
public Font TitleFont
{
get
{
return mTitleFont;
}
set
{
mTitleFont=value;
this.Invalidate();
}
}
private Font mTextFont =new Font("Arial", 8, FontStyle.Regular);
#if NETCFDESIGNTIME
[System.ComponentModel.Category("PDAChart")]
[System.ComponentModel.Description("设置/读取文本字体")]
#endif
public Font TextFont
{
get
{
return mTextFont;
}
set
{
mTextFont=value;
this.Invalidate();
}
}
private static DataTable mDataTable=new DataTable() ;
#if NETCFDESIGNTIME
[System.ComponentModel.Category("PDAChart")]
[System.ComponentModel.Description("设置/读取数据表")]
#endif
public DataTable dataTable
{
get
{
return mDataTable;
}
set
{
mDataTable=(DataTable)value;
this.Invalidate();
}
}
private string mShowColumnName;
#if NETCFDESIGNTIME
[System.ComponentModel.Category("PDAChart")]
[System.ComponentModel.Description("设置/读取显示列")]
#endif
public string ShowColumnName
{
get
{
return mShowColumnName;
}
set
{
mShowColumnName=value;
this.Invalidate();
}
}
private string mDataColumnName;
#if NETCFDESIGNTIME
[System.ComponentModel.Category("PDAChart")]
[System.ComponentModel.Description("设置/读取数据列")]
#endif
public string DataColumnName
{
get
{
return mDataColumnName;
}
set
{
mDataColumnName=value;
this.Invalidate();
}
}