//-----------------------CONTROLS----------------------------------/ private void timeEdit_Spin(object sender, DevExpress.XtraEditors.Controls.SpinEventArgs e) { var timeEdit = sender as TimeEdit; var minuteStart = timeEdit.Text.IndexOf(":") + 1; if (timeEdit.SelectionStart == minuteStart) { e.Handled = true; var time = timeEdit.Time; var minuteIncrement = 15; int minute = time.AddMinutes((e.IsSpinUp ? 1 : -1) * minuteIncrement).Minute; if (minute >= 45) { minute = 45; } else if (minute >= 30) { minute = 30; } else if (minute >= 15) { minute = 15; } else { minute = 0; } var selectionStart = timeEdit.SelectionStart; var selectionLength = timeEdit.SelectionLength; timeEdit.Time = new DateTime(time.Year, time.Month, time.Day, time.Hour, minute, time.Second); timeEdit.SelectionStart = selectionStart; timeEdit.SelectionLength = selectionLength; } }
/// <summary> /// Customize SpinEdit up/down behavior based on increment step. /// For example, when increment step is 5, and current value is 13: /// Click up button will set the value to 15, click down button will set valut to 10. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void integer_Spin(object sender, DevExpress.XtraEditors.Controls.SpinEventArgs e) { SpinEdit spin = sender as SpinEdit; int divisor = 5; int compliment = 0; int percent = 1; if (spin.Properties.Increment < 1) { //The value of spin is percentage. percent = 100; } divisor = (int)(spin.Properties.Increment * percent); compliment = (int)(spin.Value * percent) % divisor; if (compliment > 0) { if (e.IsSpinUp) { int result = (int)(spin.Value * percent) - compliment; spin.Value = result / percent; //spin.Value -= (compliment / percent); } else { //This event is earlier than default spin actions. int result = (int)(spin.Value * percent) + divisor - compliment; spin.Value = result / percent; //spin.Value += ((divisor - compliment) / percent); } } }
protected override void OnSpin(DevExpress.XtraEditors.Controls.SpinEventArgs e) { if (this.Properties.Mask.MaskType == DevExpress.XtraEditors.Mask.MaskType.Numeric) { this.Enabled = false; } base.OnSpin(e); this.Enabled = true; }
protected override void OnSpin(DevExpress.XtraEditors.Controls.SpinEventArgs e) { this.exactValue = null; if (CoreValue != null && !Properties.IsWithinAllowedLimits((int)CoreValue.Value)) { CoreValue = Properties.DefaultValue; } else { base.OnSpin(e); } DoValidate(); }
private void repositoryItemSpinEdit1_Spin(object sender, DevExpress.XtraEditors.Controls.SpinEventArgs e) { string _sMonth = ProdmonthEdit.EditValue.ToString().Substring(4, 2); int _iMonth = Convert.ToInt32(ProdmonthEdit.EditValue.ToString().Substring(4, 2)); int Year = Convert.ToInt32(ProdmonthEdit.EditValue.ToString().Substring(0, 4)); if (_iMonth >= 12) { Year = Year + 1; _sMonth = "01"; ProdmonthEdit.EditValue = Convert.ToString(Year) + _sMonth; } if (_iMonth <= 1) { Year = Year - 1; _sMonth = "12"; ProdmonthEdit.EditValue = Year.ToString() + _sMonth; } //return; MWDataManager.clsDataAccess _dbManWP = new MWDataManager.clsDataAccess(); _dbManWP.ConnectionString = TConnections.GetConnectionString(theSystemDBTag, UserCurrentInfo.Connection); _dbManWP.SqlStatement = "Select distinct s1.ReportToSectionid+':'+s2.name Section from section s, section s1 , section s2 \r\n" + "where s.Prodmonth = s1.Prodmonth and s.ReportToSectionid = s1.SectionID \r\n" + "and s1.Prodmonth = s2.Prodmonth and s1.ReportToSectionid = s2.SectionID \r\n" + "and s.Prodmonth = '" + ProdmonthEdit.EditValue.ToString() + "' "; _dbManWP.queryExecutionType = MWDataManager.ExecutionType.GeneralSQLStatement; _dbManWP.queryReturnType = MWDataManager.ReturnType.DataTable; _dbManWP.ExecuteInstruction(); DataTable dt = _dbManWP.ResultsDataTable; repositoryItemComboBox1.Items.Clear(); foreach (DataRow dr in dt.Rows) { repositoryItemComboBox1.Items.Add(dr["Section"].ToString()); } SectionEdit.EditValue = repositoryItemComboBox1.Items[0].ToString(); }
private void repositoryItemSpinEdit2_Spin(object sender, DevExpress.XtraEditors.Controls.SpinEventArgs e) { e.Handled = true; }
private void spMaximumAge_Spin(object sender, DevExpress.XtraEditors.Controls.SpinEventArgs e) { e.Handled = true; }
void edit_Spin(object sender, DevExpress.XtraEditors.Controls.SpinEventArgs e) { e.Handled = true; }
protected override void OnSpin(DevExpress.XtraEditors.Controls.SpinEventArgs e) { this.Enabled = false; base.OnSpin(e); this.Enabled = true; }
//const int WM_MOUSEWHEEL = 0x20A; //protected override void WndProc(ref System.Windows.Forms.Message msg) { // if (msg.Msg == WM_MOUSEWHEEL) { // return; // } // //System.Windows.Forms.MessageBox.Show("OK"); // base.WndProc(ref msg); //} //protected override void OnMouseWheel(System.Windows.Forms.MouseEventArgs e) { // //base.OnMouseWheel(e); //} //取消滚轮 增 减 protected override void OnSpin(DevExpress.XtraEditors.Controls.SpinEventArgs e) { e.Handled = true; base.OnSpin(e); }
private void slkup_Properties_Spin(object sender, DevExpress.XtraEditors.Controls.SpinEventArgs e) { SearchLookUpEdit edito = (SearchLookUpEdit)sender; edito.ShowPopup(); }