本文整理汇总了C#中System.Windows.Forms.ListView类的典型用法代码示例。如果您正苦于以下问题:C# ListView类的具体用法?C# ListView怎么用?C# ListView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ListView类属于System.Windows.Forms命名空间,在下文中一共展示了ListView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TagListViewProcessor
public TagListViewProcessor(ListView listview)
{
_TagTable = new Hashtable(1023);
_Tags = new Stack<string>();
_Item_LV = listview;
_Item_LV.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this._Item_LV_ItemCheck);
}
示例2: InitializeComponent
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.lvwFields = new System.Windows.Forms.ListView();
this.columnHeader1 = new System.Windows.Forms.ColumnHeader();
this.SuspendLayout();
//
// lvwFields
//
this.lvwFields.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)));
this.lvwFields.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader1});
this.lvwFields.FullRowSelect = true;
this.lvwFields.HideSelection = false;
this.lvwFields.Location = new System.Drawing.Point(0, 0);
this.lvwFields.Name = "lvwFields";
this.lvwFields.Size = new System.Drawing.Size(320, 200);
this.lvwFields.TabIndex = 0;
this.lvwFields.View = System.Windows.Forms.View.Details;
//
// columnHeader1
//
this.columnHeader1.Text = "Fields";
this.columnHeader1.Width = 400;
//
// ucPick_Fields
//
this.Controls.Add(this.lvwFields);
this.Name = "ucPick_Fields";
this.Size = new System.Drawing.Size(320, 184);
this.ResumeLayout(false);
}
示例3: ItemFinder
public ItemFinder(ListView lv)
{
itemPos = new HVH_Ken_Modules.ItemPosite(lv);
m_Lv = lv;
lv.MultiSelect = false;
InitializeComponent();
}
示例4: ClearlvItem
public static void ClearlvItem(ListView lv)
{
if (lv.Items.Count > 0)
{
lv.Items.Clear();
}
}
示例5: DownloadDocument
public string DownloadDocument(ListView fileList)
{
var filePath = string.Empty;
ListViewItem item = fileList.SelectedItems[0];
// Strip off 'Root' from the full path
var path = item.SubItems[1].Text;
filePath = Properties.Settings.Default.DefaultPath.ToString() + path;
if (!string.IsNullOrEmpty(filePath))
{
// Get the file from the server
using (var output = new FileStream(filePath, FileMode.Create))
{
Stream downloadStream;
using (var client = new TemplateManagerClient())
{
downloadStream = client.GetFile(path);
}
downloadStream.CopyTo(output);
}
return filePath;
}
return string.Empty;
}
示例6: autoSizeColumnsFor
private static void autoSizeColumnsFor(ListView view)
{
view.Columns["Name"].Width = -1;
// view.Columns["Location"].Width = -1;
// view.Columns["DamageVsLarge"].Width = -2;
// view.Columns["DamageVsMedium"].Width = -2;
}
示例7: CheckedLVItemDXList
public CheckedLVItemDXList(ListView lv)
{
if(lv == null) throw new ArgumentNullException("lv");
m_lv = lv;
m_lv.ItemChecked += this.OnItemCheckedChanged;
}
示例8: InitializeComponent
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.listView = new System.Windows.Forms.ListView();
this.SuspendLayout();
//
// listView
//
this.listView.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.listView.Dock = System.Windows.Forms.DockStyle.Fill;
this.listView.FullRowSelect = true;
this.listView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
this.listView.HideSelection = false;
this.listView.Location = new System.Drawing.Point(0, 0);
this.listView.MultiSelect = false;
this.listView.Name = "listView";
this.listView.Size = new System.Drawing.Size(292, 300);
this.listView.TabIndex = 0;
this.listView.TabStop = false;
this.listView.View = System.Windows.Forms.View.Details;
//
// QuickListForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 300);
this.Controls.Add(this.listView);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Name = "QuickListForm";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.TopMost = true;
this.ResumeLayout(false);
}
示例9: AddToListview
internal static void AddToListview(ListView list, KontoEntry entry)
{
// Sätt mellanslagstecken ifall en strän i listan kommer att bli tom eller null, så att det finns något att klicka på och så det inte uppstår exception senare.
entry.ForUi = true;
var kontoEntryElements = entry.RowToSaveToUiSwitched; // RowToSaveForThis;
entry.ForUi = false;
// for (var itemIndex = 0; itemIndex < kontoEntryElements.Length; itemIndex++)//hm, denna kan man nog inte ha här o räkna med bra resultat, men o andra sidan så är det bara för att comboboxen ska dyka upp visuellt, så detta e lugnt
// {
// if (string.IsNullOrEmpty(kontoEntryElements[itemIndex])) {
// kontoEntryElements[itemIndex] = " ";//kanska kan göras på annat ställe
// }
// }
// System.Windows.Forms.ListViewItem listViewItem1 = new System.Windows.Forms.ListViewItem(new string[] {
// "Neww"}, -1, System.Drawing.Color.Lime, System.Drawing.Color.Empty, null);
// byt plats på typavkat och kostnad
// var kostnad = kontoEntryElements[2];
// var typAvkostnad = kontoEntryElements[5];
// kontoEntryElements[2] = typAvkostnad;
// kontoEntryElements[5] = typAvkostnad;
list.Items.Add(new ListViewItem(kontoEntryElements, -1, entry.FontFrontColor, Color.Empty, null)).Tag =
entry;
// man slipper lite tecken och castningarna o likhetstecknet, iom att detta är en fkn//Overkill? hehe, anal. Trodde jag...nu fick jag ju nytta av det så det så
}
示例10: Popola
public static void Popola(ref ListView aListView, IList aListOfData)
{
aListView.SuspendLayout();
aListView.BeginUpdate();
aListView.Items.Clear();
if (ListUtils.isNotEmpty(aListOfData))
{
foreach (object item in aListOfData)
{
if (item is IListViewItemable)
{
aListView.Items.Add(((IListViewItemable)item).toListViewItem());
}
else if (item is DateTime)
{
ListViewItem dateItem = new ListViewItem(item.ToString());
dateItem.Tag = item;
aListView.Items.Add(dateItem);
}
else
{
aListView.Items.Add(((IListViewItemable)item).ToString());
}
}
}
aListView.EndUpdate();
aListView.ResumeLayout();
}
示例11: changeHardwareDetails
// This subroutine is a shortcut that changes the detail-list data on-screen if dropdown selectors are changed
// It also plays a part in initialisation
private void changeHardwareDetails(object hardwareInstance, ListView list)
{
// Clear the list
list.Items.Clear();
if (hardwareInstance != null)
{
// Get the properties of the given hardware class
FieldInfo[] classFields = hardwareInstance.GetType().GetFields();
string name, value;
// Loop through each field in the class
foreach (FieldInfo field in classFields)
{
// Extract the field name (format it)
name = fieldToString(field.Name);
// Extract the value
value = Convert.ToString(field.GetValue(hardwareInstance));
// If the value is zero or blank, output N/A
if (value == "0" || value == "") value = "N/A";
// Add the value to the list
list.Items.Add(new ListViewItem(new string[] {
name,
value
}));
}
// Resize columns
list.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
// Make last column fill the remaining width
list.Columns[list.Columns.Count - 1].Width = -2;
}
}
示例12: ValidateAndSelectProjectFile
public static void ValidateAndSelectProjectFile(string XmlFileName, ListView lstSelectProject, AppWin_Si4460_CP_ProjectData projectData)
{
XmlDocument xmlSerialisedForm = new XmlDocument();
xmlSerialisedForm.Load(XmlFileName);
AppWin_Si4460_CP_ProjectData data = ValidateProject(xmlSerialisedForm, projectData.ChipType, projectData.ChipRevision, projectData.Version);
SelectProject(lstSelectProject, data.ProjectName);
}
示例13: ModulesController
public ModulesController(ListView listView)
: base(listView)
{
Columns.Add(new StandardColumn_Int(
IDS.Modules_Column_ID,
(int)ModuleItemTypes.ID));
Columns.Add(new StandardColumn(
IDS.Modules_Column_Name,
(int)ModuleItemTypes.Name));
Columns.Add(new StandardColumn(
IDS.Modules_Column_Path,
(int)ModuleItemTypes.Path));
Columns.Add(new StandardColumn_Int(
IDS.Modules_Column_ModuleMemorySize,
(int)ModuleItemTypes.ModuleMemorySize));
Columns.Add(new StandardColumn(
IDS.Modules_Column_FileDescription,
(int)ModuleItemTypes.FileDescription));
Columns.Add(new StandardColumn(
IDS.Modules_Column_FileVersion,
(int)ModuleItemTypes.FileVersion));
Columns.Add(new StandardColumn(
IDS.Modules_Column_Product,
(int)ModuleItemTypes.Product));
Columns.Add(new StandardColumn(
IDS.Modules_Column_ProductVersion,
(int)ModuleItemTypes.ProductVersion));
}
示例14: AddLanguageToView
private void AddLanguageToView(string addon_resource, string language, ListView list)
{
try
{
if (languages.ContainsKey(language))
{
languages[language] = LoadPO(language, addon_resource);
}
else
{
ColumnHeader[] ch = new ColumnHeader[] { new ColumnHeader() };
LanguageInfo lng = LoadPO(language, addon_resource);
languages.Add(language, lng);
ch[0].Text = string.Format("Translation({0})", lng.RevisionInfo["Language"].Replace(@"\n", ""));
ch[0].Width = list.Columns[2].Width;
list.Columns.AddRange(ch);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
示例15: frmReceiptsRecordDialog
public frmReceiptsRecordDialog(ListView lvMain, List<ConsumeMachineMaster_cmm_Info> cmmList)
{
InitializeComponent();
this._lvMain = lvMain;
this._cmmList = cmmList;
_lvList = new List<int>();
foreach(ListViewItem lvItem in _lvMain.CheckedItems)
{
//_lvList.Add(lvItem.Index);
//try
//{
// _lvList.Add(Int32.Parse(lvItem.SubItems[2].ToString()));
//}
//catch
//{
//}
try
{
string s = lvItem.SubItems[2].Text;
_lvList.Add(Int32.Parse(lvItem.SubItems[2].Text));
}
catch
{
}
}
}