/// <summary> /// Indexer /// </summary> public GLSubItem this[int nItemIndex] { get { // int nTmpCount = 0; // if ( Parent == null ) // rare case when there is no parent set (almost always during collection editor) // nTmpCount = 255; // basically infinite during collection editor // else // nTmpCount = Parent.Columns.Count; int nBailout = 0; // check to make sure it exists first while (List.Count <= nItemIndex) { GLSubItem newitem = new GLSubItem(); newitem.ChangedEvent += new ChangedEventHandler(SubItem_Changed); newitem.Parent = this.m_Parent; //newitem.Control = Parent.Columns[ nItemIndex ] List.Add(newitem); // if the index doesn't yet exist, fill in the subitems till it does if (nBailout++ > 25) { break; } } return((GLSubItem)List[nItemIndex]); } }
/// <summary> /// Changes in the columns, items or subitems /// </summary> /// <param name="ctType"></param> /// <param name="column"></param> /// <param name="item"></param> /// <param name="subItem"></param> public ChangedEventArgs(ChangedTypes ctType, GLColumn column, GLItem item, GLSubItem subItem) { m_Column = column; m_Item = item; m_SubItem = subItem; m_ctType = ctType; }
/// <summary> /// remove an item from the list /// </summary> /// <param name="subItem"></param> public void Remove(GLSubItem subItem) { List.Remove(subItem); if (ChangedEvent != null) { ChangedEvent(this, new ChangedEventArgs(ChangedTypes.SubItemCollectionChanged, null, null, null)); } }
/// <summary> /// insert an item into the list at specified index /// </summary> /// <param name="nIndex"></param> /// <param name="strItemText"></param> /// <returns></returns> public GLSubItem Insert(int nIndex, string strItemText) { GLSubItem subItem = new GLSubItem(); //GLItem item = new GLItem(Parent); //item.SubItems[0].Text = strItemText; nIndex = Insert(nIndex, subItem); return(subItem); }
public bool GLLoad(GLItem item, GLSubItem subItem, GlacialList listctrl) { m_item = item; m_subItem = subItem; m_Parent = listctrl; this.Text = subItem.Text; this.Items.Add("i1"); this.Items.Add("i2"); this.Items.Add("i3"); return(true); }
public bool GLLoad(GLItem item, GLSubItem subItem, GlacialList listctrl) // populate this control however you wish with item { // set the styles you want for this this.BorderStyle = BorderStyle.None; this.AutoSize = false; m_item = item; m_subItem = subItem; m_Parent = listctrl; this.Text = subItem.Text; return(true); // we don't do any heavy processing in this ctrl so we just return true }
private void btnAddGroup_Click(object sender, EventArgs e) { GLItem i = new GLItem(); GLSubItem si_addr = new GLSubItem(); si_addr.Text = "0/0/0"; si_addr.ChangedEvent += new ChangedEventHandler(subItemAddr_ChangedEvent); GLSubItem si_len = new GLSubItem(); si_len.Text = "1"; si_len.ChangedEvent += new ChangedEventHandler(subItemLen_ChangedEvent); i.SubItems.Add(si_addr); i.SubItems.Add(si_len); KnownGroup kg = new KnownGroup(); kg.Address = "0/0/0"; kg.NumBytes = 1; i.Tag = kg; this.lvGroups.Items.Add(i); }
public void LoadData() { if (Groups == null) { return; } foreach (var item in Groups.List) { GLItem i = new GLItem(); GLSubItem si_addr = new GLSubItem(); si_addr.Text = item.Address; si_addr.ChangedEvent += new ChangedEventHandler(subItemAddr_ChangedEvent); GLSubItem si_len = new GLSubItem(); si_len.ChangedEvent += new ChangedEventHandler(subItemLen_ChangedEvent); si_len.Text = item.NumBytes.ToString(); i.SubItems.Add(si_addr); i.SubItems.Add(si_len); i.Tag = item; this.lvGroups.Items.Add(i); } }
public bool GLLoad(GLItem item, GLSubItem subItem, GlacialList listctrl) { this.Format = DateTimePickerFormat.Long; try { m_item = item; m_subItem = subItem; m_Parent = listctrl; this.Text = subItem.Text; //this.Value = subItem.Text; } catch (Exception ex) { Debug.WriteLine(ex.ToString()); this.Text = DateTime.Now.ToString(); } return(true); }
/// <summary> /// lowest level of add/insert. All add and insert routines eventually call this /// /// in the future always have routines call this one as well to keep one point of entry /// </summary> /// <param name="nIndex"></param> /// <param name="subItem"></param> /// <returns></returns> public int Insert(int nIndex, GLSubItem subItem) { subItem.Parent = this.m_Parent; subItem.ChangedEvent += new ChangedEventHandler(SubItem_Changed); if (nIndex < 0) { nIndex = List.Add(subItem); // add the subItem itself } else { List.Insert(nIndex, subItem); } if (ChangedEvent != null) { ChangedEvent(this, new ChangedEventArgs(ChangedTypes.SubItemCollectionChanged, null, null, subItem)); } return(nIndex); }
private void RefreshActivitiesList() { logGlacialList.Items.Clear(); try { foreach (ActivityPresentation t in _activities) { if (t.Entry.StartTime.Date < firstDateTimePicker.Value.Date) break; if (t.Entry.StartTime.Date > lastDateTimePicker.Value.Date) continue; if ((customersComboBox.SelectedIndex != 0) && (customersComboBox.Text != t.Entry.Customer)) continue; if (workTimeComboBox.SelectedIndex != 0) { if ((workTimeComboBox.SelectedIndex == 1) && ((t.Entry.StartTime.Hour < 7) || (t.Entry.StartTime.Hour >= 19) || (t.Entry.StartTime.DayOfWeek == DayOfWeek.Saturday) || (t.Entry.StartTime.DayOfWeek == DayOfWeek.Sunday))) continue; else if ((workTimeComboBox.SelectedIndex == 2) && ((t.Entry.StartTime.Hour >= 7) && (t.Entry.StartTime.Hour < 19) && (t.Entry.StartTime.DayOfWeek != DayOfWeek.Saturday) && (t.Entry.StartTime.DayOfWeek != DayOfWeek.Sunday))) continue; } GLItem glItem = new GLItem(logGlacialList); GLSubItem glSubItem; glSubItem = new GLSubItem(); glSubItem.Text = t.Entry.StartTime.Date.ToShortDateString(); glItem.SubItems.Add(glSubItem); glSubItem = new GLSubItem(); glSubItem.Text = t.Entry.Customer; glItem.SubItems.Add(glSubItem); glSubItem = new GLSubItem(); glSubItem.Text = t.Entry.Activity; glItem.SubItems.Add(glSubItem); glSubItem = new GLSubItem(); glSubItem.Text = t.Entry.StartTime.TimeOfDay.ToString(); glItem.SubItems.Add(glSubItem); glSubItem = new GLSubItem(); glSubItem.Text = t.Entry.StartTime.AddMinutes(t.Entry.WorkDuration).TimeOfDay.ToString(); glItem.SubItems.Add(glSubItem); glSubItem = new GLSubItem(); glSubItem.Text = t.Entry.WorkDuration.ToString(); glItem.SubItems.Add(glSubItem); glSubItem = new GLSubItem(); glSubItem.Text = t.Entry.TicketNumber; glItem.SubItems.Add(glSubItem); glSubItem = new GLSubItem(); glSubItem.Text = t.Entry.Comment; glItem.SubItems.Add(glSubItem); glItem.Tag = t; logGlacialList.Items.Add(glItem); } logGlacialList.Refresh(); } catch (Exception exception) { MessageBox.Show(exception.Message); } }
/// <summary> /// Indexer /// </summary> public GLSubItem this[ int nItemIndex ] { get { // int nTmpCount = 0; // if ( Parent == null ) // rare case when there is no parent set (almost always during collection editor) // nTmpCount = 255; // basically infinite during collection editor // else // nTmpCount = Parent.Columns.Count; int nBailout = 0; // check to make sure it exists first while ( List.Count <= nItemIndex ) { GLSubItem newitem = new GLSubItem(); newitem.ChangedEvent += new ChangedEventHandler( SubItem_Changed ); newitem.Parent = this.m_Parent; //newitem.Control = Parent.Columns[ nItemIndex ] List.Add( newitem ); // if the index doesn't yet exist, fill in the subitems till it does if ( nBailout++ > 25 ) break; } return (GLSubItem)List[nItemIndex]; } }
/// <summary> /// Add range of sub items /// </summary> /// <param name="subItems"></param> public void AddRange( GLSubItem[] subItems) { lock(List.SyncRoot) { for (int i=0; i<subItems.Length; i++) Add( subItems[i] ); } }
/// <summary> /// add an itemto the items collection /// </summary> /// <param name="subItem"></param> /// <returns></returns> public int Add(GLSubItem subItem) { return(Insert(-1, subItem)); }
/// <summary> /// lowest level of add/insert. All add and insert routines eventually call this /// /// in the future always have routines call this one as well to keep one point of entry /// </summary> /// <param name="nIndex"></param> /// <param name="subItem"></param> /// <returns></returns> public int Insert( int nIndex, GLSubItem subItem ) { subItem.Parent = this.m_Parent; subItem.ChangedEvent += new ChangedEventHandler( SubItem_Changed ); if ( nIndex < 0 ) nIndex = List.Add( subItem ); // add the subItem itself else List.Insert( nIndex, subItem ); if ( ChangedEvent != null ) ChangedEvent( this, new ChangedEventArgs( ChangedTypes.SubItemCollectionChanged, null, null, subItem ) ); return nIndex; }
/// <summary> /// Draw Sub Item (Cell) at location specified /// </summary> /// <param name="graphicsSubItem"></param> /// <param name="rectSubItem"></param> /// <param name="item"></param> /// <param name="subItem"></param> /// <param name="nColumn"></param> virtual public void DrawSubItem( Graphics graphicsSubItem, Rectangle rectSubItem, GLItem item, GLSubItem subItem, int nColumn ) { DW("DrawSubItem"); // precheck to make sure this is big enough for the things we want to do inside it Rectangle subControlRect = new Rectangle( rectSubItem.X, rectSubItem.Y, rectSubItem.Width, rectSubItem.Height ); if ( ( subItem.Control != null ) && (!subItem.ForceText ) ) { // custom embedded control here Control control = subItem.Control; if ( control.Parent != this ) // *** CRUCIAL *** this makes sure the parent is the list control control.Parent = this; // Rectangle subrc = new Rectangle( // subControlRect.X+this.CellPaddingSize, // subControlRect.Y+this.CellPaddingSize, // subControlRect.Width-this.CellPaddingSize*2, // subControlRect.Height-this.CellPaddingSize*2 ); Rectangle subrc = new Rectangle( subControlRect.X, subControlRect.Y+1, subControlRect.Width, subControlRect.Height-1 ); Type tp = control.GetType(); PropertyInfo pi = control.GetType().GetProperty( "PreferredHeight" ); if ( pi != null ) { int PreferredHeight = (int)pi.GetValue( control, null ); if ( ( (PreferredHeight + this.CellPaddingSize*2)> this.ItemHeight ) && AutoHeight ) this.ItemHeight = PreferredHeight + this.CellPaddingSize*2; subrc.Y = subControlRect.Y + ((subControlRect.Height - PreferredHeight)/2); } NewLiveControls.Add( control ); // put it in the new list, remove from old list if ( LiveControls.Contains( control ) ) // make sure its in the old list first { LiveControls.Remove( control ); // remove it from list so it doesn't get put down } if ( control.Bounds.ToString() != subrc.ToString() ) control.Bounds = subrc; // this will force an invalidation if ( control.Visible != true ) control.Visible = true; } else // not control based { // if the sub item color is not the same as the back color fo the control, AND the item is not selected, then color this sub item background if ( ( subItem.BackColor.ToArgb() != this.BackColor.ToArgb() ) && (!item.Selected) && ( subItem.BackColor != Color.White ) ) { SolidBrush bbrush = new SolidBrush( subItem.BackColor ); graphicsSubItem.FillRectangle( bbrush, rectSubItem ); bbrush.Dispose(); } // do we need checkboxes in this column or not? if ( this.Columns[ nColumn ].CheckBoxes ) rectSubItem = DrawCheckBox( graphicsSubItem, rectSubItem, subItem.Checked ); // if there is an image, this routine will RETURN with exactly the space left for everything else after the image is drawn (or not drawn due to lack of space) if ( (subItem.ImageIndex > -1) && (ImageList != null) && (subItem.ImageIndex < this.ImageList.Images.Count) ) rectSubItem = DrawCellGraphic( graphicsSubItem, rectSubItem, this.ImageList.Images[ subItem.ImageIndex ], subItem.ImageAlignment ); // deal with text color in a box on whether it is selected or not Color textColor; if ( item.Selected && this.Selectable ) textColor = this.SelectedTextColor; else { textColor = this.ForeColor; if ( item.ForeColor.ToArgb() != this.ForeColor.ToArgb() ) textColor = item.ForeColor; else if ( subItem.ForeColor.ToArgb() != this.ForeColor.ToArgb() ) textColor = subItem.ForeColor; } DrawCellText( graphicsSubItem, rectSubItem, subItem.Text, Columns[nColumn].TextAlignment, textColor, item.Selected, ItemWordWrap ); subItem.LastCellRect = rectSubItem; // important to ONLY catch the area where the text is drawn } }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); GlacialComponents.Controls.GLColumn glColumn1 = new GlacialComponents.Controls.GLColumn(); GlacialComponents.Controls.GLColumn glColumn2 = new GlacialComponents.Controls.GLColumn(); GlacialComponents.Controls.GLColumn glColumn3 = new GlacialComponents.Controls.GLColumn(); GlacialComponents.Controls.GLColumn glColumn4 = new GlacialComponents.Controls.GLColumn(); GlacialComponents.Controls.GLItem glItem1 = new GlacialComponents.Controls.GLItem(); GlacialComponents.Controls.GLSubItem glSubItem1 = new GlacialComponents.Controls.GLSubItem(); GlacialComponents.Controls.GLSubItem glSubItem2 = new GlacialComponents.Controls.GLSubItem(); GlacialComponents.Controls.GLSubItem glSubItem3 = new GlacialComponents.Controls.GLSubItem(); GlacialComponents.Controls.GLSubItem glSubItem4 = new GlacialComponents.Controls.GLSubItem(); GlacialComponents.Controls.GLItem glItem2 = new GlacialComponents.Controls.GLItem(); GlacialComponents.Controls.GLSubItem glSubItem5 = new GlacialComponents.Controls.GLSubItem(); GlacialComponents.Controls.GLSubItem glSubItem6 = new GlacialComponents.Controls.GLSubItem(); GlacialComponents.Controls.GLSubItem glSubItem7 = new GlacialComponents.Controls.GLSubItem(); GlacialComponents.Controls.GLSubItem glSubItem8 = new GlacialComponents.Controls.GLSubItem(); GlacialComponents.Controls.GLItem glItem3 = new GlacialComponents.Controls.GLItem(); GlacialComponents.Controls.GLSubItem glSubItem9 = new GlacialComponents.Controls.GLSubItem(); GlacialComponents.Controls.GLSubItem glSubItem10 = new GlacialComponents.Controls.GLSubItem(); GlacialComponents.Controls.GLSubItem glSubItem11 = new GlacialComponents.Controls.GLSubItem(); GlacialComponents.Controls.GLSubItem glSubItem12 = new GlacialComponents.Controls.GLSubItem(); GlacialComponents.Controls.GLItem glItem4 = new GlacialComponents.Controls.GLItem(); GlacialComponents.Controls.GLSubItem glSubItem13 = new GlacialComponents.Controls.GLSubItem(); GlacialComponents.Controls.GLSubItem glSubItem14 = new GlacialComponents.Controls.GLSubItem(); GlacialComponents.Controls.GLSubItem glSubItem15 = new GlacialComponents.Controls.GLSubItem(); GlacialComponents.Controls.GLSubItem glSubItem16 = new GlacialComponents.Controls.GLSubItem(); GlacialComponents.Controls.GLItem glItem5 = new GlacialComponents.Controls.GLItem(); GlacialComponents.Controls.GLSubItem glSubItem17 = new GlacialComponents.Controls.GLSubItem(); GlacialComponents.Controls.GLSubItem glSubItem18 = new GlacialComponents.Controls.GLSubItem(); GlacialComponents.Controls.GLSubItem glSubItem19 = new GlacialComponents.Controls.GLSubItem(); GlacialComponents.Controls.GLSubItem glSubItem20 = new GlacialComponents.Controls.GLSubItem(); System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1)); this.glacialList1 = new GlacialComponents.Controls.GlacialList(); this.imageList1 = new System.Windows.Forms.ImageList(this.components); this.mainMenu1 = new System.Windows.Forms.MainMenu(); this.menuItem1 = new System.Windows.Forms.MenuItem(); this.menuItem2 = new System.Windows.Forms.MenuItem(); this.SuspendLayout(); // // glacialList1 // this.glacialList1.AllowColumnResize = true; this.glacialList1.AllowMultiselect = false; this.glacialList1.AlternateBackground = System.Drawing.Color.ForestGreen; this.glacialList1.AlternatingColors = true; this.glacialList1.AutoHeight = true; this.glacialList1.BackColor = System.Drawing.SystemColors.ControlLightLight; this.glacialList1.BackgroundStretchToFit = true; glColumn1.ActivatedEmbeddedType = GlacialComponents.Controls.GLActivatedEmbeddedTypes.TextBox; glColumn1.CheckBoxes = true; glColumn1.ImageIndex = -1; glColumn1.Name = "Column1"; glColumn1.NumericSort = false; glColumn1.Text = "Name"; glColumn1.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; glColumn1.Width = 130; glColumn2.ActivatedEmbeddedType = GlacialComponents.Controls.GLActivatedEmbeddedTypes.DateTimePicker; glColumn2.CheckBoxes = false; glColumn2.ImageIndex = -1; glColumn2.Name = "Column2"; glColumn2.NumericSort = false; glColumn2.Text = "Released"; glColumn2.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; glColumn2.Width = 140; glColumn3.ActivatedEmbeddedType = GlacialComponents.Controls.GLActivatedEmbeddedTypes.None; glColumn3.CheckBoxes = false; glColumn3.ImageIndex = -1; glColumn3.Name = "Column3"; glColumn3.NumericSort = false; glColumn3.Text = "Download"; glColumn3.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; glColumn3.Width = 100; glColumn4.ActivatedEmbeddedType = GlacialComponents.Controls.GLActivatedEmbeddedTypes.None; glColumn4.CheckBoxes = false; glColumn4.ImageIndex = -1; glColumn4.Name = "Column4"; glColumn4.NumericSort = false; glColumn4.Text = "Rating"; glColumn4.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; glColumn4.Width = 100; this.glacialList1.Columns.AddRange(new GlacialComponents.Controls.GLColumn[] { glColumn1, glColumn2, glColumn3, glColumn4 }); this.glacialList1.ControlStyle = GlacialComponents.Controls.GLControlStyles.XP; this.glacialList1.Dock = System.Windows.Forms.DockStyle.Fill; this.glacialList1.FullRowSelect = true; this.glacialList1.GridColor = System.Drawing.Color.LightGray; this.glacialList1.GridLines = GlacialComponents.Controls.GLGridLines.gridBoth; this.glacialList1.GridLineStyle = GlacialComponents.Controls.GLGridLineStyles.gridSolid; this.glacialList1.GridTypes = GlacialComponents.Controls.GLGridTypes.gridOnExists; this.glacialList1.HeaderHeight = 22; this.glacialList1.HeaderVisible = true; this.glacialList1.HeaderWordWrap = false; this.glacialList1.HotColumnTracking = true; this.glacialList1.HotItemTracking = true; this.glacialList1.HotTrackingColor = System.Drawing.Color.LightGray; this.glacialList1.HoverEvents = false; this.glacialList1.HoverTime = 1; this.glacialList1.ImageList = this.imageList1; this.glacialList1.ItemHeight = 20; glItem1.BackColor = System.Drawing.Color.White; glItem1.ForeColor = System.Drawing.Color.Black; glItem1.RowBorderColor = System.Drawing.Color.Black; glItem1.RowBorderSize = 0; glSubItem1.BackColor = System.Drawing.Color.Empty; glSubItem1.Checked = false; glSubItem1.ForceText = false; glSubItem1.ForeColor = System.Drawing.Color.Black; glSubItem1.ImageAlignment = System.Windows.Forms.HorizontalAlignment.Left; glSubItem1.ImageIndex = -1; glSubItem1.Text = "Glacial List 1.3"; glSubItem2.BackColor = System.Drawing.Color.Empty; glSubItem2.Checked = false; glSubItem2.ForceText = false; glSubItem2.ForeColor = System.Drawing.Color.Black; glSubItem2.ImageAlignment = System.Windows.Forms.HorizontalAlignment.Left; glSubItem2.ImageIndex = -1; glSubItem2.Text = "1/7/2004"; glSubItem3.BackColor = System.Drawing.Color.Empty; glSubItem3.Checked = false; glSubItem3.ForceText = false; glSubItem3.ForeColor = System.Drawing.Color.Black; glSubItem3.ImageAlignment = System.Windows.Forms.HorizontalAlignment.Left; glSubItem3.ImageIndex = -1; glSubItem3.Text = "40"; glSubItem4.BackColor = System.Drawing.Color.Empty; glSubItem4.Checked = false; glSubItem4.ForceText = false; glSubItem4.ForeColor = System.Drawing.Color.Black; glSubItem4.ImageAlignment = System.Windows.Forms.HorizontalAlignment.Left; glSubItem4.ImageIndex = 2; glSubItem4.Text = ""; glItem1.SubItems.AddRange(new GlacialComponents.Controls.GLSubItem[] { glSubItem1, glSubItem2, glSubItem3, glSubItem4 }); glItem1.Text = "Glacial List 1.3"; glItem2.BackColor = System.Drawing.Color.White; glItem2.ForeColor = System.Drawing.Color.Black; glItem2.RowBorderColor = System.Drawing.Color.Black; glItem2.RowBorderSize = 0; glSubItem5.BackColor = System.Drawing.Color.Empty; glSubItem5.Checked = false; glSubItem5.ForceText = false; glSubItem5.ForeColor = System.Drawing.Color.Black; glSubItem5.ImageAlignment = System.Windows.Forms.HorizontalAlignment.Left; glSubItem5.ImageIndex = -1; glSubItem5.Text = "Glacial List 1.28"; glSubItem6.BackColor = System.Drawing.Color.Empty; glSubItem6.Checked = false; glSubItem6.ForceText = false; glSubItem6.ForeColor = System.Drawing.Color.Black; glSubItem6.ImageAlignment = System.Windows.Forms.HorizontalAlignment.Left; glSubItem6.ImageIndex = -1; glSubItem6.Text = "12/30/2003"; glSubItem7.BackColor = System.Drawing.Color.Empty; glSubItem7.Checked = false; glSubItem7.ForceText = false; glSubItem7.ForeColor = System.Drawing.Color.Black; glSubItem7.ImageAlignment = System.Windows.Forms.HorizontalAlignment.Left; glSubItem7.ImageIndex = -1; glSubItem7.Text = "90"; glSubItem8.BackColor = System.Drawing.Color.Empty; glSubItem8.Checked = false; glSubItem8.ForceText = false; glSubItem8.ForeColor = System.Drawing.Color.Black; glSubItem8.ImageAlignment = System.Windows.Forms.HorizontalAlignment.Left; glSubItem8.ImageIndex = 2; glSubItem8.Text = ""; glItem2.SubItems.AddRange(new GlacialComponents.Controls.GLSubItem[] { glSubItem5, glSubItem6, glSubItem7, glSubItem8 }); glItem2.Text = "Glacial List 1.28"; glItem3.BackColor = System.Drawing.Color.White; glItem3.ForeColor = System.Drawing.Color.Black; glItem3.RowBorderColor = System.Drawing.Color.Black; glItem3.RowBorderSize = 0; glSubItem9.BackColor = System.Drawing.Color.Empty; glSubItem9.Checked = false; glSubItem9.ForceText = false; glSubItem9.ForeColor = System.Drawing.Color.Black; glSubItem9.ImageAlignment = System.Windows.Forms.HorizontalAlignment.Left; glSubItem9.ImageIndex = -1; glSubItem9.Text = "Glacial List 1.26"; glSubItem10.BackColor = System.Drawing.Color.Empty; glSubItem10.Checked = false; glSubItem10.ForceText = false; glSubItem10.ForeColor = System.Drawing.Color.Black; glSubItem10.ImageAlignment = System.Windows.Forms.HorizontalAlignment.Left; glSubItem10.ImageIndex = -1; glSubItem10.Text = "12/22/2003"; glSubItem11.BackColor = System.Drawing.Color.Empty; glSubItem11.Checked = false; glSubItem11.ForceText = false; glSubItem11.ForeColor = System.Drawing.Color.Black; glSubItem11.ImageAlignment = System.Windows.Forms.HorizontalAlignment.Left; glSubItem11.ImageIndex = -1; glSubItem11.Text = "80"; glSubItem12.BackColor = System.Drawing.Color.Empty; glSubItem12.Checked = false; glSubItem12.ForceText = false; glSubItem12.ForeColor = System.Drawing.Color.Black; glSubItem12.ImageAlignment = System.Windows.Forms.HorizontalAlignment.Left; glSubItem12.ImageIndex = 1; glSubItem12.Text = ""; glItem3.SubItems.AddRange(new GlacialComponents.Controls.GLSubItem[] { glSubItem9, glSubItem10, glSubItem11, glSubItem12 }); glItem3.Text = "Glacial List 1.26"; glItem4.BackColor = System.Drawing.Color.White; glItem4.ForeColor = System.Drawing.Color.Black; glItem4.RowBorderColor = System.Drawing.Color.Black; glItem4.RowBorderSize = 0; glSubItem13.BackColor = System.Drawing.Color.Empty; glSubItem13.Checked = false; glSubItem13.ForceText = false; glSubItem13.ForeColor = System.Drawing.Color.Black; glSubItem13.ImageAlignment = System.Windows.Forms.HorizontalAlignment.Left; glSubItem13.ImageIndex = -1; glSubItem13.Text = "Glacial List 1.1"; glSubItem14.BackColor = System.Drawing.Color.Empty; glSubItem14.Checked = false; glSubItem14.ForceText = false; glSubItem14.ForeColor = System.Drawing.Color.Black; glSubItem14.ImageAlignment = System.Windows.Forms.HorizontalAlignment.Left; glSubItem14.ImageIndex = -1; glSubItem14.Text = "7/9/2003"; glSubItem15.BackColor = System.Drawing.Color.Empty; glSubItem15.Checked = false; glSubItem15.ForceText = false; glSubItem15.ForeColor = System.Drawing.Color.Black; glSubItem15.ImageAlignment = System.Windows.Forms.HorizontalAlignment.Left; glSubItem15.ImageIndex = -1; glSubItem15.Text = "Done"; glSubItem16.BackColor = System.Drawing.Color.Empty; glSubItem16.Checked = false; glSubItem16.ForceText = false; glSubItem16.ForeColor = System.Drawing.Color.Black; glSubItem16.ImageAlignment = System.Windows.Forms.HorizontalAlignment.Left; glSubItem16.ImageIndex = 1; glSubItem16.Text = ""; glItem4.SubItems.AddRange(new GlacialComponents.Controls.GLSubItem[] { glSubItem13, glSubItem14, glSubItem15, glSubItem16 }); glItem4.Text = "Glacial List 1.1"; glItem5.BackColor = System.Drawing.Color.White; glItem5.ForeColor = System.Drawing.Color.Black; glItem5.RowBorderColor = System.Drawing.Color.Black; glItem5.RowBorderSize = 0; glSubItem17.BackColor = System.Drawing.Color.Empty; glSubItem17.Checked = false; glSubItem17.ForceText = false; glSubItem17.ForeColor = System.Drawing.Color.Black; glSubItem17.ImageAlignment = System.Windows.Forms.HorizontalAlignment.Left; glSubItem17.ImageIndex = -1; glSubItem17.Text = "Glacial List 1.0"; glSubItem18.BackColor = System.Drawing.Color.Empty; glSubItem18.Checked = false; glSubItem18.ForceText = false; glSubItem18.ForeColor = System.Drawing.Color.Black; glSubItem18.ImageAlignment = System.Windows.Forms.HorizontalAlignment.Left; glSubItem18.ImageIndex = -1; glSubItem18.Text = "6/13/2003"; glSubItem19.BackColor = System.Drawing.Color.Empty; glSubItem19.Checked = false; glSubItem19.ForceText = false; glSubItem19.ForeColor = System.Drawing.Color.Black; glSubItem19.ImageAlignment = System.Windows.Forms.HorizontalAlignment.Left; glSubItem19.ImageIndex = -1; glSubItem19.Text = "23"; glSubItem20.BackColor = System.Drawing.Color.Empty; glSubItem20.Checked = false; glSubItem20.ForceText = false; glSubItem20.ForeColor = System.Drawing.Color.Black; glSubItem20.ImageAlignment = System.Windows.Forms.HorizontalAlignment.Left; glSubItem20.ImageIndex = 0; glSubItem20.Text = ""; glItem5.SubItems.AddRange(new GlacialComponents.Controls.GLSubItem[] { glSubItem17, glSubItem18, glSubItem19, glSubItem20 }); glItem5.Text = "Glacial List 1.0"; this.glacialList1.Items.AddRange(new GlacialComponents.Controls.GLItem[] { glItem1, glItem2, glItem3, glItem4, glItem5 }); this.glacialList1.ItemWordWrap = false; this.glacialList1.Location = new System.Drawing.Point(0, 0); this.glacialList1.Name = "glacialList1"; this.glacialList1.Selectable = true; this.glacialList1.SelectedTextColor = System.Drawing.Color.White; this.glacialList1.SelectionColor = System.Drawing.Color.DarkBlue; this.glacialList1.ShowBorder = true; this.glacialList1.ShowFocusRect = false; this.glacialList1.Size = new System.Drawing.Size(496, 174); this.glacialList1.SortType = GlacialComponents.Controls.SortTypes.MergeSort; this.glacialList1.SuperFlatHeaderColor = System.Drawing.Color.White; this.glacialList1.TabIndex = 0; this.glacialList1.Text = "glacialList1"; // // imageList1 // this.imageList1.ImageSize = new System.Drawing.Size(80, 16); this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream"))); this.imageList1.TransparentColor = System.Drawing.Color.Transparent; // // mainMenu1 // this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.menuItem1 }); // // menuItem1 // this.menuItem1.Index = 0; this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.menuItem2 }); this.menuItem1.Text = "test"; // // menuItem2 // this.menuItem2.Index = 0; this.menuItem2.Text = "test2"; // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(496, 174); this.Controls.Add(this.glacialList1); this.Menu = this.mainMenu1; this.Name = "Form1"; this.Text = "Form1"; this.Load += new System.EventHandler(this.Form1_Load); this.ResumeLayout(false); }
public bool GLLoad(GLItem item, GLSubItem subItem, GlacialList listctrl) { this.Format = DateTimePickerFormat.Long; try { m_item = item; m_subItem = subItem; m_Parent = listctrl; this.Text = subItem.Text; //this.Value = subItem.Text; } catch ( Exception ex ) { Debug.WriteLine( ex.ToString() ); this.Text = DateTime.Now.ToString(); } return true; }
private void GetData() { logGlacialList.Items.Clear(); try { _claimData = _service.GetActivitiesForClaim(_settings["AdminID"], _clientVersion, _startDay); foreach (ClaimStruct claimItem in _claimData) { GLItem glItem = new GLItem(logGlacialList); glItem.Tag = new ActivityPresentation(claimItem); GLSubItem glSubItem; glSubItem = new GLSubItem(); glSubItem.Text = claimItem.Activity.StartTime.Date.ToShortDateString(); glItem.SubItems.Add(glSubItem); glSubItem = new GLSubItem(); glSubItem.Text = claimItem.Activity.Customer; glItem.SubItems.Add(glSubItem); glSubItem = new GLSubItem(); glSubItem.Text = claimItem.Activity.Activity; glItem.SubItems.Add(glSubItem); glSubItem = new GLSubItem(); glSubItem.Text = claimItem.Activity.StartTime.TimeOfDay.ToString(); glItem.SubItems.Add(glSubItem); glSubItem = new GLSubItem(); glSubItem.Text = claimItem.Activity.WorkDuration.ToString(); glItem.SubItems.Add(glSubItem); glSubItem = new GLSubItem(); glSubItem.Text = claimItem.Activity.TicketNumber; glItem.SubItems.Add(glSubItem); glSubItem = new GLSubItem(); glSubItem.Text = claimItem.StandardClaim.ToString(); glItem.SubItems.Add(glSubItem); glSubItem = new GLSubItem(); glSubItem.Text = claimItem.PlannedOvertime.ToString(); glItem.SubItems.Add(glSubItem); glSubItem = new GLSubItem(); glSubItem.Text = claimItem.ClaimCode.Account; if (claimItem.StandardClaim) glSubItem.ForeColor = Color.Gray; glItem.SubItems.Add(glSubItem); glSubItem = new GLSubItem(); glSubItem.Text = claimItem.ClaimCode.WorkItem; if (claimItem.StandardClaim) glSubItem.ForeColor = Color.Gray; glItem.SubItems.Add(glSubItem); glSubItem = new GLSubItem(); glSubItem.Text = claimItem.Activity.Comment; glItem.SubItems.Add(glSubItem); logGlacialList.Items.Add(glItem); } } catch (System.Web.Services.Protocols.SoapException exception) { if (exception.Message == "No activity entries") this._claimData = new ClaimStruct[0]; } catch (Exception exception) { MessageBox.Show(exception.Message, "Getting claim data error", MessageBoxButtons.OK, MessageBoxIcon.Error); } logGlacialList.Refresh(); }
/// <summary> /// remove an item from the list /// </summary> /// <param name="subItem"></param> public void Remove( GLSubItem subItem ) { List.Remove( subItem ); if ( ChangedEvent != null ) ChangedEvent( this, new ChangedEventArgs( ChangedTypes.SubItemCollectionChanged, null, null, null ) ); }
public bool GLLoad( GLItem item, GLSubItem subItem, GlacialList listctrl ) // populate this control however you wish with item { // set the styles you want for this this.BorderStyle = BorderStyle.None; this.AutoSize = false; m_item = item; m_subItem = subItem; m_Parent = listctrl; this.Text = subItem.Text; return true; // we don't do any heavy processing in this ctrl so we just return true }
/// <summary> /// add an itemto the items collection /// </summary> /// <param name="subItem"></param> /// <returns></returns> public int Add( GLSubItem subItem ) { return Insert( -1, subItem ); }
public bool GLLoad(GLItem item, GLSubItem subItem, GlacialList listctrl) { m_item = item; m_subItem = subItem; m_Parent = listctrl; this.Text = subItem.Text; this.Items.Add( "i1" ); this.Items.Add( "i2" ); this.Items.Add( "i3" ); return true; }
/// <summary> /// insert an item into the list at specified index /// </summary> /// <param name="nIndex"></param> /// <param name="strItemText"></param> /// <returns></returns> public GLSubItem Insert( int nIndex, string strItemText ) { GLSubItem subItem = new GLSubItem(); //GLItem item = new GLItem(Parent); //item.SubItems[0].Text = strItemText; nIndex = Insert( nIndex, subItem ); return subItem; }
/// <summary> /// Changes in the columns, items or subitems /// </summary> /// <param name="ctType"></param> /// <param name="column"></param> /// <param name="item"></param> /// <param name="subItem"></param> public ChangedEventArgs( ChangedTypes ctType, GLColumn column, GLItem item, GLSubItem subItem ) { m_Column = column; m_Item = item; m_SubItem = subItem; m_ctType = ctType; }
/// <summary> /// Instance the activated embeddec control for this item/column /// </summary> /// <param name="nColumn"></param> /// <param name="item"></param> /// <param name="subItem"></param> protected void ActivateEmbeddedControl( int nColumn, GLItem item, GLSubItem subItem ) { if ( this.m_ActivatedEmbeddedControl != null ) { this.m_ActivatedEmbeddedControl.Dispose(); this.m_ActivatedEmbeddedControl = null; } /* using activator.createinstance typeof()/GetType Type t = obj.GetType() */ if ( Columns[nColumn].ActivatedEmbeddedControlTemplate == null ) return; Type type = Columns[nColumn].ActivatedEmbeddedControlTemplate.GetType(); Control control = (Control)Activator.CreateInstance( type ); GLEmbeddedControl icontrol = (GLEmbeddedControl)control; if ( icontrol == null ) throw new Exception( @"Control does not implement the GLEmbeddedControl interface, can't start" ); icontrol.GLLoad( item, subItem, this ); //control.LostFocus += new EventHandler( ActivatedEmbbed_LostFocus ); control.KeyPress += new KeyPressEventHandler(tb_KeyPress); control.Parent = this; this.ActivatedEmbeddedControl = control; //subItem.Control = control; // seed the control int nYOffset = (subItem.LastCellRect.Height - m_ActivatedEmbeddedControl.Bounds.Height) / 2; Rectangle controlBounds; if ( this.GridLineStyle == GLGridLineStyles.gridNone ) { // add 1 to x to give border, add 2 to Y because to account for possible grid that you must cover up controlBounds = new Rectangle( subItem.LastCellRect.X+1, subItem.LastCellRect.Y+1, subItem.LastCellRect.Width-3, subItem.LastCellRect.Height-2 ); } else { // add 1 to x to give border, add 2 to Y because to account for possible grid that you must cover up controlBounds = new Rectangle( subItem.LastCellRect.X+1, subItem.LastCellRect.Y+2, subItem.LastCellRect.Width-3, subItem.LastCellRect.Height-3 ); } //control.Bounds = subItem.LastCellRect; //new Rectangle( subItem.LastCellRect.X, subItem.LastCellRect.Y + nYOffset, subItem.LastCellRect.Width, subItem.LastCellRect.Height ); control.Bounds = controlBounds; control.Show(); control.Focus(); }