// *********************************************************************** // Assembly : HZH_Controls // Created : 08-08-2019 // // *********************************************************************** // // Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com // // // Blog: https://www.cnblogs.com/bfyx // GitHub:https://github.com/kwwwvagaa/NetWinformControl // gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git // // If you use this code, please keep this note. // *********************************************************************** using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; namespace HZH_Controls.Controls { /// /// Class UCKeyBorderPay. /// Implements the /// /// public partial class UCKeyBorderPay : UserControl { /// /// Occurs when [number click]. /// [Description("数字点击事件"), Category("自定义")] public event EventHandler NumClick; /// /// Occurs when [cancel click]. /// [Description("取消点击事件"), Category("自定义")] public event EventHandler CancelClick; /// /// Occurs when [ok click]. /// [Description("确定点击事件"), Category("自定义")] public event EventHandler OKClick; /// /// Occurs when [backspace click]. /// [Description("删除点击事件"), Category("自定义")] public event EventHandler BackspaceClick; /// /// Occurs when [money click]. /// [Description("金额点击事件"), Category("自定义")] public event EventHandler MoneyClick; /// /// Initializes a new instance of the class. /// public UCKeyBorderPay() { InitializeComponent(); } #region 设置快速付款金额 /// /// 功能描述:设置快速付款金额 /// 作  者:HZH /// 创建日期:2019-03-07 11:41:04 /// 任务编号:POS /// /// SorceMoney public void SetPayMoney(decimal SorceMoney) { List list = new List(); decimal d = Math.Ceiling(SorceMoney); if (SorceMoney > 0m) { if (SorceMoney < 5m) { list.Add(5m); list.Add(10m); list.Add(20m); list.Add(50m); } else if (SorceMoney < 10m) { list.Add(10m); list.Add(20m); list.Add(50m); list.Add(100m); } else { int num = Convert.ToInt32(d % 10m); int num2 = Convert.ToInt32(Math.Floor(d / 10m) % 10m); int num3 = Convert.ToInt32(Math.Floor(d / 100m)); int num4; if (num < 5) { num4 = num2 * 10 + 5; list.Add(num4 + num3 * 100); num4 = (num2 + 1) * 10; list.Add(num4 + num3 * 100); } else { num4 = (num2 + 1) * 10; list.Add(num4 + num3 * 100); } if (num4 >= 0 && num4 < 10) { num4 = 10; if (list.Count < 4) { list.Add(num4 + num3 * 100); } num4 = 20; if (list.Count < 4) { list.Add(num4 + num3 * 100); } num4 = 50; if (list.Count < 4) { list.Add(num4 + num3 * 100); } num4 = 100; if (list.Count < 4) { list.Add(num4 + num3 * 100); } } else if (num4 >= 10 && num4 < 20) { num4 = 20; if (list.Count < 4) { list.Add(num4 + num3 * 100); } num4 = 50; if (list.Count < 4) { list.Add(num4 + num3 * 100); } num4 = 100; if (list.Count < 4) { list.Add(num4 + num3 * 100); } } else if (num4 >= 20 && num4 < 50) { num4 = 50; if (list.Count < 4) { list.Add(num4 + num3 * 100); } num4 = 100; if (list.Count < 4) { list.Add(num4 + num3 * 100); } } else if (num4 < 100) { num4 = 100; if (list.Count < 4) { list.Add(num4 + num3 * 100); } } } } SetFastMoneyToContrl(list); } #endregion /// /// Sets the fast money to contrl. /// /// The values. private void SetFastMoneyToContrl(List values) { List