将数字(类似金钱)显示在控件中,你可以输入输出并且可以将数字转换成文字

using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
using System.Text ;

namespace PzControl
{
 /// <summary>
 /// MoneyControl 的摘要说明。
 /// </summary>
 public class MoneyControl : System.Windows.Forms.UserControl
 {
  private System.Windows.Forms.Timer timer1;
  private System.ComponentModel.IContainer components;
  private const int W=120;//总宽
  private const int H=40;//总高
  private const int segment=8;//每段宽
  private bool show=true ;//控制光标闪烁
  private struct Pens//绘制竖线的彩笔
  {
   public Pen RedPen;
   public Pen BluePen;
   public Pen YellowPen;
  }
  private struct Num//每段的信息
  {
   public int index;
   public char num;
   public Point point;
  }
  private Num[] numS=new Num[15];
  private Pens penS=new Pens();
  private Num CurrentNum;
  private int upIndex;
  private decimal moneyP=0m;//Money
  private decimal moneyUp=0m;//上一次修改之前的数目
  private bool modified=false;//是否已修改
  /// <summary>
  /// 被选取时的背景色
  /// </summary>
  private Color selectedColor=Color.FromArgb(235,235,235) ;
  /// <summary>
  /// 未被选取时的背景色
  /// </summary>
  private Color unSelectedColor=Color.White ;
  /// <summary>
  /// 是否画边框
  /// </summary>
  private bool drawFram=true;
  /// <summary>
  /// 是否为只读
  /// </summary>
  private bool readOnly=false;
  private bool zf=true;

  /// <summary>
  /// 构造函数
  /// </summary>
  public MoneyControl()
  {
   // 该调用是 Windows.Forms 窗体设计器所必需的。
   InitializeComponent();

   // TODO: 在 InitializeComponent 调用后添加任何初始化
   penS.BluePen =new Pen(Color.Blue ,1);
   penS.RedPen =new Pen(Color.Red ,1);
   penS.YellowPen =new Pen(Color.Bisque ,1);
   this.Money =0m;
   this.Width =W;this.Height =H;
   this.CurrentNum =this.numS[12];
   this.upIndex =12;
   
  }
  /// <summary>
  /// 提供初始设置
  /// </summary>
  /// <param name="DrawFram">是否画边框</param>
  /// <param name="SelectedColor">选取时的颜色</param>
  /// <param name="UselectedColor">未被选取时的颜色</param>
  /// <param name="MoneyP">数目</param>
  public void StartSet(bool DrawFram,Color SelectedColor,Color UselectedColor,decimal MoneyP)
  {
   if(SelectedColor==UselectedColor)
   {
    MessageBox.Show("选取时和未被选取时的颜色不能设置成一样!");
    return ;
   }
   this.selectedColor =SelectedColor;
   this.unSelectedColor =UselectedColor;
   this.drawFram=DrawFram;
   this.MoneyZF =MoneyP;
   this.moneyUp =MoneyP;
   this.modified =false;
  }
  /// <summary>
  /// 提供初始设置
  /// </summary>
  /// <param name="MoneyP">数目</param>
  public void StartSet(decimal MoneyP)
  {
   this.MoneyZF =MoneyP;
   this.moneyUp =MoneyP;
   this.modified =false;
  }
  public void StartSet(bool DrawFram,decimal MoneyP)
  {
   this.drawFram=DrawFram;
   this.MoneyZF =MoneyP;
   this.moneyUp =MoneyP;
   this.modified =false;
  }
  /// <summary>
  /// 提供初始设置
  /// </summary>
  /// <param name="SelectedColor">选取时的颜色</param>
  /// <param name="UselectedColor">未被选取时的颜色</param>
  /// <param name="MoneyP">数目</param>
  public void StartSet(Color SelectedColor,Color UselectedColor,decimal MoneyP)
  {
   if(SelectedColor==UselectedColor)
   {
    MessageBox.Show("选取时和未被选取时的颜色不能设置成一样!");
    return ;
   }
   this.selectedColor =SelectedColor;
   this.unSelectedColor =UselectedColor;
   this.MoneyZF =MoneyP;
   this.moneyUp =MoneyP;
   this.modified =false;
  }
  /// <summary>
  /// 如果放弃修改则
  /// </summary>
  public void CancelModif()
  {
   this.MoneyZF =this.moneyUp ;
   this.modified =false;
  }
  /// <summary>
  /// 设置或取Money
  /// </summary>
  public decimal MoneyZF
  {
   get
   {
    if(this.zf)
     return this.moneyP ;
    else
     return -this.moneyP ;
   }
   set
   {
    this.Money=Math.Abs(value);
    if(value>=0)
     this.ZF  =true;
    else
     this.ZF  =false;
   }
  }
  /// <summary>
  /// 设置,获取是否已改变
  /// </summary>
  public bool Modified
  {
   get
   {
    return this.modified ;
   }
   set
   {
    this.modified =value;
    if(!value)//如果保存修改则
     this.moneyUp =this.MoneyZF ;
   }
  }
  public bool ReadOnly
  {
   get
   {
    return this.readOnly ;
   }
   set
   {
    this.readOnly =value;
   }
  }  /// <summary>
  /// 填写字符数组---设置Money无符号数
  /// </summary>
  /// <param name="money"></param>
  private decimal Money
  {
   get
   {
    return this.moneyP;
   }
   set
   {
    Num num;char[] charP;
    charP=this.moneyToCharS(value);
    for(int i=0;i<15;i++)
    {
     num=new Num();
     num.index =i;
     num.num =charP[i];
     num.point =new Point(i*segment,16);
     numS[i]=num;
    }
    this.moneyP =value;
    this.modified =true;
   }
  }
  /// <summary>
  /// 设置或取Money的正负
  /// </summary>
  public bool ZF
  {
   get
   {
    return this.zf ;
   }
   set
   {
    this.zf =value;
    this.UnDisplayMoney();
    this.drawMoney();
    this.modified =true;
   }
  }

