/// <summary> /// 主表格导航按钮的事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnSummaryNavigatorButtonClick(object sender, NavigatorButtonClickEventArgs e) { try { CCursor.ShowWaitCursor(); NavigatorButton btn = (NavigatorButton)e.Button; ControlNavigatorButtons buttons = ((ControlNavigator)sender).Buttons; if (e.Button == buttons.First) { DoMoveFirst(); } if (e.Button == buttons.Prev) { DoMovePrior(); } if (e.Button == buttons.Next) { DoMoveNext(); } if (e.Button == buttons.Last) { DoMoveLast(); } } finally { e.Handled = true; CCursor.ShowDefaultCursor(); } }
/// <summary> /// 设置表格控件的布局. 比如按钮设置. /// </summary> public static void SetGridControlLayout(GridControl grid, bool allowEdit) { ControlNavigatorButtons btns = grid.EmbeddedNavigator.Buttons; grid.BeginInit(); grid.EmbeddedNavigator.ButtonStyle = BorderStyles.Office2003; grid.UseEmbeddedNavigator = true; btns.Append.Visible = false; btns.CancelEdit.Visible = false; btns.Edit.Visible = false; btns.Remove.Visible = false; btns.EndEdit.Visible = false; btns.NextPage.Visible = false; btns.PrevPage.Visible = false; ((GridView)grid.Views[0]).OptionsBehavior.Editable = allowEdit; //允许编辑状态 if (allowEdit) //增加两个自定义按钮(ADD,INSERT,DELETE) { ImageList img = new ImageList(); img.Images.Add(Globals.LoadImage("16_Add.ico")); img.Images.Add(Globals.LoadImage("16_Insert.ico")); img.Images.Add(Globals.LoadImage("16_Delete.ico")); grid.EmbeddedNavigator.Buttons.ImageList = img; btns.CustomButtons.Clear(); NavigatorCustomButton btnDtlAdd = new NavigatorCustomButton((int)DetailButtons.Add, "新增记录"); NavigatorCustomButton btnDtlInsert = new NavigatorCustomButton((int)DetailButtons.Insert, "插入记录"); NavigatorCustomButton btnDtlDelete = new NavigatorCustomButton((int)DetailButtons.Delete, "删除记录"); btns.CustomButtons.AddRange(new NavigatorCustomButton[] { btnDtlAdd, btnDtlInsert, btnDtlDelete }); } grid.EndInit(); }
private void EquipmentForm_Load(object sender, EventArgs e) { // TODO: данная строка кода позволяет загрузить данные в таблицу "dataSetMain.EquipmentKinds". При необходимости она может быть перемещена или удалена. this.qEquipmentsTableAdapter.Fill(this.dataSetQuery.QEquipments); ControlNavigatorButtons cnb = controlNavigator1.Buttons; ControlNavigatorButtons cnb2 = controlNavigator2.Buttons; if (GridView.FocusedRowHandle < 0) { cnb.CustomButtons[0].Enabled = false;// cnb.Remove.Enabled; /*for (int i = 0; i < cnb2.CustomButtons.Count; i++) * { * cnb2.CustomButtons[i].Enabled = false; * }*/ } else { cnb.CustomButtons[0].Enabled = true; /*for (int i = 0; i < cnb2.CustomButtons.Count; i++) * { * cnb2.CustomButtons[i].Enabled = true; * }*/ } m_cnWidth = controlNavigator2.Size.Width / 6; }
private void CondenserForm_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'dataSetQuery.QCondensers' table. You can move, or remove it, as needed. this.qCondensersTableAdapter.Fill(this.dataSetQuery.QCondensers); if (Program.m_bExpertMode) { panelExpertMode.Visible = true; } else { panelExpertMode.Visible = false; } // TODO: данная строка кода позволяет загрузить данные в таблицу "dataSetMain.EquipmentKinds". При необходимости она может быть перемещена или удалена. listTestType.Add(new DataSourceString(1, "ресурсные")); listTestType.Add(new DataSourceString(2, "приемо-сдаточные")); listTestType.Add(new DataSourceString(3, "эксплуатация")); repTestType.DataSource = listTestType; repTestType.DisplayMember = "VAL"; repTestType.ValueMember = "KEY"; repTestType.DropDownRows = listTestType.Count; ControlNavigatorButtons cnb = controlNavigator1.Buttons; if (GridView.FocusedRowHandle < 0) { cnb.CustomButtons[0].Enabled = false;// cnb.Remove.Enabled; } else { cnb.CustomButtons[0].Enabled = true; } try { Graphics gr = this.CreateGraphics(); DpiXRel = gr.DpiX / 96.0f; DpiYRel = gr.DpiY / 96.0f; colCondenserState.MaxWidth = (int)(30 * DpiXRel); colCondenserState.MinWidth = (int)(30 * DpiXRel); /*foreach (GridColumn col in GridView.Columns) * { * GetColumnBestHeight(col); * } * SetMaxColumnHeights();*/ timer1.Enabled = true; } catch (Exception ex) { MyLocalizer.XtraMessageBoxShow("В программе произошла ошибка. Описание: " + ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void GridView_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { ControlNavigatorButtons cnb = controlNavigator1.Buttons; if (e.FocusedRowHandle < 0) { cnb.CustomButtons[0].Enabled = false;// cnb.Remove.Enabled; } else { cnb.CustomButtons[0].Enabled = true; } }
private void CheckForm_Load(object sender, EventArgs e) { this.qChecksTableAdapter.Fill(this.dataSetQuery.QChecks); ControlNavigatorButtons cnb = controlNavigator1.Buttons; if (GridView.FocusedRowHandle < 0) { cnb.CustomButtons[0].Enabled = false;// cnb.Remove.Enabled; } else { cnb.CustomButtons[0].Enabled = true; } }
public static void InitControlNavigatorButtons(ControlNavigatorButtons controlNavigatorButtons) { controlNavigatorButtons.First.Hint = "დასაწყისი"; controlNavigatorButtons.PrevPage.Hint = "წინა გვერდი"; controlNavigatorButtons.Prev.Hint = "წინა"; // controlNavigatorButtons.Next.Hint = "შემდეგი"; controlNavigatorButtons.NextPage.Hint = "შემდეგი გვერდი"; controlNavigatorButtons.Last.Hint = "ბოლო"; // controlNavigatorButtons.Append.Hint = "დამატება"; controlNavigatorButtons.Edit.Hint = "შეცვლა"; controlNavigatorButtons.Remove.Hint = "წაშლა"; controlNavigatorButtons.EndEdit.Hint = "ცვლილების დაფიქსირება"; controlNavigatorButtons.CancelEdit.Hint = "ცვლილების უარყოფა"; }
private void TestForm_Load(object sender, EventArgs e) { if (Program.m_bExpertMode) { panelExpertMode.Visible = true; } else { panelExpertMode.Visible = false; } this.qCondenserTestTableAdapter.Fill(this.dataSetQuery.QCondenserTest, m_CondenserID); listTestType.Add(new DataSourceString(1, "ресурсные")); listTestType.Add(new DataSourceString(2, "приемо-сдаточные")); listTestType.Add(new DataSourceString(3, "эксплуатация")); repTestType.DataSource = listTestType; repTestType.DisplayMember = "VAL"; repTestType.ValueMember = "KEY"; repTestType.DropDownRows = listTestType.Count; Graphics formGraphics = this.CreateGraphics(); DpiXRel = formGraphics.DpiX / 96.0f; DpiYRel = formGraphics.DpiY / 96.0f; SQLiteConnection connection_ = new SQLiteConnection(global::Condenser.Properties.Settings.Default.condenserConnectionString); connection_.Open(); SQLiteCommand com_ = new SQLiteCommand(connection_); com_.CommandText = "SELECT c.CondenserNumber, ct.CondenserTypeName FROM Condensers AS c " + "INNER JOIN CondenserTypes AS ct ON c.CondenserTypeID = ct.CondenserTypeID WHERE c.CondenserID = @id"; SQLiteParameter param1 = new SQLiteParameter("@id", DbType.Int64); param1.Value = m_CondenserID; com_.Parameters.Add(param1); com_.CommandType = CommandType.Text; SQLiteDataReader dr_ = com_.ExecuteReader(); string strCondenserTypeName = "", strCondenserNumber = ""; while (dr_.Read()) { strCondenserTypeName = Convert.ToString(dr_["CondenserTypeName"]); strCondenserNumber = Convert.ToString(dr_["CondenserNumber"]); } dr_.Close(); connection_.Close(); teEquipmentNumber.EditValue = strCondenserNumber; teEquipmentType.EditValue = strCondenserTypeName; /*foreach (GridColumn col in GridView.Columns) * { * GetColumnBestHeight(col); * } * SetMaxColumnHeights();*/ ControlNavigatorButtons cnb = controlNavigator1.Buttons; if (GridView.FocusedRowHandle < 0) { cnb.CustomButtons[0].Enabled = false; // cnb.Remove.Enabled; cnb.CustomButtons[1].Enabled = false; // cnb.Remove.Enabled; } else { cnb.CustomButtons[0].Enabled = true; cnb.CustomButtons[1].Enabled = true; } if (!Program.m_bExpertMode) { bandCH3OH.Visible = false; bandCO2_CO.Visible = false; } for (int i = 0; i < GridView.Bands.Count; i++) { GridView.Bands[i].Width = (int)(GridView.Bands[i].Width * formGraphics.DpiX / 96); } //BandedGridViewInfo viewInfo = GridView.GetViewInfo() as BandedGridViewInfo; Size captionSize = GridView.Appearance.BandPanel.CalcTextSize(formGraphics, "www", 1000).ToSize(); m_singleLineHeight = captionSize.Height;// viewInfo.BandRowHeight; //DevExpress.Utils.AppearanceObject[] styles = {GridView.Appearance.BandPanel}; //m_singleLineHeight = viewInfo.CalcMaxHeight(styles); //int ii = viewInfo.ColumnRowHeight; SetBandsHeight(); colCondenserState.MaxWidth = (int)(30 * DpiXRel); colCondenserState.MinWidth = (int)(30 * DpiXRel); m_bDataLoadEnd = true; }
private void GridView_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { ControlNavigatorButtons cnb = controlNavigator1.Buttons; ControlNavigatorButtons cnb2 = controlNavigator2.Buttons; if (e.FocusedRowHandle < 0) { cnb.CustomButtons[0].Enabled = false;// cnb.Remove.Enabled; controlNavigator2.Visible = false; /*for (int i = 0; i < cnb2.CustomButtons.Count; i++) * { * cnb2.CustomButtons[i].Enabled = false; * }*/ } else { cnb.CustomButtons[0].Enabled = true; // проверяем существование обследований для типа Equipment.EquipmentKind EquipmentKindID = (Equipment.EquipmentKind)Convert.ToInt64(GridView.GetRowCellValue(GridView.FocusedRowHandle, "EquipmentKindID")); controlNavigator2.Visible = true; for (int i = 0; i < cnb2.CustomButtons.Count; i++) { Inspection.InspectionType type = Inspection.InspectionType.Visual; if (cnb2.CustomButtons[i].Tag.ToString() == "Visual") { type = Inspection.InspectionType.Visual; } if (cnb2.CustomButtons[i].Tag.ToString() == "FHA") { type = Inspection.InspectionType.FHA; } if (cnb2.CustomButtons[i].Tag.ToString() == "HARG") { type = Inspection.InspectionType.HARG; } if (cnb2.CustomButtons[i].Tag.ToString() == "Warm") { type = Inspection.InspectionType.Warm; } if (cnb2.CustomButtons[i].Tag.ToString() == "Vibro") { type = Inspection.InspectionType.Vibro; } if (cnb2.CustomButtons[i].Tag.ToString() == "Parameter") { type = Inspection.InspectionType.Parameter; } if (cnb2.CustomButtons[i].Tag.ToString() == "Electrical") { type = Inspection.InspectionType.Electrical; } if (Inspection.m_listEquipmentInspections[EquipmentKindID].IndexOf(type) >= 0) { cnb2.CustomButtons[i].Visible = true; } else { cnb2.CustomButtons[i].Visible = false; } } controlNavigator2.Width = Inspection.m_listEquipmentInspections[EquipmentKindID].Count * m_cnWidth; } }
private void InspectionForm_Load(object sender, EventArgs e) { pGreen.BackColor = Color.Green; pYellow.BackColor = Color.Yellow; pOrange.BackColor = Color.Orange; pRed.BackColor = Color.Red; pGray.BackColor = Color.DarkGray; pBlack.BackColor = Color.Black; // TODO: This line of code loads data into the 'dataSetInspection.Inspections' table. You can move, or remove it, as needed. this.qInspectionsTableAdapter.Fill(this.dataSetQuery.QInspections, m_EquipmentID, (long)m_type); LoadData(); CreateGrid(); RefreshData(); ControlNavigatorButtons cnb = controlNavigator1.Buttons; if (GridView.FocusedRowHandle < 0) { cnb.CustomButtons[0].Enabled = false;// cnb.Remove.Enabled; } else { cnb.CustomButtons[0].Enabled = true; } switch (m_type) { case Inspection.InspectionType.Visual: gcInspectionTime.Text = "Список визуальных обследований"; Text = "Визуальные обследования"; break; case Inspection.InspectionType.HARG: gcInspectionTime.Text = "Список обследований ХАРГ"; Text = "ХАРГ"; break; case Inspection.InspectionType.FHA: gcInspectionTime.Text = "Список обследований ФХА"; Text = "ФХА"; break; case Inspection.InspectionType.Warm: gcInspectionTime.Text = "Список тепловизионных обследований"; Text = "Тепловизионные обследования"; break; case Inspection.InspectionType.Vibro: gcInspectionTime.Text = "Список вибрационных обследований"; Text = "Вибрационные обследования"; break; case Inspection.InspectionType.Parameter: gcInspectionTime.Text = "Список определений характеристик выключателя"; Text = "Определение характеристик выключателя"; break; case Inspection.InspectionType.Electrical: gcInspectionTime.Text = "Список электрических измерений выключателя"; Text = "Электрические измерения выключателя"; break; default: break; } m_bDataLoadEnd = true; }