FormSelectRow.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using Tofly.Core.Stereotype;
  11. using Tofly.CoreUI.Win.Form.Forms;
  12. namespace Tofly.SearchUI.Win
  13. {
  14. /// <summary>
  15. /// 选择数量窗体
  16. /// </summary>
  17. [Component(IsSingleton = "false", Name = "FormSelectRow")]
  18. public partial class FormSelectRow : FormClass, ISelectRowForm
  19. {
  20. public FormSelectRow()
  21. {
  22. InitializeComponent();
  23. this.Load += FormSelectRow_Load;
  24. }
  25. #region ISelectRowForm 接口
  26. public int PageSize
  27. {
  28. get;set;
  29. }
  30. public int RowCount
  31. {
  32. get;set;
  33. }
  34. public int SelectPageIndex
  35. {
  36. get;set;
  37. }
  38. #endregion
  39. private void FormSelectRow_Load(object sender, EventArgs e)
  40. {
  41. comboBoxRows.DropDownStyle = ComboBoxStyle.DropDownList;
  42. if (RowCount == 0 || PageSize == 0) return;
  43. int _pageCount = RowCount/PageSize + 1;
  44. for (int i = 0; i < _pageCount; i++)
  45. {
  46. string _showText = string.Format("{0}-{1}", i*PageSize, (i + 1)*PageSize);
  47. comboBoxRows.Items.Add(_showText);
  48. }
  49. }
  50. private void buttonOK_Click(object sender, EventArgs e)
  51. {
  52. if (comboBoxRows.SelectedIndex < 0) return;
  53. SelectPageIndex = comboBoxRows.SelectedIndex;
  54. DialogResult = CoreUI.Control.DialogResult.OK;
  55. this.Close();
  56. }
  57. private void buttonCancel_Click(object sender, EventArgs e)
  58. {
  59. DialogResult = CoreUI.Control.DialogResult.Cancel;
  60. this.Close();
  61. }
  62. }
  63. }