  /// <summary>
  ///  分析money使之与显示的字符一一对应
  /// </summary>
  /// <param name="numP"></param>
  /// <returns></returns>
  private char[] moneyToCharS(decimal numP)
  {
   char[] pp=new char[15];
   if(numP==0)
   {
    for(int i=0;i<15;i++)
    {
     pp[i]=' ';
    }
    return pp;
   }
   string str=numP.ToString().Trim();
   int s=str.IndexOf(".");
   if(s==-1)
   {
    str=str.PadLeft(13,' ');
    str+="00";
    pp=str.ToCharArray();
    return pp;
   }
   string Zstr=str.Substring(0,s);
   if(Zstr=="0") Zstr="";
   string Lstr=str.Substring(s+1,str.Length -s-1);
   Lstr=Lstr.PadRight(2,'0');
   str=Zstr+Lstr;
   str=str.PadLeft(15,' ');
   pp=str.ToCharArray();
   return pp;
  }
  /// <summary>
  /// 清理所有正在使用的资源。
  /// </summary>
  protected override void Dispose( bool disposing )
  {
   if( disposing )
   {
    if(components != null)
    {
     components.Dispose();
    }
   }
   base.Dispose( disposing );
  }
  protected override void OnPaint(PaintEventArgs e)
  {
   base.OnPaint (e);
   drawLines(e);
   drawMoney();
  }
  /// <summary>
  /// 绘制15根竖线及外框
  /// </summary>
  /// <param name="e"></param>
  private void drawLines(PaintEventArgs e)
  {
   int i=0;int w=0;
   Graphics dc=e.Graphics ;
   i++;w=i*segment;
   dc.DrawLine(penS.BluePen ,new Point(w,0),new Point(w,H));
   i++;w=i*segment;
   dc.DrawLine(penS.YellowPen ,new Point(w,0),new Point(w,H));
   i++;w=i*segment;
   dc.DrawLine(penS.YellowPen ,new Point(w,0),new Point(w,H));

   i++;w=i*segment;
   dc.DrawLine(penS.BluePen ,new Point(w,0),new Point(w,H));
   i++;w=i*segment;
   dc.DrawLine(penS.YellowPen ,new Point(w,0),new Point(w,H));
   i++;w=i*segment;
   dc.DrawLine(penS.YellowPen ,new Point(w,0),new Point(w,H));

   i++;w=i*segment;
   dc.DrawLine(penS.BluePen  ,new Point(w,0),new Point(w,H));
   i++;w=i*segment;
   dc.DrawLine(penS.YellowPen   ,new Point(w,0),new Point(w,H));
   i++;w=i*segment;
   dc.DrawLine(penS.YellowPen   ,new Point(w,0),new Point(w,H));

   i++;w=i*segment;
   dc.DrawLine(penS.BluePen  ,new Point(w,0),new Point(w,H));
   i++;w=i*segment;
   dc.DrawLine(penS.YellowPen   ,new Point(w,0),new Point(w,H));
   i++;w=i*segment;
   dc.DrawLine(penS.YellowPen   ,new Point(w,0),new Point(w,H));

   i++;w=i*segment;
   dc.DrawLine(penS.RedPen  ,new Point(w,0),new Point(w,H));
   i++;w=i*segment;
   dc.DrawLine(penS.YellowPen   ,new Point(w,0),new Point(w,H));
   i++;w=i*segment;
   dc.DrawLine(penS.YellowPen   ,new Point(w,0),new Point(w,H));
   if(this.drawFram)
    dc.DrawRectangle(new Pen(Brushes.Black ,2),0,0,W,H);
  }
  /// <summary>
  /// 将money用图形绘制出来
  /// </summary>
  /// <param name="e"></param>
  private void drawMoney()
  {
   Graphics dc=this.CreateGraphics();
   Brush brush;
   if(this.zf)
    brush=Brushes.Black ;
   else
    brush=Brushes.Red ;
   if(this.BackColor==this.selectedColor)
    for(int p=0;p<15;p++)
    {
     dc.DrawString(numS[p].num.ToString(),new Font("Arial Black",8),brush ,new Rectangle(new Point(numS[p].point.X -1,numS[p].point.Y ),new Size(9,12)),StringFormat.GenericDefault );
    }
   else
    for(int p=0;p<15;p++)
    {
     dc.DrawString(numS[p].num.ToString(),new Font("Arial",8),brush ,new Rectangle(numS[p].point,new Size(8,12)),StringFormat.GenericDefault );
    }
  }


