/// <summary> /// Hides the smart part. /// </summary> protected virtual void OnHide(Control smartPart) { UltraTab tab = this.composer[smartPart]; if (null != tab) { tab.Visible = false; } }
/// <summary> /// Load lại bảng theo khu vực /// </summary> private void LoadTableByAreaID() { UltraTab activeTab = tabAreaTableMapping.ActiveTab; if (activeTab == null || string.IsNullOrEmpty(activeTab.Key)) { return; } Guid areaID = Guid.Parse(activeTab.Key); BusinessDataSet dsTable = new BusinessDataSet(); dsTable.AreaTableMapping.Merge(_oblArea.GetTableMappingByAreaID(areaID, dteDateAreaTableMapping.DateTime)); FlowLayoutPanel flowLayout = new FlowLayoutPanel(); flowLayout.Padding = new Padding(10); flowLayout.Dock = DockStyle.Fill; flowLayout.AutoScroll = true; if (dsTable.AreaTableMapping.Rows.Count > 0) { // Bỏ số lượng của Khu vực đi để cộng lại Area_All_Status_Empty[Key_All] -= Area_All_Status_Empty[areaID.ToString()]; Area_All_Status_Empty[areaID.ToString()] = 0; foreach (BusinessDataSet.AreaTableMappingRow iAreaTable in dsTable.AreaTableMapping.Rows) { EnumTableStatus tableStatus = (EnumTableStatus)iAreaTable.TableStatus; if (tableStatus == EnumTableStatus.Empty) { Area_All_Status_Empty[areaID.ToString()] += 1; Area_All_Status_Empty[Key_All] += 1; } else if (tableStatus == EnumTableStatus.Booking) { TimeSpan timeSpan; timeSpan = iAreaTable.BookingDate - DateTime.Now; if (timeSpan.Minutes >= 15) { BLBooking bLBooking = new BLBooking(); DictionaryDataSet.BookingRow row = dsDictionary.Booking.FindByBookingID(iAreaTable.BookingID); row.BookingStatus = 2; bLBooking.InsertUpdate(row); } } UctTableMapping tableMapping = CreateUctTableMapping(iAreaTable); tableMapping.Click += Table_Click; tableMapping.DoubleClick += Table_DoubleClick; tableMapping.LoadAreaStatus += ChangeAreaStatus; flowLayout.Controls.Add(tableMapping); } } activeTab.TabPage.Controls.Clear(); activeTab.TabPage.Controls.Add(flowLayout); }
public void AddListItem(Image image, string title, UltraTab tab) { if (!settingsExplorerBar.Groups[0].Items.Exists(title)) { UltraExplorerBarItem item = new UltraExplorerBarItem(title); item.Text = title; item.Key = title; item.Tag = tab; item.Settings.AppearancesLarge.Appearance.Image = image; this.settingsExplorerBar.Groups[0].Items.Add(item); } }
/// <summary> /// Activates the smart part within the workspace. /// </summary> /// <param name="smartPart">The smart part to activate</param> protected virtual void OnActivate(Control smartPart) { UltraTab tab = this.composer[smartPart]; tab.Visible = true; tab.EnsureTabInView(); tab.Selected = true; // only activate the tab if it was able to be selected if (tab.Selected) { tab.Active = true; } }
/// <summary> /// Applies the smart part info to the smart part within the workspace. /// </summary> /// <param name="smartPart">The smart part to which the smart part info should be applied.</param> /// <param name="smartPartInfo">The smart part info to apply</param> protected virtual void OnApplySmartPartInfo(Control smartPart, UltraTabSmartPartInfo smartPartInfo) { UltraTab tab = this.composer[smartPart]; if (null != tab) { this.ApplySmartPartInfoHelper(tab, smartPartInfo); if (smartPartInfo.ActivateTab) { this.Activate(smartPart); } } }
private void ApplySmartPartInfoHelper(UltraTab tab, UltraTabSmartPartInfo smartPartInfo) { tab.Text = smartPartInfo.Title; tab.ToolTipText = smartPartInfo.Description; Image img = smartPartInfo.Image; if (img != null) { tab.Appearance.Image = img; } else if (tab.HasAppearance) { tab.Appearance.Image = null; } }
public void AddModule(IEmbeddedModule module, MainForm parent) { if (module == null || parent == null) { return; } //Add a new tabpage for the module var tab = new UltraTab(); UltraTabPageControl tabControl = new UltraTabPageControl(); tab.TabPage = tabControl; tab.Text = module.Name; tab.Key = module.Name; tab.Active = true; var pnl = new Panel(); pnl.Controls.Add(module.View); module.View.Dock = DockStyle.Fill; tabControl.Controls.Add(pnl); pnl.Dock = DockStyle.Fill; parent.ultraTabControl1.Tabs.AddRange(new UltraTab[] { tab }); parent.ultraTabControl1.Controls.Add(tabControl); //Add a new button in home page for the module var tile = new UltraTile(module.Name); tile.Settings.Appearance.BackColor = Color.Lavender; tile.MaximumSize = new Size(300, 200); var pictureBox = new PictureBox() { Image = module.Logo, SizeMode = PictureBoxSizeMode.CenterImage }; tile.Control = pictureBox; pictureBox.Dock = DockStyle.Fill; tile.Control.Dock = DockStyle.Fill; tile.Control.Click += (sender, args) => { tab.Selected = true; }; parent.ultraTilePanel1.Tiles.Add(tile); }
/// <summary> /// Shows the smart part in the workspace. /// </summary> /// <param name="smartPart">The smart part to show</param> /// <param name="smartPartInfo">The associated smart part info for the smart part being shown.</param> protected virtual void OnShow(Control smartPart, UltraTabSmartPartInfo smartPartInfo) { UltraTab tab = null; // if we're verifying the smart parts then we may already have a tab created if (this.verifyingSmartParts) { foreach (UltraTabPageControl tabPage in this.Controls) { if (tabPage.Contains(smartPart)) { tab = tabPage.Tab; break; } } } // create a tab that will represent the smart part if (tab == null) { tab = new UltraTab(); } // keep associations between the smart part // and tab that represents it this.composer.Add(tab, smartPart); if (tab.TabControl == null) { this.ApplySmartPartInfoHelper(tab, smartPartInfo); // and then add the smart part control to the // tab page smartPart.Dock = DockStyle.Fill; // store the new tab this.Tabs.Add(tab); tab.TabPage.Controls.Add(smartPart); } if (smartPartInfo.ActivateTab) { this.Activate(smartPart); } }
private static void FreeTabResources(UltraTab tab) { if (tab == null) { throw new ArgumentNullException("tab"); } _log.DebugFormat("Releasing resources from tab {0} ...", tab.Text); foreach (var resultsControl in tab.TabPage.Controls.OfType <UcQueryResults>()) { try { resultsControl.FreeResources(); } catch (Exception ex) { _log.ErrorFormat("Error releasing resources from {0}.", resultsControl.Name); _log.Error(ex.Message, ex); } } foreach (var resultsControl in tab.TabPage.Controls.OfType <UcScriptResults>()) { try { resultsControl.FreeResources(); } catch (Exception ex) { _log.ErrorFormat("Error releasing resources from {0}.", resultsControl.Name); _log.Error(ex.Message, ex); } } foreach (var resultsControl in tab.TabPage.Controls.OfType <UcExplainPlan>()) { try { resultsControl.FreeResources(); } catch (Exception ex) { _log.ErrorFormat("Error releasing resources from {0}.", resultsControl.Name); _log.Error(ex.Message, ex); } } _log.DebugFormat("Releasing resources from tab {0} finished.", tab.Text); }
/// <summary> /// Closes/removes the smart part. /// </summary> protected virtual void OnClose(Control smartPart) { // find the tab we contained the smartpart within UltraTab tab = this.composer[smartPart]; // clean up the group<=>smartpart references this.composer.Remove(tab, smartPart); // at design time, we won't remove the tab // if you remove the first control // if (this.DesignMode == false) { // reparent the control if its not been disposed if (smartPart.Disposing == false && smartPart.IsDisposed == false) { smartPart.Parent = null; } // get rid of the tab this.Tabs.Remove(tab); tab.Dispose(); } }
private void bindDettagliSpesa(IEnumerable<DettaglioSpesaDTO> dettagli) { try { if (dettagliSpesa.ActiveTab != null) setDettaglioDataSource((DettaglioSpesaDTO)dettagliSpesa.ActiveTab.Tag, null); dettagliSpesa.Tabs.Clear(); foreach (var dettaglio in dettagli) { var tab = new UltraTab { Text = getMovimentoContabileService().GetDescrizioneTab(dettaglio), Tag = dettaglio }; dettagliSpesa.Tabs.Add(tab); dettaglio.NumeroRiga = tab.Index + 1; } if (isEditing && !getMovimentoContabileService().IsMultiSpesa && dettagliSpesa.Tabs.Count == 0) { var newTab = new UltraTab { Text = @"Dettaglio" }; dettagliSpesa.Tabs.Add(newTab); } } catch (Exception ex) { _log.ErrorFormat("Errore nel bind dei dettagli - {0}", ex, Utility.GetMethodDescription()); throw; } }
private void addQuickLookControl() { try { m_quickLookControl = new QuickLookControl(); m_quickLookControl.Create(); m_quickLookTab = addControlToTabControl(m_quickLookControl, "utQuickLook", "Quick Look"); } catch (Exception ex_) { Logger.Error("Error creating quickly look control", typeof (MainContainer), ex_); } }
private bool WfIniTabPageUI(UltraTab pUTab, AdvanceQueryInfo pTabInfo) { Panel panel; UltraGroupBox UGroupBox; RadioButton RadioAnd; RadioButton RadioOr; UltraCombo UComboColumn; UltraCombo UComboCondition; UltraTextEditor UTextValue; UltraGrid UGrid; try { //var pUTab = uTabControl.Tabs.Add("11"); //pUTab.Text = "測試"; panel = new Panel(); panel.Height = 100; panel.Dock = DockStyle.Top; UGroupBox = new UltraGroupBox(); UGroupBox.Size = new Size(160, 45); UGroupBox.Location = new Point(15, 10); UGroupBox.Text = "且/或"; if (GetStyleLibrary.FontControlNormal != null) { UGroupBox.Font = GetStyleLibrary.FontControlNormal; } RadioAnd = new RadioButton(); RadioAnd.Checked = true; RadioAnd.Size = new Size(60, 20); RadioAnd.Location = new Point(20, 18); RadioAnd.Text = "AND"; if (GetStyleLibrary.FontControlNormal != null) { RadioAnd.Font = GetStyleLibrary.FontControlNormal; } UGroupBox.Controls.Add(RadioAnd); RadioOr = new RadioButton(); RadioOr.Checked = false; RadioOr.Size = new Size(60, 20); RadioOr.Location = new Point(80, 18); RadioOr.Text = "OR"; if (GetStyleLibrary.FontControlNormal != null) { RadioOr.Font = GetStyleLibrary.FontControlNormal; } UGroupBox.Controls.Add(RadioOr); panel.Controls.Add(UGroupBox); UComboColumn = new UltraCombo(); UComboColumn.Size = new Size(160, 22); UComboColumn.Location = new Point(20, 60); if (GetStyleLibrary.FontControlNormal != null) { UComboColumn.Font = GetStyleLibrary.FontControlNormal; } panel.Controls.Add(UComboColumn); UComboCondition = new UltraCombo(); UComboCondition.Size = new Size(80, 22); UComboCondition.Location = new Point(190, 60); if (GetStyleLibrary.FontControlNormal != null) { UComboCondition.Font = GetStyleLibrary.FontControlNormal; } panel.Controls.Add(UComboCondition); UTextValue = new UltraTextEditor(); UTextValue.Size = new Size(260, 22); UTextValue.Location = new Point(280, 60); if (GetStyleLibrary.FontControlNormal != null) { UTextValue.Font = GetStyleLibrary.FontControlNormal; } panel.Controls.Add(UTextValue); UGrid = new UltraGrid(); UGrid.Dock = DockStyle.Fill; pUTab.TabPage.Controls.Add(UGrid); pUTab.TabPage.Controls.Add(panel); //ref 到tab pTabInfo.UGroupBox = UGroupBox; pTabInfo.RadioAnd = RadioAnd; pTabInfo.RadioOr = RadioOr; pTabInfo.UComboColumn = UComboColumn; pTabInfo.UComboCondition = UComboCondition; pTabInfo.UTextValue = UTextValue; pTabInfo.UGrid = UGrid; return(true); } catch (Exception ex) { throw ex; } }
/// <summary> /// Add a new tab to the tab control for the specified category and add controls to the tab /// for the fields within the category /// </summary> /// <param name="category"></param> protected void AddCategory(UserDataCategory category) { UltraTab selectedTab = dataTabControl.SelectedTab; // Create the objects required to add a tab UltraTab newTab = new UltraTab(); newTab.Tag = category; newTab.Key = "UDD:" + category.Name; newTab.Text = category.Name; newTab.ToolTipText = "Display User Defined Data for " + category.Name; newTab.Appearance.Image = IconMapping.LoadIcon(category.Icon, IconMapping.Iconsize.Small); // Add the new tab to the control dataTabControl.Tabs.Add(newTab); if (selectedTab != null) { foreach (UltraTab tab in dataTabControl.Tabs) { if (tab.Key != selectedTab.Key) { continue; } dataTabControl.SelectedTab = tab; break; } } // Create a Table Layout Panel which will fit on the tab TableLayoutPanel tableLayoutPanel = new TableLayoutPanel(); tableLayoutPanel.Anchor = ((AnchorStyles.Top | AnchorStyles.Bottom) | AnchorStyles.Left) | AnchorStyles.Right; tableLayoutPanel.Location = new Point(10, 10); tableLayoutPanel.Padding = new Padding(10); tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, 30F)); tableLayoutPanel.TabIndex = 0; tableLayoutPanel.RowCount = 12; tableLayoutPanel.ColumnCount = 2; tableLayoutPanel.Dock = DockStyle.Fill; GroupBox gb = new GroupBox { Text = category.Name, Location = new Point(12, 20), Size = new Size(800, 400), Padding = new Padding(15, 15, 15, 15) }; gb.Controls.Add(tableLayoutPanel); newTab.TabPage.Controls.Add(gb); Size containerSize = newTab.TabPage.Size; Size tableSize = new Size(containerSize.Width - 20, containerSize.Height - 20); tableLayoutPanel.Size = tableSize; tableLayoutPanel.AutoScroll = true; // Get the list of fields which form this category List <Control> listControls = new List <Control>(); foreach (UserDataField dataField in category) { Label label; Control control; switch ((int)dataField.Type) { case (int)UserDataField.FieldType.Number: CreateNumberField(dataField, out label, out control); break; case (int)UserDataField.FieldType.Picklist: CreatePicklistField(dataField, out label, out control); break; case (int)UserDataField.FieldType.Date: CreateDateField(dataField, out label, out control); break; case (int)UserDataField.FieldType.Currency: CreateCurrencyField(dataField, out label, out control); break; case (int)UserDataField.FieldType.Registry: CreateEnvironmentOrRegistryField(dataField, out label, out control); break; case (int)UserDataField.FieldType.Environment: CreateEnvironmentOrRegistryField(dataField, out label, out control); break; default: CreateTextField(dataField, out label, out control); break; } // Add the controls to the panel listControls.Add(label); control.Tag = dataField; listControls.Add(control); // Ensure that the user data field knows about its display control dataField.Tag = control; } // Suspend Layout of the table as we add the rows tableLayoutPanel.SuspendLayout(); // Now add the controls as pairs to the table int row = 0; int column = 0; for (int isub = 0; isub < listControls.Count; isub += 2) { // Get the controls Label label = (Label)listControls[isub]; Control control = listControls[isub + 1]; // Ensure that the controls will align at the top, left of their cell label.Anchor = AnchorStyles.Left | AnchorStyles.None; label.Location = new Point(0, 0); label.TextAlign = ContentAlignment.MiddleCenter; label.Padding = new Padding(5); control.Anchor = AnchorStyles.Left | AnchorStyles.None; control.Padding = new Padding(5); control.Location = new Point(0, 0); // Are we at the end of the rows? If so reset to row 0 but now start at column 3 if (row >= tableLayoutPanel.RowCount) { row = 0; column = 3; } // Add the data to the row tableLayoutPanel.Controls.Add(label, column, row); tableLayoutPanel.Controls.Add(control, column + 1, row); // next row row++; } // Resume and perform the layout tableLayoutPanel.ResumeLayout(); tableLayoutPanel.PerformLayout(); }
/// <summary> /// Add a new tab to the tab control for the specified category and add controls to the tab /// for the fields within the category /// </summary> /// <param name="category"></param> protected void AddCategory(UserDataCategory category) { // Create the objects required to add a tab UltraTab newTab = new UltraTab(); newTab.Tag = category; Infragistics.Win.Appearance newAppearance = new Infragistics.Win.Appearance(); // Add the new tab to the control this.dataTabControl.Tabs.Add(newTab); // Set the tab appearance newAppearance.Image = IconMapping.LoadIcon(category.Icon, IconMapping.Iconsize.Small); newTab.Appearance = newAppearance; newTab.Text = category.Name; // Create a Table Layout Panel which will fit on the tab TableLayoutPanel tableLayoutPanel = new TableLayoutPanel(); // // tableLayoutPanel // tableLayoutPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); //tableLayoutPanel.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.Single; tableLayoutPanel.Location = new System.Drawing.Point(10, 10); tableLayoutPanel.Padding = new System.Windows.Forms.Padding(5); tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F)); tableLayoutPanel.TabIndex = 0; // How many rows do we need? We will try and limit to 12 rows but we may need to increase this depending on // how many fields there are. if (category.Count > 30) { tableLayoutPanel.RowCount = (category.Count / 2); } else { tableLayoutPanel.RowCount = 12; } // Either one or two sets of columns if (tableLayoutPanel.RowCount <= 12) { tableLayoutPanel.ColumnCount = 2; tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 30F)); tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 70F)); } else { tableLayoutPanel.ColumnCount = 5; tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 15F)); tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 30F)); tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10F)); tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 15F)); tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 30F)); } // Add this to the tab newTab.TabPage.Controls.Add(tableLayoutPanel); Size containerSize = newTab.TabPage.Size; Size tableSize = new Size(containerSize.Width - 20, containerSize.Height - 20); tableLayoutPanel.Size = tableSize; // Get the list of fields which form this category List <Control> listControls = new List <Control>(); foreach (UserDataField dataField in category) { Label label = null; Control control = null; switch ((int)dataField.Type) { //case (int)UserDataField.FieldType.boolean: // CreateBooleanField(dataField, out label, out control); // break; //case (int)UserDataField.FieldType.date: // CreateDateField(dataField, out label, out control); // break; case (int)UserDataField.FieldType.Number: CreateNumberField(dataField, out label, out control); break; case (int)UserDataField.FieldType.Picklist: CreatePicklistField(dataField, out label, out control); break; case (int)UserDataField.FieldType.Text: CreateTextField(dataField, out label, out control); break; default: CreateTextField(dataField, out label, out control); break; } // Add the controls to the panel listControls.Add(label); control.Tag = dataField; listControls.Add(control); // Ensure that the user data field knows about its display control dataField.Tag = control; } // Suspend Layout of the table as we add the rows tableLayoutPanel.SuspendLayout(); // Now add the controls as pairs to the table int row = 0; int column = 0; for (int isub = 0; isub < listControls.Count; isub += 2) { // Get the controls Label label = (Label)listControls[isub]; Control control = listControls[isub + 1]; // Ensure that the controls will align at the top, left of their cell label.Anchor = AnchorStyles.Left | AnchorStyles.Top; label.Location = new Point(0, 0); control.Anchor = AnchorStyles.Left | AnchorStyles.Top; control.Location = new Point(0, 0); // Are we at the end of the rows? If so reset to row 0 but now start at column 3 if (row >= tableLayoutPanel.RowCount) { row = 0; column = 3; } // Add the data to the row tableLayoutPanel.Controls.Add(label, column, row); tableLayoutPanel.Controls.Add(control, column + 1, row); // next row row++; } // Resume and perform the layout tableLayoutPanel.ResumeLayout(); tableLayoutPanel.PerformLayout(); }
/// <summary> /// Representa los esquemas en el control. /// </summary> public void Redraw() { int current = -1; int idx = 0; UltraTab tab = null; _drawing = true; // Memoriza el TAB seleccionado actualmente if (_panel != null) { if (_panel.Schemas.Count > 1) { if (tabSchemas.Tabs.Count > 0) { current = tabSchemas.SelectedTab.Index; } } } // Resetea el control Initialize(); if (_panel == null) { return; } tabSchemas.SuspendLayout(); // General las pestañas correspondientes a los esquemas que contiene el panel foreach (OTCSchema schema in _panel.Schemas) { // Crea una nueva pestaña tab = tabSchemas.Tabs.Add(schema.Name, schema.Name); // Genera un nuevo control DataGridView DataGridView grid = new DataGridView(); grid.BorderStyle = System.Windows.Forms.BorderStyle.None; grid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; grid.Dock = System.Windows.Forms.DockStyle.Fill; grid.Location = new System.Drawing.Point(0, 0); grid.Name = "dgvSchema" + idx; grid.Size = new System.Drawing.Size(533, 474); grid.TabIndex = 0; // Asocia el grid a la pestaña tab.TabPage.Controls.Add(grid); // Representa el esquema PaintSchema(grid, schema); // Patch: Elimina los eventos registros anteriormente para evitar que cada llamada agregue una nueva llamada a los eventos schema.OnBlockChange -= new OTCSchema.BlockChangeEventHandler(schema_OnBlockChange); schema.OnBlockStatusChange -= new OTCSchema.BlockStatusChangeEventHandler(schema_OnBlockStatusChange); // Registra los eventos para el esquema schema.OnBlockChange += new OTCSchema.BlockChangeEventHandler(schema_OnBlockChange); schema.OnBlockStatusChange += new OTCSchema.BlockStatusChangeEventHandler(schema_OnBlockStatusChange); // Registra los eventos necesarios del grid grid.CellContentClick += new DataGridViewCellEventHandler(grid_CellContentClick); grid.CellMouseEnter += new DataGridViewCellEventHandler(grid_CellMouseEnter); grid.CellMouseLeave += new DataGridViewCellEventHandler(grid_CellMouseLeave); idx++; } // Preselecciona el esquema adecuado if (current == -1) { tabSchemas.SelectedTab = tabSchemas.Tabs[0]; } else { tabSchemas.SelectedTab = tabSchemas.Tabs[current]; } tabSchemas.PerformLayout(); _drawing = false; }
private void settingsExplorerBar_ActiveItemChanged(object sender, ItemEventArgs e) { UltraTab tab = (UltraTab)e.Item.Tag; TabWorkspace.SelectedTab = tab; }