/// <summary> /// 控件添加方法 /// </summary> public override void OnAdd() { base.OnAdd(); if (m_layoutDiv == null) { m_layoutDiv = new LayoutDivA(); m_layoutDiv.BorderColor = COLOR.EMPTY; m_layoutDiv.LayoutStyle = LayoutStyleA.LeftToRight; m_layoutDiv.AutoWrap = true; AddControl(m_layoutDiv); } if (m_shrinkBtn == null) { m_shrinkBtn = new RibbonButton2(); m_shrinkBtn.Font = new FONT("微软雅黑", 12, false, false, false); m_clickButtonEvent = new ControlMouseEvent(ClickButton); m_shrinkBtn.RegisterEvent(m_clickButtonEvent, EVENTID.CLICK); AddControl(m_shrinkBtn); } if (m_titleLabel == null) { m_titleLabel = new LabelA(); m_titleLabel.Font = new FONT("微软雅黑", 16, true, false, false); AddControl(m_titleLabel); } }
/// <summary> /// 注册事件 /// </summary> /// <param name="control">控件</param> private void RegisterEvents(ControlA control) { ControlMouseEvent clickButtonEvent = new ControlMouseEvent(ClickButton); List <ControlA> controls = control.GetControls(); int controlsSize = controls.Count; for (int i = 0; i < controlsSize; i++) { ControlA subControl = controls[i]; ButtonA button = subControl as ButtonA; GridA grid = subControl as GridA; if (button != null) { button.RegisterEvent(clickButtonEvent, EVENTID.CLICK); } else if (grid != null) { GridRowStyle rowStyle = new GridRowStyle(); grid.RowStyle = rowStyle; rowStyle.BackColor = COLOR.EMPTY; rowStyle.SelectedBackColor = CDraw.PCOLORS_SELECTEDROWCOLOR; rowStyle.HoveredBackColor = CDraw.PCOLORS_HOVEREDROWCOLOR; } RegisterEvents(controls[i]); } }
/// 注册事件 /// </summary> /// <param name="control">控件</param> private void RegisterEvents(ControlA control) { ControlMouseEvent clickButtonEvent = new ControlMouseEvent(ClickEvent); List <ControlA> controls = control.GetControls(); int controlsSize = controls.Count; for (int i = 0; i < controlsSize; i++) { ControlA subControl = controls[i]; ButtonA button = subControl as ButtonA; GridColumn column = subControl as GridColumn; GridA grid = subControl as GridA; CheckBoxA checkBox = subControl as CheckBoxA; if (column != null) { column.AllowResize = true; column.BackColor = CDraw.PCOLORS_BACKCOLOR; column.BorderColor = CDraw.PCOLORS_LINECOLOR2; column.ForeColor = CDraw.PCOLORS_FORECOLOR; } else if (checkBox != null) { checkBox.ButtonBackColor = CDraw.PCOLORS_BACKCOLOR; } else if (button != null) { button.RegisterEvent(clickButtonEvent, EVENTID.CLICK); } else if (grid != null) { grid.BackColor = COLOR.EMPTY; grid.GridLineColor = CDraw.PCOLORS_LINECOLOR2; GridRowStyle rowStyle = new GridRowStyle(); grid.RowStyle = rowStyle; rowStyle.BackColor = COLOR.EMPTY; rowStyle.SelectedBackColor = CDraw.PCOLORS_SELECTEDROWCOLOR; rowStyle.HoveredBackColor = CDraw.PCOLORS_HOVEREDROWCOLOR; grid.HorizontalOffset = grid.Width; grid.UseAnimation = true; } else { if (subControl.GetControlType() == "Div" || subControl.GetControlType() == "TabControl" || subControl.GetControlType() == "TabPage" || subControl.GetControlType() == "SplitLayoutDiv") { subControl.BackColor = COLOR.EMPTY; } } RegisterEvents(controls[i]); } }
/// 注册事件 /// </summary> /// <param name="control">控件</param> private void RegisterEvents(ControlA control) { ControlMouseEvent clickButtonEvent = new ControlMouseEvent(ClickButton); List <ControlA> controls = control.GetControls(); int controlsSize = controls.Count; for (int i = 0; i < controlsSize; i++) { ControlA subControl = controls[i]; ButtonA button = controls[i] as ButtonA; LinkLabelA linkLabel = subControl as LinkLabelA; GridColumn column = subControl as GridColumn; GridA grid = subControl as GridA; CheckBoxA checkBox = subControl as CheckBoxA; if (column != null) { column.AllowDrag = true; column.AllowResize = true; column.BackColor = CDraw.PCOLORS_BACKCOLOR; column.Font = new FONT("微软雅黑", 12, false, false, false); column.ForeColor = CDraw.PCOLORS_FORECOLOR; } else if (button != null) { button.RegisterEvent(clickButtonEvent, EVENTID.CLICK); } else if (linkLabel != null) { linkLabel.RegisterEvent(clickButtonEvent, EVENTID.CLICK); } else if (grid != null) { grid.GridLineColor = COLOR.CONTROLBORDER; grid.RowStyle.HoveredBackColor = CDraw.PCOLORS_HOVEREDROWCOLOR; grid.RowStyle.SelectedBackColor = CDraw.PCOLORS_SELECTEDROWCOLOR; grid.RowStyle.SelectedForeColor = CDraw.PCOLORS_FORECOLOR4; grid.RowStyle.Font = new FONT("微软雅黑", 12, false, false, false); GridRowStyle alternateRowStyle = new GridRowStyle(); alternateRowStyle.BackColor = CDraw.PCOLORS_ALTERNATEROWCOLOR; alternateRowStyle.HoveredBackColor = CDraw.PCOLORS_HOVEREDROWCOLOR; alternateRowStyle.SelectedBackColor = CDraw.PCOLORS_SELECTEDROWCOLOR; alternateRowStyle.SelectedForeColor = CDraw.PCOLORS_FORECOLOR4; alternateRowStyle.Font = new FONT("微软雅黑", 12, false, false, false); grid.AlternateRowStyle = alternateRowStyle; grid.UseAnimation = true; } RegisterEvents(controls[i]); } }
/// <summary> /// 注册事件 /// </summary> /// <param name="control">控件</param> private void RegisterEvents(ControlA control) { ControlMouseEvent clickButtonEvent = new ControlMouseEvent(ClickButton); List <ControlA> controls = control.GetControls(); int controlsSize = controls.Count; for (int i = 0; i < controlsSize; i++) { ButtonA button = controls[i] as ButtonA; if (button != null) { button.RegisterEvent(clickButtonEvent, EVENTID.CLICK); } RegisterEvents(controls[i]); } }
/// <summary> /// 创建界面 /// </summary> /// <param name="native">方法库</param> public FilterWindow(INativeBase native, SearchWindow search) { Load(native, "FilterWindow", "collection"); //注册点击事件 RegisterEvents(m_window); m_id = GetLabel("Label1"); m_title = GetLabel("Label2"); m_developer = GetLabel("Label3"); m_published = GetLabel("Label4"); m_closeTask = GetLabel("Label5"); m_developePass = GetLabel("Label6"); m_productPass = GetLabel("Label7"); m_testPass = GetLabel("Label8"); m_waitPublish = GetLabel("Label9"); m_endTime = GetLabel("Label10"); m_startTime = GetLabel("Label11"); m_planName = GetLabel("Label12"); m_dtpStart = GetDatePicker("dtpStartDate"); m_dtpEnd = GetDatePicker("dtpEndDate"); m_cbDevelopePass = GetComboBox("cbDeveloperPass"); m_cbTestPass = GetComboBox("cbTestPass"); m_cbProductPass = GetComboBox("cbProductPass"); m_cbWaitPublish = GetComboBox("cbWaitPublish"); m_cbCloseTask = GetComboBox("cbCloseTask"); m_cbPublished = GetComboBox("cbPublished"); m_cbStartDate = GetComboBox("cbStartDate"); m_cbEndDate = GetComboBox("cbEndDate"); m_txtId = GetTextBox("txtJiraID"); m_txtTitle = GetTextBox("txtTitle"); m_txtDeveloper = GetTextBox("txtDeveloper"); m_txtPlanName = GetTextBox("txtName"); m_txtCustomExpression = GetTextBox("rtbCustomExpression"); m_cbIgnoreStartDate = GetCheckBox("cbIgnoreStartDate"); //代理注册点击事件 ControlMouseEvent clickButtonEvent = new ControlMouseEvent(CheckedChangedEvent); m_cbIgnoreStartDate.RegisterEvent(clickButtonEvent, EVENTID.CLICK); m_cbIgnoreEndDate = GetCheckBox("cbIgnoreEndDate"); m_cbIgnoreEndDate.RegisterEvent(clickButtonEvent, EVENTID.CLICK); m_search = search; }
/// <summary> /// 注册事件 /// </summary> /// <param name="control">控件</param> private void RegisterEvents(ControlA control) { ControlMouseEvent clickButtonEvent = new ControlMouseEvent(ClickButton); ControlEvent selectedIndexChangedEvent = new ControlEvent(ComboBoxSelectedIndexChanged); List <ControlA> controls = control.GetControls(); int controlsSize = controls.Count; for (int i = 0; i < controlsSize; i++) { ControlA subControl = controls[i]; GridColumn column = subControl as GridColumn; ButtonA button = subControl as ButtonA; GridA grid = subControl as GridA; ComboBoxA comboBox = subControl as ComboBoxA; if (column != null) { column.AllowResize = true; column.BackColor = CDraw.PCOLORS_BACKCOLOR; column.BorderColor = COLOR.CONTROLBORDER; column.ForeColor = CDraw.PCOLORS_FORECOLOR; } else if (button != null) { button.RegisterEvent(clickButtonEvent, EVENTID.CLICK); } else if (comboBox != null) { comboBox.RegisterEvent(selectedIndexChangedEvent, EVENTID.SELECTEDINDEXCHANGED); } else if (grid != null) { grid.GridLineColor = COLOR.EMPTY; GridRowStyle rowStyle = new GridRowStyle(); grid.RowStyle = rowStyle; rowStyle.BackColor = COLOR.EMPTY; rowStyle.SelectedBackColor = CDraw.PCOLORS_SELECTEDROWCOLOR; rowStyle.HoveredBackColor = CDraw.PCOLORS_HOVEREDROWCOLOR; } RegisterEvents(subControl); } }
/// <summary> /// 注册事件 /// </summary> /// <param name="control">控件</param> private void RegisterEvents(ControlA control) { ControlMouseEvent clickButtonEvent = new ControlMouseEvent(ClickButton); ControlEvent spinInputChangedEvent = new ControlEvent(SpinTextChanged); List <ControlA> controls = control.GetControls(); int controlsSize = controls.Count; for (int i = 0; i < controlsSize; i++) { ButtonA button = controls[i] as ButtonA; if (button != null) { button.RegisterEvent(clickButtonEvent, EVENTID.CLICK); } SpinA spin = controls[i] as SpinA; if (spin != null) { spin.RegisterEvent(spinInputChangedEvent, EVENTID.TEXTCHANGED); } RegisterEvents(controls[i]); } }
/// <summary> /// 绑定所有的群组 /// </summary> private void BindGroups() { m_gridGroups.UseAnimation = true; List <GridRow> rows = m_gridGroups.m_rows; int rowsSize = rows.Count; for (int i = 0; i < rowsSize; i++) { GridRow row = rows[i]; if (row.EditButton != null) { m_gridGroups.RemoveControl(row.EditButton); row.EditButton = null; } m_gridGroups.RemoveRow(row); i--; rowsSize--; } m_gridGroups.Update(); GridRow firstRow = new GridRow(); m_gridGroups.AddRow(firstRow); GridStringCell cell1 = new GridStringCell(""); firstRow.AddCell("colG1", cell1); GridStringCell cell2 = new GridStringCell("全部"); firstRow.AddCell("colG2", cell2); GridStringCell cell3 = new GridStringCell(""); firstRow.AddCell("colG3", cell3); int groupsSize = m_chatGroups.Count; for (int i = 0; i < groupsSize; i++) { ChatGroup chatGroup = m_chatGroups[i]; GridRow cRow = new GridRow(); m_gridGroups.AddRow(cRow); ButtonA deleteButton = new ButtonA(); deleteButton.Height = cRow.Height; deleteButton.Name = "btnDelete"; deleteButton.Tag = chatGroup.Name; deleteButton.BackColor = COLOR.ARGB(255, 0, 0); deleteButton.Native = m_gridHosts.Native; deleteButton.Text = "删除"; cRow.EditButton = deleteButton; cRow.AllowEdit = true; GridStringCell cCell1 = new GridStringCell(chatGroup.Name); cRow.AddCell("colG1", cCell1); GridStringCell cCell2 = new GridStringCell(chatGroup.DisplayName); cRow.AddCell("colG2", cCell2); String strIDs = ""; int userIDsSize = chatGroup.UserIDs.Count; for (int j = 0; j < userIDsSize; j++) { strIDs += chatGroup.UserIDs[j]; if (j != userIDsSize - 1) { strIDs += ","; } } GridStringCell cCell3 = new GridStringCell(strIDs); cRow.AddCell("colG3", cCell3); ControlMouseEvent clickButtonEvent = new ControlMouseEvent(ClickEvent); deleteButton.RegisterEvent(clickButtonEvent, EVENTID.CLICK); } m_gridGroups.Update(); m_gridGroups.Invalidate(); }