  #region 组件设计器生成的代码
  /// <summary>
  /// 设计器支持所需的方法 - 不要使用代码编辑器
  /// 修改此方法的内容。
  /// </summary>
  private void InitializeComponent()
  {
   this.components = new System.ComponentModel.Container();
   this.timer1 = new System.Windows.Forms.Timer(this.components);
   //
   // timer1
   //
   this.timer1.Interval = 500;
   this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
   //
   // MoneyControl
   //
   this.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
   this.Name = "MoneyControl";
   this.Size = new System.Drawing.Size(224, 150);
   this.Load += new System.EventHandler(this.MoneyControl_Load);
   this.Enter += new System.EventHandler(this.MoneyControl_Enter);
   this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.MoneyControl_KeyDown);
   this.Leave += new System.EventHandler(this.MoneyControl_Leave);
   this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.MoneyControl_MouseDown);

  }
  #endregion

  private void MoneyControl_Load(object sender, System.EventArgs e)
  {
   this.Width =W;this.Height =H;
   this.upIndex =12;
  }

  private void MoneyControl_BackColorChanged(object sender, System.EventArgs e)
  {
   if(this.BackColor==this.unSelectedColor )
    timer1.Enabled =false;
   else
    timer1.Enabled =true;
  }
  private void timer1_Tick(object sender, System.EventArgs e)
  {
   this.show =!(this.show );
   Graphics dc=this.CreateGraphics();
   if(this.show )
    dc.DrawLine(new Pen(Brushes.Black ,1),new Point(CurrentNum.point.X+2 ,CurrentNum.point.Y +12),new Point(CurrentNum.point.X +6,CurrentNum.point.Y +12));
   else
    dc.DrawLine(new Pen(this.BackColor  ,1),new Point(CurrentNum.point.X+2 ,CurrentNum.point.Y +12),new Point(CurrentNum.point.X +6,CurrentNum.point.Y +12));
  }

  private void MoneyControl_Enter(object sender, System.EventArgs e)
  {
   this.BackColorChanged +=new EventHandler(MoneyControl_BackColorChanged);
   this.BackColor =this.selectedColor;
   if(this.moneyP==0m)
   {
    numS[12].num ='0';numS[13].num ='0';numS[14].num ='0';
   }
   this.CurrentNum =this.numS[12];
  }

  private void MoneyControl_Leave(object sender, System.EventArgs e)
  {
   this.BackColorChanged +=new EventHandler(MoneyControl_BackColorChanged);
   this.BackColor =this.unSelectedColor;
   if(this.moneyP==0m)
   {
    numS[12].num =' ';numS[13].num =' ';numS[14].num =' ';
   }
  }

  private void MoneyControl_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
  {
   Graphics dc=this.CreateGraphics();
   int code=e.KeyValue ;
   int index=0;upIndex=this.CurrentNum.index ;
   dc.DrawLine(new Pen(Brushes.Black ,1),new Point(numS[upIndex].point.X+2 ,numS[upIndex].point.Y +12),new Point(numS[upIndex].point.X +6,numS[upIndex].point.Y +12));
   Num temNum=new Num();
   temNum=numS[upIndex];
   switch(code)
   {
    case 33://向前移动光标
    case 36:
     index=this.CurrentNum.index -1;
     if(index<0)
     {
      index=0;
      this.Parent.SelectNextControl(this,false,false,false,true);
     }
     this.CurrentNum=this.numS[index];
     dc.DrawLine(new Pen(this.BackColor  ,1),new Point(temNum.point.X+2 ,temNum.point.Y +12),new Point(temNum.point.X +6,temNum.point.Y +12));
     dc.DrawLine(new Pen(Brushes.Black ,1),new Point(CurrentNum.point.X+2 ,CurrentNum.point.Y +12),new Point(CurrentNum.point.X +6,CurrentNum.point.Y +12));
     break;
    case 34://向后移动光标
    case 35:
     index=this.CurrentNum.index+1;
     if(index>14)
     {
      index=14;
      this.Parent.SelectNextControl(this,true,false,false,true);
     }
     this.CurrentNum =this.numS[index];
     dc.DrawLine(new Pen(this.BackColor  ,1),new Point(temNum.point.X+2 ,temNum.point.Y +12),new Point(temNum.point.X +6,temNum.point.Y +12));
     dc.DrawLine(new Pen(Brushes.Black ,1),new Point(CurrentNum.point.X+2 ,CurrentNum.point.Y +12),new Point(CurrentNum.point.X +6,CurrentNum.point.Y +12));
     break;
    case 13://按回车键
     KeyEnter();
     break;
    case 8://退格键
     //case 46:
     if(this.readOnly )
      return;
     backButton(false,-1);
     break;
    case 48://0--9数字键
    case 49:
    case 50:
    case 51:
    case 52:
    case 53:
    case 54:
    case 55:
    case 56:
    case 57:
    case 96:
    case 97:
    case 98:
    case 99:
    case 100:
    case 101:
    case 102:
    case 103:
    case 104:
    case 105:
    {
     if(this.readOnly ) return;
     if(this.CurrentNum.index ==0) return;
     int num=0;
     if(code>=48 && code<=57) num=code-48;
     if(code>=96 && code<=105) num=code-96;
     this.backButton(true,num);
    }
     break;
    case 110://小数点
    case 190:
     dc.DrawLine(new Pen(this.BackColor ,1),new Point(this.CurrentNum.point.X+2 ,this.CurrentNum.point.Y +12),new Point(this.CurrentNum.point.X +6,this.CurrentNum.point.Y +12));
     this.CurrentNum=this.numS[13];
     break;
    case 109://负号
    case 189:
     if(this.readOnly ) return ;
     if(this.ZF )
      this.ZF =false;
     break;
    case 107://正号
    case 187:
     if(this.readOnly ) return ;
     if(!this.ZF)
      this.ZF =true;
     break;
     
   }
   
  }
  public virtual void KeyEnter()
  {
   this.Parent.SelectNextControl(this,true,false,false,true);
  }
  private void backButton(bool numORback,int num)
  {
   string temMoneyStr=this.moneyP.ToString();
   StringBuilder Zstr=new StringBuilder("");
   StringBuilder Lstr=new StringBuilder("");
   int s=0;
   s=temMoneyStr.IndexOf(".");
   if(s==-1)
   {
    if(this.moneyP ==0m && numORback==false)
     return;
    else
     Zstr.Append(temMoneyStr);
   }
   else
   {
    Zstr.Append(temMoneyStr.Substring(0,s));
    Lstr.Append(temMoneyStr.Substring(s+1,temMoneyStr.Length-s-1));
   }
   if(Lstr.ToString()=="") Lstr.Append("00");
   int b=0;string numStr=num.ToString();
   if(this.CurrentNum.index  >12)//小数部分
   {
    b=14-this.CurrentNum.index +1;
    Lstr.Remove(Lstr.Length -b,1);
    if(numORback)
    {
     if(this.CurrentNum.index==13)
     {
      this.CurrentNum =this.numS[14];
      this.upIndex =13;
      Lstr.Insert(0,num.ToString()); 
      Graphics dc=this.CreateGraphics();
      dc.DrawLine(new Pen(this.BackColor ,1),new Point(numS[13].point.X+2 ,numS[13].point.Y +12),new Point(numS[13].point.X +6,numS[13].point.Y +12));
     }
     else
     {
      Lstr.Append(num.ToString());
     }
    }
    string m=Lstr.ToString();
    m=m.PadRight(2,'0');
    Lstr.Replace(Lstr.ToString(),m);
   }
   else//整数部分
   {
    b=12-this.CurrentNum.index +1;
    if(!numORback)
    {
     if(b>Zstr.Length )
     {
      this.upIndex =this.CurrentNum.index ;
      this.CurrentNum=this.numS[13-Zstr.Length];
      Graphics dc=this.CreateGraphics();
      dc.DrawLine(new Pen(this.BackColor ,1),new Point(numS[this.upIndex].point.X+2 ,numS[this.upIndex].point.Y +12),new Point(numS[this.upIndex].point.X +6,numS[this.upIndex].point.Y +12));
      return;
     }
     Zstr.Remove(Zstr.Length -b, 1);
    }
    else
    {
     if(Zstr.Length>=12)
     {
      MessageBox.Show("输入的数字最大或最小只能是+-999,999,999,999.99!"+"/n"+"当前数目为:"+this.MoneyZF.ToString());
      return;
     }
     if(b>Zstr.Length)
     {
      numStr=numStr.PadRight(b-Zstr.Length,'0');                   
      numStr=numStr+Zstr.ToString();
      Zstr.Replace(Zstr.ToString(),numStr);
     }
     else
     {
      b=Zstr.Length-b+1;
      Zstr.Insert(b,num.ToString());
     }
    }
   }
   if(Zstr.ToString()=="") Zstr.Append("0");
   decimal money=this.moneyP ;
   try
   {
    money=Decimal.Parse(Zstr.ToString()+"."+Lstr.ToString());
   }
   catch
   {
    MessageBox.Show("输入的数目太大,无法处理!当前数目为"+this.moneyP.ToString());
   }
   this.Money =money;
   if(this.moneyP==0m)
   {
    numS[12].num ='0';numS[13].num ='0';numS[14].num ='0';
   }
   this.UnDisplayMoney();
   this.drawMoney(); 
  }
  private void MoneyControl_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
  {
   if(e.Button ==MouseButtons.Left )
   {
    this.upIndex =this.CurrentNum.index ;
    int i=(int)Math.Floor(e.X /8);
    this.CurrentNum =this.numS[i];
    Graphics dc=this.CreateGraphics();
    dc.DrawLine(new Pen(this.BackColor ,1),new Point(numS[this.upIndex].point.X+2 ,numS[this.upIndex].point.Y +12),new Point(numS[this.upIndex].point.X +6,numS[this.upIndex].point.Y +12));
    dc.DrawLine(new Pen(Brushes.Black ,1),new Point(CurrentNum.point.X+2 ,CurrentNum.point.Y +12),new Point(CurrentNum.point.X +6,CurrentNum.point.Y +12));
   }
  }
  private void UnDisplayMoney()
  {
   Graphics dc=this.CreateGraphics();
   Brush solidBrush=new SolidBrush(this.BackColor);
   for(int i=0;i<15;i++)
   {
    dc.FillRectangle(solidBrush,numS[i].point.X+1,numS[i].point.Y ,7,12);
   }
  }
  /// <summary>
  /// 显示金额
  /// </summary>
  public void DisplayMoney()
  {
   this.UnDisplayMoney();
   this.drawMoney();
  }
  //********************************************************
  public string MoneyWz()
  {
   return MoneyToWz(this.MoneyZF );
  }
  public static string MoneyToWz(decimal moneyT)
  {
   decimal tem=Math.Abs(moneyT);
   string fh="";
   if(moneyT<0) fh="负";
   string temStr=tem.ToString();
   int s=temStr.IndexOf(".");
   string Zstr="";
   string Lstr="";
   if(s==-1)
   {
    Zstr=temStr;
   }
   else
   {
    Zstr=temStr.Substring(0,s);
    Lstr=temStr.Substring(s+1,temStr.Length -s-1);
   }
   string[] Quan={"","万","亿","兆"};
   string[] WzP={"","拾","佰","仟"};
   string[] Moneynum=new string[Zstr.Length];
   if(Zstr.Length >12)
   {
    MessageBox.Show("数字太大,无法处理!");
    return "";
   }
   for(int i=0;i<Zstr.Length ;i++)
   {
    Moneynum[i]=Zstr[i].ToString();
   }
   Array.Reverse(WzP);
          
   int result=0;
   int q=Math.DivRem(Moneynum.Length,4,out result);
   if(q>3)
   {
    MessageBox.Show("超出处理范围!");
    return "超出处理范围!";
   }
   OperStr obj=new OperStr();
   string[] temYushou=new string[result];
   string[] temWzP=new string[result];
   Array.Copy(WzP,4-result,temWzP,0,result);
   Array.Copy(Moneynum,0,temYushou,0,result);
   for(int i=0;i<result ;i++)
   {
    OperStr temOb=new OperStr(temWzP[i],temYushou[i]);
    obj=obj+temOb;
   }
   if(obj.Tostring.Length >0)
   {
    if(obj.Tostring.Substring(obj.Tostring.Length-1,1)=="零")
     obj.Tostring=obj.Tostring.Remove(obj.Tostring.Length -1,1);
    obj.Tostring+=Quan[q];
   }

   for(int j=0;j<q;j++)
   {
    string[] temMoneynum=new string[4];
    Array.Copy(Moneynum,result+j*4,temMoneynum,0,4);
    StringBuilder temAll0=new StringBuilder("");
    for(int i=0;i<4 ;i++)
    {
     OperStr temObj=new OperStr(WzP[i],temMoneynum[i]);
     temAll0.Append(temObj.Tostring);
     obj=obj+temObj;
    }
    if(temAll0.ToString()!="零零零零")
    {
     if(obj.Tostring.Substring(obj.Tostring.Length-1,1)=="零")
      obj.Tostring=obj.Tostring.Remove(obj.Tostring.Length -1,1);
    
     obj.Tostring+=Quan[q-j-1];
    }
   }
   if(obj.Tostring.Length >1 && obj.Tostring.Substring(obj.Tostring.Length -1,1)=="零")
    obj.Tostring =obj.Tostring.Remove(obj.Tostring.Length-1,1);
   if(obj.Tostring =="")
    obj.Tostring ="零";

   if(Lstr!="" && Lstr!="00")
   {
    obj.Tostring+="点";
    OperStr temV=new OperStr();
    for(int i=0;i<Lstr.Length ;i++)
    {
     obj.Tostring+=temV.TurnWz(Lstr[i].ToString());
    }
   }
   obj.Tostring=fh+obj.Tostring;
   return obj.Tostring;   
  }
  class OperStr
  {
   string num="0123456789";
   string Num="零壹贰叁肆伍陆柒捌玖";
   string strQuan="";string strNum="";
   public string Tostring="";
   public OperStr(string strquan,string strnum)
   {
    this.strQuan =strquan;
    int s=0;
    s=num.IndexOf(strnum);
    this.strNum =this.Num[s].ToString();
    this.Tostring=this.SaveString();
   }
   public OperStr()
   {
   }
   public string TurnWz(string numP)
   {
    int s=0;
    s=this.num.IndexOf(numP);
    return this.Num[s].ToString();
   }
   private  string SaveString()
   {
    string temStr="";
    if(this.strNum =="零")
    {
     temStr="零";
    }
    else
    {
     temStr=this.strNum +this.strQuan;
    }
    return temStr;
   }
   public static OperStr operator+ (OperStr str1,OperStr str2)
   {
    OperStr temOperStr=new OperStr();
    if(str1.Tostring.Length ==0) return str2;
    string is0=str1.Tostring.Substring(str1.Tostring.Length-1,1);
    if(is0=="零" && str2.Tostring =="零")
    {
     temOperStr=str1;
    }
    else
    {
     temOperStr.Tostring =str1.Tostring+str2.Tostring;
    }               
    return temOperStr;
   }
  }
  public string ReadMe
  {
   get
   {
    string temStr=@"
作者:杨冬生Email yds127400@sohu.com
地址:东至县|东至华源纺织公司
控件名称:MoneyControl
命名空间:PzControl
用处 :将数字(类似金钱)显示在控件中,你可以输入输出并且可以将数字转换成文字!";

    return temStr;
   }
  }

 }
}

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值