public virtual void Remove(OMETabStripItem item) { if (List.Contains(item)) { List.Remove(item); } }
protected override void OnInsertComplete(int index, object item) { OMETabStripItem itm = item as OMETabStripItem; itm.Changed += new EventHandler(OnItem_Changed); OnCollectionChanged(new CollectionChangeEventArgs(CollectionChangeAction.Add, item)); }
private void OnCalcTabPage(Graphics g, OMETabStripItem currentItem) { Font currentFont = Font; if (currentItem == SelectedItem) { currentFont = new Font(Font, FontStyle.Bold); } SizeF textSize = g.MeasureString(currentItem.Title, currentFont, new SizeF(200, 10), sf); textSize.Width += 20; if (RightToLeft == RightToLeft.No) { RectangleF buttonRect = new RectangleF(DEF_START_POS, 3, textSize.Width, 17); currentItem.StripRect = buttonRect; DEF_START_POS += (int)textSize.Width; } else { RectangleF buttonRect = new RectangleF(DEF_START_POS - textSize.Width + 1, 3, textSize.Width - 1, 17); currentItem.StripRect = buttonRect; DEF_START_POS -= (int)textSize.Width; } }
public void Assign(OMETabStripItem item) { Visible = item.Visible; Text = item.Text; CanClose = item.CanClose; Tag = item.Tag; }
public virtual void Insert(int index, OMETabStripItem item) { if (Contains(item)) { return; } List.Insert(index, item); }
protected override void OnRemove(int index, object item) { base.OnRemove(index, item); OMETabStripItem itm = item as OMETabStripItem; itm.Changed -= new EventHandler(OnItem_Changed); OnCollectionChanged(new CollectionChangeEventArgs(CollectionChangeAction.Remove, item)); }
internal void SelectItem(OMETabStripItem tabItem) { if (tabItem != null) { tabItem.Dock = DockStyle.Fill; tabItem.Visible = true; tabItem.Selected = true; } }
public virtual int Add(OMETabStripItem item) { int res = IndexOf(item); if (res == -1) { res = List.Add(item); } return(res); }
/// <summary> /// Add a <see cref="OMETabStripItem"/> to this control. /// User can make the currently selected item or not. /// </summary> /// <param name="tabItem"></param> public void AddTab(OMETabStripItem tabItem, bool autoSelect) { tabItem.Dock = DockStyle.Fill; Items.Add(tabItem); if ((autoSelect && tabItem.Visible) || (tabItem.Visible && Items.DrawnCount < 1)) { SelectedItem = tabItem; SelectItem(tabItem); } }
private void SetDefaultSelected() { if (selectedItem == null && Items.Count > 0) { SelectedItem = Items[0]; } for (int i = 0; i < Items.Count; i++) { OMETabStripItem itm = Items[i]; itm.Dock = DockStyle.Fill; } }
public virtual OMETabStripItem MoveTo(int newIndex, OMETabStripItem item) { int currentIndex = List.IndexOf(item); if (currentIndex >= 0) { RemoveAt(currentIndex); Insert(0, item); return(item); } return(null); }
protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); if (e.Button != MouseButtons.Left) { return; } HitTestResult result = HitTest(e.Location); if (result == HitTestResult.MenuGlyph) { HandledEventArgs args = new HandledEventArgs(false); OnMenuItemsLoading(args); if (!args.Handled) { OnMenuItemsLoad(EventArgs.Empty); } ShowMenu(); } else if (result == HitTestResult.CloseButton) { if (SelectedItem != null) { TabStripItemClosingEventArgs args = new TabStripItemClosingEventArgs(SelectedItem); OnTabStripItemClosing(args); if (!args.Cancel && SelectedItem.CanClose) { RemoveTab(SelectedItem); OnTabStripItemClosed(EventArgs.Empty); } } } else if (result == HitTestResult.TabItem) { OMETabStripItem item = GetTabItemByPoint(e.Location); if (item != null) { SelectedItem = item; } } Invalidate(); }
public virtual void Assign(OMETabStripItemCollection collection) { BeginUpdate(); try { Clear(); for (int n = 0; n < collection.Count; n++) { OMETabStripItem item = collection[n]; OMETabStripItem newItem = new OMETabStripItem(); newItem.Assign(item); Add(newItem); } } finally { EndUpdate(); } }
/// <summary> /// Loads menu items based on <see cref="OMETabStripItem"/>s currently added /// to this control. /// </summary> /// <param name="e"></param> protected virtual void OnMenuItemsLoad(EventArgs e) { menu.RightToLeft = RightToLeft; menu.Items.Clear(); for (int i = 0; i < Items.Count; i++) { OMETabStripItem item = Items[i]; if (!item.Visible) { continue; } ToolStripMenuItem tItem = new ToolStripMenuItem(item.Title); tItem.Tag = item; tItem.Image = item.Image; menu.Items.Add(tItem); } OnMenuItemsLoaded(EventArgs.Empty); }
private bool AllowDraw(OMETabStripItem item) { bool result = true; if (RightToLeft == RightToLeft.No) { if (item.StripRect.Right >= stripButtonRect.Width) { result = false; } } else { if (item.StripRect.Left <= stripButtonRect.Left) { return(false); } } return(result); }
/// <summary> /// Remove a <see cref="OMETabStripItem"/> from this control. /// </summary> /// <param name="tabItem"></param> public void RemoveTab(OMETabStripItem tabItem) { int tabIndex = Items.IndexOf(tabItem); if (tabIndex >= 0) { UnSelectItem(tabItem); Items.Remove(tabItem); } if (Items.Count > 0) { if (RightToLeft == RightToLeft.No) { if (Items[tabIndex - 1] != null) { SelectedItem = Items[tabIndex - 1]; } else { SelectedItem = Items.FirstVisible; } } else { if (Items[tabIndex + 1] != null) { SelectedItem = Items[tabIndex + 1]; } else { SelectedItem = Items.LastVisible; } } } else { selectedItem = null; } }
private void OnCollectionChanged(object sender, CollectionChangeEventArgs e) { OMETabStripItem itm = (OMETabStripItem)e.Element; if (e.Action == CollectionChangeAction.Add) { Controls.Add(itm); OnTabStripItemChanged(new TabStripItemChangedEventArgs(itm, OMETabStripItemChangeTypes.Added)); } else if (e.Action == CollectionChangeAction.Remove) { Controls.Remove(itm); OnTabStripItemChanged(new TabStripItemChangedEventArgs(itm, OMETabStripItemChangeTypes.Removed)); } else { OnTabStripItemChanged(new TabStripItemChangedEventArgs(itm, OMETabStripItemChangeTypes.Changed)); } UpdateLayout(); Invalidate(); }
/// <summary> /// Get a <see cref="OMETabStripItem"/> at provided point. /// If no item was found, returns null value. /// </summary> /// <param name="pt"></param> /// <returns></returns> public OMETabStripItem GetTabItemByPoint(Point pt) { OMETabStripItem item = null; bool found = false; for (int i = 0; i < Items.Count; i++) { OMETabStripItem current = Items[i]; if (current.StripRect.Contains(pt) && current.Visible && current.IsDrawn) { item = current; found = true; } if (found) { break; } } return(item); }
/// <summary> /// Add a <see cref="OMETabStripItem"/> to this control without selecting it. /// </summary> /// <param name="tabItem"></param> public void AddTab(OMETabStripItem tabItem) { AddTab(tabItem, false); }
internal void UnSelectItem(OMETabStripItem tabItem) { //tabItem.Visible = false; tabItem.Selected = false; }
private void OnDrawTabPage(Graphics g, OMETabStripItem currentItem) { bool isFirstTab = Items.IndexOf(currentItem) == 0; Font currentFont = Font; if (currentItem == SelectedItem) { currentFont = new Font(Font, FontStyle.Bold); } SizeF textSize = g.MeasureString(currentItem.Title, currentFont, new SizeF(200, 10), sf); textSize.Width += 20; RectangleF buttonRect = currentItem.StripRect; GraphicsPath path = new GraphicsPath(); LinearGradientBrush brush; int mtop = 3; #region Draw Not Right-To-Left Tab if (RightToLeft == RightToLeft.No) { if (currentItem == SelectedItem || isFirstTab) { path.AddLine(buttonRect.Left - 10, buttonRect.Bottom - 1, buttonRect.Left + (buttonRect.Height / 2) - 4, mtop + 4); } else { path.AddLine(buttonRect.Left, buttonRect.Bottom - 1, buttonRect.Left, buttonRect.Bottom - (buttonRect.Height / 2) - 2); path.AddLine(buttonRect.Left, buttonRect.Bottom - (buttonRect.Height / 2) - 3, buttonRect.Left + (buttonRect.Height / 2) - 4, mtop + 3); } path.AddLine(buttonRect.Left + (buttonRect.Height / 2) + 2, mtop, buttonRect.Right - 3, mtop); path.AddLine(buttonRect.Right, mtop + 2, buttonRect.Right, buttonRect.Bottom - 1); path.AddLine(buttonRect.Right - 4, buttonRect.Bottom - 1, buttonRect.Left, buttonRect.Bottom - 1); path.CloseFigure(); if (currentItem == SelectedItem) { brush = new LinearGradientBrush(buttonRect, SystemColors.ControlLightLight, SystemColors.Window, LinearGradientMode.Vertical); } else { brush = new LinearGradientBrush(buttonRect, SystemColors.ControlLightLight, SystemColors.Control, LinearGradientMode.Vertical); } g.FillPath(brush, path); g.DrawPath(SystemPens.ControlDark, path); if (currentItem == SelectedItem) { g.DrawLine(new Pen(brush), buttonRect.Left - 9, buttonRect.Height + 2, buttonRect.Left + buttonRect.Width - 1, buttonRect.Height + 2); } PointF textLoc = new PointF(buttonRect.Left + buttonRect.Height - 4, buttonRect.Top + (buttonRect.Height / 2) - (textSize.Height / 2) - 3); RectangleF textRect = buttonRect; textRect.Location = textLoc; textRect.Width = buttonRect.Width - (textRect.Left - buttonRect.Left) - 4; textRect.Height = textSize.Height + currentFont.Size / 2; if (currentItem == SelectedItem) { //textRect.Y -= 2; g.DrawString(currentItem.Title, currentFont, new SolidBrush(ForeColor), textRect, sf); } else { g.DrawString(currentItem.Title, currentFont, new SolidBrush(ForeColor), textRect, sf); } } #endregion #region Draw Right-To-Left Tab if (RightToLeft == RightToLeft.Yes) { if (currentItem == SelectedItem || isFirstTab) { path.AddLine(buttonRect.Right + 10, buttonRect.Bottom - 1, buttonRect.Right - (buttonRect.Height / 2) + 4, mtop + 4); } else { path.AddLine(buttonRect.Right, buttonRect.Bottom - 1, buttonRect.Right, buttonRect.Bottom - (buttonRect.Height / 2) - 2); path.AddLine(buttonRect.Right, buttonRect.Bottom - (buttonRect.Height / 2) - 3, buttonRect.Right - (buttonRect.Height / 2) + 4, mtop + 3); } path.AddLine(buttonRect.Right - (buttonRect.Height / 2) - 2, mtop, buttonRect.Left + 3, mtop); path.AddLine(buttonRect.Left, mtop + 2, buttonRect.Left, buttonRect.Bottom - 1); path.AddLine(buttonRect.Left + 4, buttonRect.Bottom - 1, buttonRect.Right, buttonRect.Bottom - 1); path.CloseFigure(); if (currentItem == SelectedItem) { brush = new LinearGradientBrush(buttonRect, SystemColors.ControlLightLight, SystemColors.Window, LinearGradientMode.Vertical); } else { brush = new LinearGradientBrush(buttonRect, SystemColors.ControlLightLight, SystemColors.Control, LinearGradientMode.Vertical); } g.FillPath(brush, path); g.DrawPath(SystemPens.ControlDark, path); if (currentItem == SelectedItem) { g.DrawLine(new Pen(brush), buttonRect.Right + 9, buttonRect.Height + 2, buttonRect.Right - buttonRect.Width + 1, buttonRect.Height + 2); } PointF textLoc = new PointF(buttonRect.Left + 2, buttonRect.Top + (buttonRect.Height / 2) - (textSize.Height / 2) - 2); RectangleF textRect = buttonRect; textRect.Location = textLoc; textRect.Width = buttonRect.Width - (textRect.Left - buttonRect.Left) - 10; textRect.Height = textSize.Height + currentFont.Size / 2; if (currentItem == SelectedItem) { textRect.Y -= 1; g.DrawString(currentItem.Title, currentFont, new SolidBrush(ForeColor), textRect, sf); } else { g.DrawString(currentItem.Title, currentFont, new SolidBrush(ForeColor), textRect, sf); } //g.FillRectangle(Brushes.Red, textRect); } #endregion currentItem.IsDrawn = true; }
public virtual void AddRange(OMETabStripItem[] items) { BeginUpdate(); try { foreach (OMETabStripItem item in items) { List.Add(item); } } finally { EndUpdate(); } }
private void OnMenuItemClicked(object sender, ToolStripItemClickedEventArgs e) { OMETabStripItem clickedItem = (OMETabStripItem)e.ClickedItem.Tag; SelectedItem = clickedItem; }
public virtual int IndexOf(OMETabStripItem item) { return List.IndexOf(item); }
public virtual OMETabStripItem MoveTo(int newIndex, OMETabStripItem item) { int currentIndex = List.IndexOf(item); if (currentIndex >= 0) { RemoveAt(currentIndex); Insert(0, item); return item; } return null; }
public virtual int IndexOf(OMETabStripItem item) { return(List.IndexOf(item)); }
public virtual bool Contains(OMETabStripItem item) { return List.Contains(item); }
public virtual int Add(OMETabStripItem item) { int res = IndexOf(item); if (res == -1) res = List.Add(item); return res; }
public virtual void Insert(int index, OMETabStripItem item) { if (Contains(item)) return; List.Insert(index, item); }
private void OnDrawTabPage(Graphics g, OMETabStripItem currentItem) { bool isFirstTab = Items.IndexOf(currentItem) == 0; Font currentFont = Font; if (currentItem == SelectedItem) currentFont = new Font(Font, FontStyle.Bold); SizeF textSize = g.MeasureString(currentItem.Title, currentFont, new SizeF(200, 10), sf); textSize.Width += 20; RectangleF buttonRect = currentItem.StripRect; GraphicsPath path = new GraphicsPath(); LinearGradientBrush brush; int mtop = 3; #region Draw Not Right-To-Left Tab if (RightToLeft == RightToLeft.No) { if (currentItem == SelectedItem || isFirstTab) { path.AddLine(buttonRect.Left - 10, buttonRect.Bottom - 1, buttonRect.Left + (buttonRect.Height / 2) - 4, mtop + 4); } else { path.AddLine(buttonRect.Left, buttonRect.Bottom - 1, buttonRect.Left, buttonRect.Bottom - (buttonRect.Height / 2) - 2); path.AddLine(buttonRect.Left, buttonRect.Bottom - (buttonRect.Height / 2) - 3, buttonRect.Left + (buttonRect.Height / 2) - 4, mtop + 3); } path.AddLine(buttonRect.Left + (buttonRect.Height / 2) + 2, mtop, buttonRect.Right - 3, mtop); path.AddLine(buttonRect.Right, mtop + 2, buttonRect.Right, buttonRect.Bottom - 1); path.AddLine(buttonRect.Right - 4, buttonRect.Bottom - 1, buttonRect.Left, buttonRect.Bottom - 1); path.CloseFigure(); if (currentItem == SelectedItem) { brush = new LinearGradientBrush(buttonRect, SystemColors.ControlLightLight, SystemColors.Window, LinearGradientMode.Vertical); } else { brush = new LinearGradientBrush(buttonRect, SystemColors.ControlLightLight, SystemColors.Control, LinearGradientMode.Vertical); } g.FillPath(brush, path); g.DrawPath(SystemPens.ControlDark, path); if (currentItem == SelectedItem) { g.DrawLine(new Pen(brush), buttonRect.Left - 9, buttonRect.Height + 2, buttonRect.Left + buttonRect.Width - 1, buttonRect.Height + 2); } PointF textLoc = new PointF(buttonRect.Left + buttonRect.Height - 4, buttonRect.Top + (buttonRect.Height / 2) - (textSize.Height / 2) - 3); RectangleF textRect = buttonRect; textRect.Location = textLoc; textRect.Width = buttonRect.Width - (textRect.Left - buttonRect.Left) - 4; textRect.Height = textSize.Height + currentFont.Size / 2; if (currentItem == SelectedItem) { //textRect.Y -= 2; g.DrawString(currentItem.Title, currentFont, new SolidBrush(ForeColor), textRect, sf); } else { g.DrawString(currentItem.Title, currentFont, new SolidBrush(ForeColor), textRect, sf); } } #endregion #region Draw Right-To-Left Tab if (RightToLeft == RightToLeft.Yes) { if (currentItem == SelectedItem || isFirstTab) { path.AddLine(buttonRect.Right + 10, buttonRect.Bottom - 1, buttonRect.Right - (buttonRect.Height / 2) + 4, mtop + 4); } else { path.AddLine(buttonRect.Right, buttonRect.Bottom - 1, buttonRect.Right, buttonRect.Bottom - (buttonRect.Height / 2) - 2); path.AddLine(buttonRect.Right, buttonRect.Bottom - (buttonRect.Height / 2) - 3, buttonRect.Right - (buttonRect.Height / 2) + 4, mtop + 3); } path.AddLine(buttonRect.Right - (buttonRect.Height / 2) - 2, mtop, buttonRect.Left + 3, mtop); path.AddLine(buttonRect.Left, mtop + 2, buttonRect.Left, buttonRect.Bottom - 1); path.AddLine(buttonRect.Left + 4, buttonRect.Bottom - 1, buttonRect.Right, buttonRect.Bottom - 1); path.CloseFigure(); if (currentItem == SelectedItem) { brush = new LinearGradientBrush(buttonRect, SystemColors.ControlLightLight, SystemColors.Window, LinearGradientMode.Vertical); } else { brush = new LinearGradientBrush(buttonRect, SystemColors.ControlLightLight, SystemColors.Control, LinearGradientMode.Vertical); } g.FillPath(brush, path); g.DrawPath(SystemPens.ControlDark, path); if (currentItem == SelectedItem) { g.DrawLine(new Pen(brush), buttonRect.Right + 9, buttonRect.Height + 2, buttonRect.Right - buttonRect.Width + 1, buttonRect.Height + 2); } PointF textLoc = new PointF(buttonRect.Left + 2, buttonRect.Top + (buttonRect.Height / 2) - (textSize.Height / 2) - 2); RectangleF textRect = buttonRect; textRect.Location = textLoc; textRect.Width = buttonRect.Width - (textRect.Left - buttonRect.Left) - 10; textRect.Height = textSize.Height + currentFont.Size / 2; if (currentItem == SelectedItem) { textRect.Y -= 1; g.DrawString(currentItem.Title, currentFont, new SolidBrush(ForeColor), textRect, sf); } else { g.DrawString(currentItem.Title, currentFont, new SolidBrush(ForeColor), textRect, sf); } //g.FillRectangle(Brushes.Red, textRect); } #endregion currentItem.IsDrawn = true; }
public TabStripItemChangedEventArgs(OMETabStripItem item, OMETabStripItemChangeTypes type) { changeType = type; itm = item; }
private void OnCalcTabPage(Graphics g, OMETabStripItem currentItem) { Font currentFont = Font; if (currentItem == SelectedItem) currentFont = new Font(Font, FontStyle.Bold); SizeF textSize = g.MeasureString(currentItem.Title, currentFont, new SizeF(200, 10), sf); textSize.Width += 20; if (RightToLeft == RightToLeft.No) { RectangleF buttonRect = new RectangleF(DEF_START_POS, 3, textSize.Width, 17); currentItem.StripRect = buttonRect; DEF_START_POS += (int)textSize.Width; } else { RectangleF buttonRect = new RectangleF(DEF_START_POS - textSize.Width + 1, 3, textSize.Width - 1, 17); currentItem.StripRect = buttonRect; DEF_START_POS -= (int)textSize.Width; } }
public virtual void Remove(OMETabStripItem item) { if (List.Contains(item)) List.Remove(item); }
public virtual bool Contains(OMETabStripItem item) { return(List.Contains(item)); }
private static TreeGridView TreeViewFor(OMETabStripItem pg) { return pg != null ? (TreeGridView) pg.Controls[0] : null; }
private void masterView_SelectionChanged(object sender, EventArgs e) { try { if (masterView.SelectedRows.Count > 0 && detailsTabs.SelectedItem != null) { object selectedObject = masterView.SelectedRows[0].Tag; if (selectedObject != null && selectedObject.Equals(ReferencedObjectFor(detailsTabs.SelectedItem))) { PropertiesTab.Instance.ShowObjectPropertiesTab = true; PropertiesTab.Instance.RefreshPropertiesTab(selectedObject); return; } } if (masterView.SelectedRows.Count <= 0) return; DataGridViewRow row = masterView.SelectedRows[0]; if (null == row) return; if (row.Tag != null) { OMETabStripItem foundTab = FindDetailsTabForObjectIndex(DetailsTabCaptionFor(row)); if (null != foundTab) { detailsTabs.SelectedItem = foundTab; return; } TreeGridView treeview = dbInteraction.GetObjectHierarchy(row.Tag, ClassName); OMETabStripItem tabPage = new OMETabStripItem(DetailsTabCaptionFor(row), treeview); tabPage.Name = tabPage.Title; detailsTabs.AddTab(tabPage); RegisterTreeviewEvents(treeview); // This check helps in avoding recusrrion. if (masterView.SortOrder == SortOrder.None) { detailsTabs.SelectedItem = tabPage; } } else row.Selected = false; } catch (Exception oEx) { LoggingHelper.ShowMessage(oEx); } }
public TabStripItemClosingEventArgs(OMETabStripItem item) { _item = item; }
private static int UpdateDethFor(OMETabStripItem detailsTab) { return detailsTab.Tag != null ? (int) detailsTab.Tag : 0; }
private bool AllowDraw(OMETabStripItem item) { bool result = true; if (RightToLeft == RightToLeft.No) { if (item.StripRect.Right >= stripButtonRect.Width) result = false; } else { if (item.StripRect.Left <= stripButtonRect.Left) return false; } return result; }
private static int ObjectIndexInMasterViewFor(OMETabStripItem item) { return Convert.ToInt32(item.Title.Split(CONST_SPACE)[1]); }
private static object ReferencedObjectFor(OMETabStripItem item) { return TreeViewFor(item).Nodes[0].Tag; }
protected override void OnPaint(PaintEventArgs e) { SetDefaultSelected(); Rectangle borderRc = ClientRectangle; borderRc.Width--; borderRc.Height--; if (RightToLeft == RightToLeft.No) { DEF_START_POS = 10; } else { DEF_START_POS = stripButtonRect.Right; } e.Graphics.DrawRectangle(SystemPens.ControlDark, borderRc); e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; #region Draw Pages for (int i = 0; i < Items.Count; i++) { OMETabStripItem currentItem = Items[i]; if (!currentItem.Visible && !DesignMode) { continue; } OnCalcTabPage(e.Graphics, currentItem); currentItem.IsDrawn = false; if (!AllowDraw(currentItem)) { continue; } OnDrawTabPage(e.Graphics, currentItem); } #endregion #region Draw UnderPage Line if (RightToLeft == RightToLeft.No) { if (Items.DrawnCount == 0 || Items.VisibleCount == 0) { e.Graphics.DrawLine(SystemPens.ControlDark, new Point(0, DEF_HEADER_HEIGHT), new Point(ClientRectangle.Width, DEF_HEADER_HEIGHT)); } else if (SelectedItem != null && SelectedItem.IsDrawn) { Point end = new Point((int)SelectedItem.StripRect.Left - 9, DEF_HEADER_HEIGHT); e.Graphics.DrawLine(SystemPens.ControlDark, new Point(0, DEF_HEADER_HEIGHT), end); end.X += (int)SelectedItem.StripRect.Width + 10; e.Graphics.DrawLine(SystemPens.ControlDark, end, new Point(ClientRectangle.Width, DEF_HEADER_HEIGHT)); } } else { if (Items.DrawnCount == 0 || Items.VisibleCount == 0) { e.Graphics.DrawLine(SystemPens.ControlDark, new Point(0, DEF_HEADER_HEIGHT), new Point(ClientRectangle.Width, DEF_HEADER_HEIGHT)); } else if (SelectedItem != null && SelectedItem.IsDrawn) { Point end = new Point((int)SelectedItem.StripRect.Left, DEF_HEADER_HEIGHT); e.Graphics.DrawLine(SystemPens.ControlDark, new Point(0, DEF_HEADER_HEIGHT), end); end.X += (int)SelectedItem.StripRect.Width + 20; e.Graphics.DrawLine(SystemPens.ControlDark, end, new Point(ClientRectangle.Width, DEF_HEADER_HEIGHT)); } } #endregion #region Draw Menu and Close Glyphs if (AlwaysShowMenuGlyph || Items.DrawnCount > Items.VisibleCount) { if (!hideMenuGlyph) { menuGlyph.DrawGlyph(e.Graphics); } } if (AlwaysShowClose || (SelectedItem != null && SelectedItem.CanClose)) { closeButton.DrawCross(e.Graphics); } #endregion }
private void UpdateResultTable(DataGridViewCell cell, object editValue, TreeGridNode currNode, OMETabStripItem pg, bool updateToNull) { try { int pageIndex = OffsetInCurrentPageFor(ObjectIndexInMasterViewFor(pg)); string columnName; if (currNode.Parent.Cells[1].Value != null && omQuery.AttributeList.Count > 0) { columnName = GetFullPath(currNode); } else { columnName = currNode.Cells[0].Value.ToString(); } //This fix is applied cause (G) also contains "(" and therefore next line will not fail //If (G) is removed from the columnname. if (columnName.Contains("(G)")) { int index1 = columnName.IndexOf("(G)"); columnName = columnName.Remove(index1, 3); } if (columnName.Contains("(")) { int index = columnName.IndexOf('('); columnName = columnName.Remove(index - 1, columnName.Length - index + 1); } foreach (DataGridViewColumn col in masterView.Columns) { if (col.HeaderText.Equals(columnName)) { masterView.Rows[pageIndex - 1].Cells[columnName].Value = editValue.ToString(); break; } } masterView.Rows[pageIndex - 1].Cells[1].Selected = true; if (!updateToNull) { UpdateMasterViewObjectEditedStatus(masterView.Rows[pageIndex - 1], true); buttonSaveResult.Enabled = true; cell.Style.ForeColor = Color.Red; cell.Style.SelectionForeColor = Color.Red; } } catch (Exception oEx) { LoggingHelper.ShowMessage(oEx); } }