// *********************************************************************** // Assembly : HZH_Controls // Created : 08-09-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 UCPagerControl. /// Implements the /// /// [ToolboxItem(true)] public partial class UCPagerControl : UCPagerControlBase { public override int PageCount { get { return base.PageCount; } set { base.PageCount = value; if (PageCount <= 1) { ShowBtn(false, false); } else { ShowBtn(false, PageCount > 1); } } } public override int PageIndex { get { return base.PageIndex; } set { base.PageIndex = value; if (PageCount <= 1) { ShowBtn(false, false); } else { ShowBtn(false, PageCount > 1); } } } /// /// Initializes a new instance of the class. /// public UCPagerControl() { InitializeComponent(); } /// /// Handles the MouseDown event of the panel1 control. /// /// The source of the event. /// The instance containing the event data. private void panel1_MouseDown(object sender, MouseEventArgs e) { PreviousPage(); } /// /// Handles the MouseDown event of the panel2 control. /// /// The source of the event. /// The instance containing the event data. private void panel2_MouseDown(object sender, MouseEventArgs e) { NextPage(); } /// /// Handles the MouseDown event of the panel3 control. /// /// The source of the event. /// The instance containing the event data. private void panel3_MouseDown(object sender, MouseEventArgs e) { FirstPage(); } /// /// Handles the MouseDown event of the panel4 control. /// /// The source of the event. /// The instance containing the event data. private void panel4_MouseDown(object sender, MouseEventArgs e) { EndPage(); } /// /// Shows the BTN. /// /// if set to true [BLN left BTN]. /// if set to true [BLN right BTN]. protected override void ShowBtn(bool blnLeftBtn, bool blnRightBtn) { panel1.Visible = panel3.Visible = blnLeftBtn; panel2.Visible = panel4.Visible = blnRightBtn; } } }