public object GetListViewExItemPropertyValue(ListViewEmbeddedControls.ListViewEx p_oListViewEx, int p_intItem, string p_strPropName, bool p_bCallback) { if (p_bCallback == false) { m_oReturnValue = null; } if (p_oListViewEx.InvokeRequired) { GetListViewExItemPropertyValueCallback d = new GetListViewExItemPropertyValueCallback(GetListViewExItemPropertyValue); p_oListViewEx.Invoke(d, new object[] { p_oListViewEx, p_intItem, p_strPropName, true }); } else { Type t = p_oListViewEx.Items[p_intItem].GetType(); System.Reflection.PropertyInfo[] props = t.GetProperties(); foreach (System.Reflection.PropertyInfo p in props) { if (p.Name.Trim().ToUpper() == p_strPropName.Trim().ToUpper()) { m_oReturnValue = p.GetValue(p_oListViewEx.Items[p_intItem], null); break; } } } if (m_oReturnValue == null && p_bCallback == false) { m_oReturnValue = false; } return(m_oReturnValue); }
public void SetListViewExTextValue(ListViewEmbeddedControls.ListViewEx p_oListViewEx, int p_intRow, int p_intCol, string p_strValue) { if (p_oListViewEx.InvokeRequired) { SetListViewExTextValueCallback d = new SetListViewExTextValueCallback(SetListViewExTextValue); p_oListViewEx.Invoke(d, new object[] { p_oListViewEx, p_intRow, p_intCol, p_strValue }); } else { p_oListViewEx.Items[p_intRow].SubItems[p_intCol].Text = p_strValue; } }
public void EnsureListViewExItemVisible( ListViewEmbeddedControls.ListViewEx p_oListViewEx, int p_intItem) { if (p_oListViewEx.InvokeRequired) { EnsureListViewExItemVisibleCallback d = new EnsureListViewExItemVisibleCallback(EnsureListViewExItemVisible); p_oListViewEx.Invoke( d, new object[] { p_oListViewEx, p_intItem }); } else { p_oListViewEx.EnsureVisible(p_intItem); } }
public void SetListViewExItemPropertyValue(ListViewEmbeddedControls.ListViewEx p_oListViewEx, int p_intItem, string p_strPropName, object p_oPropValue) { if (p_oListViewEx.InvokeRequired) { SetListViewExItemPropertyValueCallback d = new SetListViewExItemPropertyValueCallback(SetListViewExItemPropertyValue); p_oListViewEx.Invoke(d, new object[] { p_oListViewEx, p_intItem, p_strPropName, p_oPropValue }); } else { Type t = p_oListViewEx.Items[p_intItem].GetType(); System.Reflection.PropertyInfo[] props = t.GetProperties(); foreach (System.Reflection.PropertyInfo p in props) { if (p.Name.Trim().ToUpper() == p_strPropName.Trim().ToUpper()) { p.SetValue(p_oListViewEx.Items[p_intItem], p_oPropValue, null); } } } }
public int GetListViewExCheckedItemsCount(ListViewEmbeddedControls.ListViewEx p_oListViewEx, bool p_bCallback) { if (p_bCallback == false) { m_intReturnValue = -1; } if (p_oListViewEx.InvokeRequired) { GetListViewExCheckedItemsCountCallback d = new GetListViewExCheckedItemsCountCallback(GetListViewExCheckedItemsCount); p_oListViewEx.Invoke(d, new object[] { p_oListViewEx, true }); } else { m_intReturnValue = p_oListViewEx.CheckedItems.Count; } if (m_intReturnValue == -1 && p_bCallback == false) { m_intReturnValue = 0; } return(m_intReturnValue); }
public uc_optimizer_scenario_select_packages() { // This call is required by the Windows.Forms Form Designer. InitializeComponent(); lstRxPackages = new ListViewEmbeddedControls.ListViewEx(); this.groupBox1.Controls.Add(lstRxPackages); lstRxPackages.Size = this.listView1.Size; lstRxPackages.Location = this.listView1.Location; lstRxPackages.CheckBoxes = true; lstRxPackages.AllowColumnReorder = true; lstRxPackages.FullRowSelect = false; lstRxPackages.GridLines = true; lstRxPackages.MultiSelect = false; lstRxPackages.View = System.Windows.Forms.View.Details; lstRxPackages.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(lstRxPackages_ColumnClick); lstRxPackages.MouseUp += new System.Windows.Forms.MouseEventHandler(lstRxPackages_MouseUp); lstRxPackages.SelectedIndexChanged += new System.EventHandler(lstRxPackages_SelectedIndexChanged); // listView1.Hide(); lstRxPackages.Show(); if (frmMain.g_oGridViewFont != null) { lstRxPackages.Font = frmMain.g_oGridViewFont; } this.m_oLvRowColors.ReferenceListView = this.lstRxPackages; this.m_oLvRowColors.ReferenceBackgroundColor = frmMain.g_oGridViewRowBackgroundColor; this.m_oLvRowColors.ReferenceForegroundColor = frmMain.g_oGridViewRowForegroundColor; this.m_oLvRowColors.ReferenceAlternateBackgroundColor = frmMain.g_oGridViewAlternateRowBackgroundColor; this.m_oLvRowColors.ReferenceAlternateForegroundColor = frmMain.g_oGridViewRowForegroundColor; this.m_oLvRowColors.ReferenceSelectedRowBackgroundColor = frmMain.g_oGridViewSelectedRowBackgroundColor; this.m_oLvRowColors.CustomFullRowSelect = true; // TODO: Add any initialization after the InitializeComponent call }
public string GetListViewExTextValue(ListViewEmbeddedControls.ListViewEx p_oListViewEx, int p_intRow, int p_intCol, bool p_bCallback) { if (p_bCallback == false) { m_strPropertyValue = "?"; } if (p_oListViewEx.InvokeRequired) { GetListViewExTextValueCallback d = new GetListViewExTextValueCallback(GetListViewExTextValue); p_oListViewEx.Invoke(d, new object[] { p_oListViewEx, p_intRow, p_intCol, true }); } else { m_strPropertyValue = p_oListViewEx.Items[p_intRow].SubItems[p_intCol].Text.Trim(); } if (m_strPropertyValue == "?" && p_bCallback == false) { m_strPropertyValue = ""; } return(m_strPropertyValue); }
private void CreateMyListView() { // Create a new ListView control. listView1 = new ListViewEmbeddedControls.ListViewEx(); listView1.Bounds = new Rectangle(new Point(10, 10), new Size(300, 200)); listView1.Dock = DockStyle.Fill; // Set the view to show details. listView1.View = View.Details; // Allow the user to edit item text. // listView1.LabelEdit = true; // Allow the user to rearrange columns. //listView1.AllowColumnReorder = true; // Display check boxes. listView1.CheckBoxes = true; // Select the item and sub items when selection is made. // listView1.FullRowSelect = true; // Display grid lines. // listView1.GridLines = true; // Sort the items in the list in ascending order. // listView1.Sorting = SortOrder.Ascending; // Create three items and three sets of subitems for each item. ListViewItem item1 = new ListViewItem(""); // Place a check mark next to the item. item1.SubItems.Add(""); item1.SubItems.Add(""); item1.SubItems.Add(""); item1.SubItems.Add(""); ListViewItem item2 = new ListViewItem(""); item2.SubItems.Add(""); item2.SubItems.Add(""); item2.SubItems.Add(""); ListViewItem item3 = new ListViewItem(""); // Place a check mark next to the item. item3.SubItems.Add(""); item3.SubItems.Add(""); item3.SubItems.Add(""); // Create columns for the items and sub items. listView1.Columns.Add("", -1, HorizontalAlignment.Left); listView1.Columns[0].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); listView1.Columns.Add("", -2, HorizontalAlignment.Left); listView1.Columns[1].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); listView1.Columns.Add("3", -2, HorizontalAlignment.Left); listView1.Columns[2].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); listView1.Columns.Add("", -2, HorizontalAlignment.Center); listView1.Columns[3].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); //Add the items to the ListView. listView1.Items.AddRange(new ListViewItem[] { item1, item2, item3 }); // Add the ListView to the control collection. this.Controls.Add(listView1); }