diff --git a/SunnyUI.Demo/Controls/FDataGridView.Designer.cs b/SunnyUI.Demo/Controls/FDataGridView.Designer.cs index 359a0052..5273ee8f 100644 --- a/SunnyUI.Demo/Controls/FDataGridView.Designer.cs +++ b/SunnyUI.Demo/Controls/FDataGridView.Designer.cs @@ -80,7 +80,6 @@ this.uiDataGridView1.Location = new System.Drawing.Point(0, 0); this.uiDataGridView1.MultiSelect = false; this.uiDataGridView1.Name = "uiDataGridView1"; - this.uiDataGridView1.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); this.uiDataGridView1.RowHeadersVisible = false; dataGridViewCellStyle4.BackColor = System.Drawing.Color.White; this.uiDataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle4; @@ -90,11 +89,10 @@ this.uiDataGridView1.ShowRect = false; this.uiDataGridView1.Size = new System.Drawing.Size(861, 380); this.uiDataGridView1.TabIndex = 0; - this.uiDataGridView1.TagString = null; // // uiPagination1 // - this.uiPagination1.ActivePage = 500; + this.uiPagination1.ActivePage = 50; this.uiPagination1.CausesValidation = false; this.uiPagination1.Dock = System.Windows.Forms.DockStyle.Bottom; this.uiPagination1.Font = new System.Drawing.Font("微软雅黑", 12F); @@ -102,6 +100,7 @@ this.uiPagination1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.uiPagination1.Name = "uiPagination1"; this.uiPagination1.PagerCount = 11; + this.uiPagination1.PageSize = 50; this.uiPagination1.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.None; this.uiPagination1.Size = new System.Drawing.Size(861, 35); this.uiPagination1.TabIndex = 1; diff --git a/SunnyUI.Demo/Controls/FListBox.Designer.cs b/SunnyUI.Demo/Controls/FListBox.Designer.cs index ee41e37e..ae31af34 100644 --- a/SunnyUI.Demo/Controls/FListBox.Designer.cs +++ b/SunnyUI.Demo/Controls/FListBox.Designer.cs @@ -119,6 +119,7 @@ this.uiButton1.TabIndex = 23; this.uiButton1.Text = "Add Item"; this.uiButton1.Click += new System.EventHandler(this.uiButton1_Click); + this.uiButton1.DoubleClick += new System.EventHandler(this.uiButton1_DoubleClick); // // FListBox // diff --git a/SunnyUI.Demo/Controls/FListBox.cs b/SunnyUI.Demo/Controls/FListBox.cs index b84ea93b..1165bbf7 100644 --- a/SunnyUI.Demo/Controls/FListBox.cs +++ b/SunnyUI.Demo/Controls/FListBox.cs @@ -13,7 +13,7 @@ namespace Sunny.UI.Demo public override void Init() { uiListBox1.Items.Clear(); - for (int i = 0; i < 20; i++) + for (int i = 0; i < 50; i++) { uiListBox1.Items.Add(i); } @@ -49,5 +49,11 @@ namespace Sunny.UI.Demo uiListBox1.Items.Add(DateTime.Now.ToString("yyyyMMdd") + "_" + num); num++; } + + private void uiButton1_DoubleClick(object sender, EventArgs e) + { + uiListBox1.Items.Add(DateTime.Now.ToString("yyyyMMdd") + "_double_" + num); + num++; + } } } \ No newline at end of file diff --git a/SunnyUI/Controls/UIButton.cs b/SunnyUI/Controls/UIButton.cs index 64aa9332..f78e4ed0 100644 --- a/SunnyUI/Controls/UIButton.cs +++ b/SunnyUI/Controls/UIButton.cs @@ -55,6 +55,7 @@ namespace Sunny.UI fillHoverColor = UIStyles.Blue.ButtonFillHoverColor; fillPressColor = UIStyles.Blue.ButtonFillPressColor; fillSelectedColor = UIStyles.Blue.ButtonFillSelectedColor; + SetStyle(ControlStyles.StandardDoubleClick, UseDoubleClick); } private bool isClick; @@ -76,6 +77,27 @@ namespace Sunny.UI base.OnClick(e); } + private bool useDoubleClick = false; + + [Description("是否启用双击事件"), Category("SunnyUI")] + [DefaultValue(false)] + public bool UseDoubleClick + { + get + { + return useDoubleClick; + } + set + { + if (useDoubleClick != value) + { + useDoubleClick = value; + SetStyle(ControlStyles.StandardDoubleClick, value); + Invalidate(); + } + } + } + private bool showTips = false; [Description("是否显示角标"), Category("SunnyUI")] @@ -382,12 +404,22 @@ namespace Sunny.UI { if (Focused && e.KeyCode == Keys.Space) { + IsPress = true; + Invalidate(); PerformClick(); } base.OnKeyDown(e); } + protected override void OnKeyUp(KeyEventArgs e) + { + IsPress = false; + Invalidate(); + + base.OnKeyUp(e); + } + [DefaultValue(false)] [Description("显示激活时边框线"), Category("SunnyUI")] public bool ShowFocusLine { get; set; } diff --git a/SunnyUI/Controls/UIImageListBox.cs b/SunnyUI/Controls/UIImageListBox.cs index ebc191bb..de7b6e8f 100644 --- a/SunnyUI/Controls/UIImageListBox.cs +++ b/SunnyUI/Controls/UIImageListBox.cs @@ -321,7 +321,14 @@ namespace Sunny.UI protected override void OnSizeChanged(EventArgs e) { - SetScrollInfo(); + if (Bar != null && Bar.Visible) + { + if (Bar.Value != 0) + { + ScrollBarInfo.SetScrollValue(Handle, Bar.Value); + } + } + //SetScrollInfo(); } public void SetScrollInfo() @@ -379,22 +386,19 @@ namespace Sunny.UI { base.OnMouseWheel(e); - if (Bar.Visible) + if (Bar != null && Bar.Visible) { var si = ScrollBarInfo.GetInfo(Handle); + int temp = Math.Abs(e.Delta / 120); if (e.Delta > 10) { - if (si.nPos > 0) - { - ScrollBarInfo.ScrollUp(Handle); - } + int nposnum = si.nPos - temp * SystemInformation.MouseWheelScrollLines; + ScrollBarInfo.SetScrollValue(Handle, nposnum >= si.nMin ? nposnum : 0); } else if (e.Delta < -10) { - if (si.nPos < si.ScrollMax) - { - ScrollBarInfo.ScrollDown(Handle); - } + int nposnum = si.nPos + temp * SystemInformation.MouseWheelScrollLines; + ScrollBarInfo.SetScrollValue(Handle, nposnum <= si.nMax ? nposnum : si.nMax); } } diff --git a/SunnyUI/Controls/UIListBox.cs b/SunnyUI/Controls/UIListBox.cs index 63b57ced..086b9589 100644 --- a/SunnyUI/Controls/UIListBox.cs +++ b/SunnyUI/Controls/UIListBox.cs @@ -395,17 +395,19 @@ namespace Sunny.UI if (Bar != null && Bar.Visible) { var si = ScrollBarInfo.GetInfo(Handle); + int temp = Math.Abs(e.Delta / 120); if (e.Delta > 10) { - ScrollBarInfo.SetScrollValue(Handle, (si.nPos - SystemInformation.MouseWheelScrollLines) >= si.nMin ? si.nPos - SystemInformation.MouseWheelScrollLines : 0); + int nposnum = si.nPos - temp * SystemInformation.MouseWheelScrollLines; + ScrollBarInfo.SetScrollValue(Handle, nposnum >= si.nMin ? nposnum : 0); } else if (e.Delta < -10) { - ScrollBarInfo.SetScrollValue(Handle, (si.nPos + SystemInformation.MouseWheelScrollLines) <= si.nMax ? (si.nPos + SystemInformation.MouseWheelScrollLines) : si.nMax); + int nposnum = si.nPos + temp * SystemInformation.MouseWheelScrollLines; + ScrollBarInfo.SetScrollValue(Handle, nposnum <= si.ScrollMax ? nposnum : si.ScrollMax); } + SetScrollInfo(); } - - SetScrollInfo(); } public void SetStyle(UIStyle style) diff --git a/SunnyUI/Controls/UIPagination.cs b/SunnyUI/Controls/UIPagination.cs index d970dceb..a083dc94 100644 --- a/SunnyUI/Controls/UIPagination.cs +++ b/SunnyUI/Controls/UIPagination.cs @@ -703,8 +703,24 @@ namespace Sunny.UI edtPage.HasMaximum = true; edtPage.Maximum = PageCount; - if (activePage > PageCount) activePage = PageCount; - if (activePage < 1) activePage = 1; + if (activePage >= PageCount) + { + activePage = PageCount; + b16.Enabled = false; + } + else + { + b16.Enabled = true; + } + if (activePage <= 1) + { + activePage = 1; + b0.Enabled = false; + } + else + { + b0.Enabled = true; + } edtPage.IntValue = activePage; if (TotalCount == 0)