本文整理汇总了C#中System.Windows.Forms.ListViewItem类的典型用法代码示例。如果您正苦于以下问题:C# ListViewItem类的具体用法?C# ListViewItem怎么用?C# ListViewItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ListViewItem类属于System.Windows.Forms命名空间,在下文中一共展示了ListViewItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Prepare
public override void Prepare()
{
this.titleLabel.Text = Resources.CreateVotingTitle;
this.descriptionLabel.Text = Resources.CreateVotingDescription;
this.urlLabel.Text = Resources.CreateVotingUrl;
this.clearButton.Text = Resources.CreateVotingClearButton;
this.questionLabel.Text = Resources.CreateVotingQuestions;
this.textColumnHeader.Text = Resources.CreateVotingQuestionText;
this.descriptionColumnHeader.Text = Resources.CreateVotingQuestionDescription;
this.nextButton.Text = GuiResources.ButtonNext;
this.cancelButton.Text = GuiResources.ButtonCancel;
Status.Data = VotingData.TryLoad(Status.Controller.Status.DataPath);
if (Status.Data != null)
{
this.titleBox.Text = Status.Data.Title;
this.descriptionBox.Text = Status.Data.Descrption;
this.urlTextBox.Text = Status.Data.Url;
foreach (var question in Status.Data.Questions)
{
ListViewItem item = new ListViewItem(question.Text.AllLanguages);
item.SubItems.Add(question.Description.AllLanguages);
item.Tag = question;
this.questionListView.Items.Add(item);
}
}
CheckEnable();
}
示例2: RebuildGroupings
private void RebuildGroupings()
{
lvwGroupings.BeginUpdate();
try
{
lvwGroupings.Items.Clear();
int totalCount = _dupeSet.Count();
int currentFile = 1;
foreach (IGrouping<string, ChecksumFile> group in _dupeSet)
{
int groupCount = group.Where(p => p.IsDeleted == false).Count();
if (groupCount > 1)
{
ListViewItem item = new ListViewItem();
item.Text = string.Format("{0:#,0} / {1:#,0}", currentFile, totalCount);
item.SubItems.Add(groupCount.ToString());
item.Tag = group;
lvwGroupings.Items.Add(item);
}
currentFile++;
}
if (lvwGroupings.Items.Count > 0)
lvwGroupings.SelectedIndices.Add(0);
}
finally
{
lvwGroupings.EndUpdate();
}
}
示例3: bindPiclist
void bindPiclist()
{
this.picList.Clear();
this.imageList1.Images.Clear();
string[] fileArr = imgSearch.getPicFiles(videoList.FocusedItem.Text, this.comboBox1.Text, true);//得到图片路径
if (fileArr.Length == 0)
{
MessageBox.Show("没有符合的图片", "警告");
return;
}
for (int i = 0; i < fileArr.Length; ++i)
{
this.imageList1.Images.Add(Image.FromFile(fileArr[i]));
string text = System.IO.Path.GetFileName(fileArr[i]);
ListViewItem item = new ListViewItem()
{
Tag = fileArr[i].ToString(),
Text = text,
ImageIndex = i
};
this.picList.Items.Add(item);
}
this.picList.Scrollable = true;
this.picList.MultiSelect = false;
this.picList.View = View.LargeIcon;
this.picList.LargeImageList = imageList1;
}
示例4: doNeighborListUpdate
public void doNeighborListUpdate(Node.NodeList neighborList)
{
Debug.WriteLine("doNeighborListUpdate");
lock (neighborListLock)
{
neighborListView.Items.Clear();
neighborListView.BeginUpdate();
Debug.WriteLine("Looping through neighbors");
foreach (Haggle.Node neighbor in neighborList.AsArray())
{
string ifaceStr = "";
Debug.WriteLine("Adding neighbor " + neighbor.GetName());
ListViewItem neighItem = new ListViewItem(neighbor.GetName());
foreach (Node.Interface iface in neighbor.InterfacesArray())
{
ifaceStr += iface.GetIdentifierStr() + ",";
}
char[] tc = { ',' };
neighItem.SubItems.Add(ifaceStr.TrimEnd(tc));
neighborListView.Items.Add(neighItem);
}
neighborListView.EndUpdate();
Debug.WriteLine("Neighborlist update end");
}
}
示例5: LoadCategoryRecords
public void LoadCategoryRecords(TreeNode CategoryNode)
{
if (CategoryNode.Tag == null) return;
DataRow category_row = (DataRow)CategoryNode.Tag;
DataRow[] child_rows = category_row.GetChildRows(_ds.Relations[1]);
foreach (DataRow row in child_rows)
{
//only one telegram per record
DataRow data = row.GetChildRows(_ds.Relations[0])[0];
ListViewItem item = new ListViewItem();
item.Tag = row;
item.ImageIndex = 2;
//phrase
item.Text = row["Phrase"].ToString();;
//item.SubItems.Add("0x" + ((byte)data["MessageControl"]).ToString("X"));
//item.SubItems.Add(data["SourceAddress"].ToString());
item.SubItems.Add(data["DestinationAddress"].ToString());
item.SubItems.Add("0x" + ((byte)data["TCPI"]).ToString("X"));
item.SubItems.Add("0x" + ((byte)data["APCI"]).ToString("X"));
this.lvRecords.Items.Add(item);
}
}
示例6: Populate
void Populate ()
{
var availableEncodings = new Dictionary<string,TextEncoding> ();
foreach (var encoding in TextEncoding.SupportedEncodings)
availableEncodings [encoding.Id] = encoding;
var shownEncodings = TextEncoding.ConversionEncodings;
shownListView.BeginUpdate ();
foreach (var encoding in shownEncodings) {
var item = new ListViewItem (new string [] { encoding.Id, encoding.Name }) {
Tag = encoding
};
shownListView.Items.Add (item);
// Don't show on the available list the encodings
// that are already being shown
availableEncodings.Remove (encoding.Id);
}
shownListView.AutoResizeColumns (ColumnHeaderAutoResizeStyle.HeaderSize);
shownListView.EndUpdate ();
availableListView.BeginUpdate ();
foreach (var encoding in availableEncodings) {
var item = new ListViewItem (new string [] { encoding.Value.Id, encoding.Value.Name }) {
Tag = encoding.Value
};
availableListView.Items.Add (item);
}
availableListView.AutoResizeColumns (ColumnHeaderAutoResizeStyle.HeaderSize);
availableListView.EndUpdate ();
}
示例7: LoadItemsFromRegistry
private void LoadItemsFromRegistry()
{
ArrayList items = new ArrayList();
using(RegistryKey key = Registry.CurrentUser.CreateSubKey(registryLocation))
{
string[] favourites = key.GetSubKeyNames();
foreach(string favourite in favourites)
{
using(RegistryKey subkey = key.OpenSubKey(favourite))
{
Proxy.NavigatorRef.Item navItem = new Workshare.Connect.SharePoint.Proxy.NavigatorRef.Item();
navItem.Title = ( string )subkey.GetValue( "name" );
navItem.Url = ( string )subkey.GetValue( "url" );
navItem.Kind = GetKind( ( string )subkey.GetValue( "kind" ) );
ListViewItem item = new ListViewItem( navItem.Title );
item.SubItems.Add( navItem.Url );
item.SubItems.Add( navItem.Kind.ToString() );
item.ImageIndex = (int)subkey.GetValue("image");
item.Tag = navItem;
items.Add(item);
}
}
}
InnerList.Clear();
InnerList.AddRange(items);
}
示例8: InstalledModules_Load
private void InstalledModules_Load(object sender, EventArgs e)
{
Cursor = Cursors.WaitCursor;
try {
string[] moduleTypes = ApplicationServices.GetTypesOfModules().OrderBy(x => x).ToArray();
foreach (string moduleType in moduleTypes) {
ListViewGroup group = listViewModules.Groups.Add(moduleType, moduleType);
IModuleDescriptor[] descriptors = ApplicationServices.GetModuleDescriptors(moduleType);
foreach (IModuleDescriptor descriptor in descriptors) {
ListViewItem item =
new ListViewItem(new[]
{
descriptor.TypeName, _GetModuleDescription(descriptor), _GetModuleAuthor(descriptor),
_GetModuleVersion(descriptor), descriptor.FileName
});
item.Tag = descriptor;
item.Group = group;
listViewModules.Items.Add(item);
}
}
listViewModules.ColumnAutoSize();
}
catch (Exception ex) {
MessageBox.Show(ex.Message);
}
finally {
Cursor = Cursors.Default;
}
}
示例9: LoadLanguages
private void LoadLanguages()
{
_loaded = true;
mpListView2.BeginUpdate();
try
{
mpListView2.Items.Clear();
List<KeyValuePair<String, String>> languages = TvLibrary.Epg.Languages.Instance.GetLanguagePairs();
TvBusinessLayer layer = new TvBusinessLayer();
Setting setting = layer.GetSetting(languagesSettingsKey);
foreach (KeyValuePair<String, String> language in languages)
{
ListViewItem item = new ListViewItem(new string[] { language.Value, language.Key });
mpListView2.Items.Add(item);
item.Tag = language.Key;
item.Checked = setting.Value.IndexOf((string)item.Tag) >= 0;
}
mpListView2.Sort();
}
finally
{
mpListView2.EndUpdate();
}
}
示例10: FBrisanje_Radnika_Shown
// --- Popunjavanje listView podacima iz baze ---
private void FBrisanje_Radnika_Shown(object sender, EventArgs e)
{
try
{
IList<Radnik> listaRadnika = new List<Radnik>();
listaRadnika = client.Cypher
.Match("(radnik:Radnik)")
.Return(radnik => radnik.As<Radnik>())
.Results.ToList();
foreach (Radnik r in listaRadnika)
{
ListViewItem lv1 = new ListViewItem(r.id);
lv1.SubItems.Add(r.Ime);
lv1.SubItems.Add(r.Prezime);
lv1.SubItems.Add(r.Adresa);
lv1.SubItems.Add(r.Datum_Rodjenja);
lv1.SubItems.Add(r.Obrazovanje);
lv1.SubItems.Add(r.Iskustvo);
LvSpisakRadnika.Items.Add(lv1);
}
LvSpisakRadnika.Enabled = true;
}
catch (Exception ec)
{
MessageBox.Show(ec.ToString());
}
}
示例11: DeepSearchSongs
//-----------------------------------------------------------------------------------------------------------------------------
private void DeepSearchSongs(DirectoryInfo root)
{
foreach(var musicFile in root.GetFiles())
{
if (supportedFormats.Contains("*" + Path.GetExtension(musicFile.Name)))
{
var newItem = new ListViewItem();
var tagFile = TagLib.File.Create(musicFile.FullName);
if(tagFile.Tag.Performers.Count() > 0)
newItem.SubItems.Add(tagFile.Tag.Performers[0]);
newItem.SubItems.Add(tagFile.Tag.Track.ToString());
newItem.SubItems.Add(musicFile.Name);
newItem.SubItems.Add(tagFile.Tag.Album);
newItem.SubItems.Add(tagFile.Tag.Year.ToString());
newItem.SubItems.Add(tagFile.Properties.Duration.ToString(@"mm\:ss"));
newItem.Tag = musicFile.FullName;
songListView.Items.Add(newItem);
//songListView.Items.Add(newItem);
}
}
foreach(DirectoryInfo directory in root.GetDirectories())
{
DeepSearchSongs(directory);
}
}
示例12: LoadBook
public void LoadBook(string name,string searchType)
{
resultListView.Items.Clear();
List<Book> books;
try
{
books = bookManager.GetAllBook(name, searchType);
if (books.Count > 0)
{
foreach (Book book in books)
{
ListViewItem aItem = new ListViewItem(book.Id.ToString());
aItem.Tag = (Book)book;
aItem.SubItems.Add(book.Title);
aItem.SubItems.Add(book.AuthorName);
aItem.SubItems.Add(book.InitialCopy.ToString());
aItem.SubItems.Add(book.OutsideCopy.ToString());
aItem.SubItems.Add(book.Price.ToString());
resultListView.Items.Add(aItem);
}
}
}
catch (Exception exception)
{
MessageBox.Show(exception.Message, @"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
示例13: LoadOnListView
public void LoadOnListView(ListView lv)
{
Leave s = new Leave();
DataTable dt = new DataTable();
dt = s.SELECT_ALL();
if (dt != null)
{
int ctr = 1;
foreach (DataRow r in dt.Rows)
{
ListViewItem li = new ListViewItem();
li.Text = ctr.ToString();
li.SubItems.Add(r["fullname"].ToString());
li.SubItems.Add(r["leavetype"].ToString());
li.SubItems.Add(r["leavedate"].ToString());
li.SubItems.Add(r["noofdays"].ToString());
li.SubItems.Add(r["datefiled"].ToString());
lv.Items.Add(li);
ctr++;
}
}
}
示例14: Form1
public Form1(Dictionary<string, byte[]> dicomMap)
{
InitializeComponent();
//Set dictionary for tags
myDict = myDicomDic.getDic();
//Set 'map' for the data of the dicom file
myMap = dicomMap;
//Set necessary informations
rows = BitConverter.ToInt16(myMap["00280010"], 0);
columns = BitConverter.ToInt16(myMap["00280011"], 0);
pixelData = myMap["7FE00010"];
//Get all keys and theyr associated values
foreach (string id in dicomMap.Keys)
{
ListViewItem item;
byte[] value = myMap[id];
//Check if the given id is key of the given dictonary then use the found string, otherwise use the raw id
if (myDict.ContainsKey(id))
{
item = new ListViewItem(myDict[id]);
} else
{
item = new ListViewItem(id);
}
item.SubItems.Add(Encoding.Default.GetString(value));
listView1.Items.Add(item);
}
pictureBox1.Image = myService.createPicture(rows, columns, pixelData, trackBarC.Value, trackBarW.Value);
}
示例15: displayAlertList
private void displayAlertList()
{
//Clear List
alertListView.Items.Clear();
List<Alert> alerts = new List<Alert>();
EventEntity eve = new EventEntity();
ActiveUser au = new ActiveUser(currentUser);
alerts = au.getListOfAlerts();
int currentEventID;
if (alerts.Count != 0)
{
for (int i = 0; i < alerts.Count; i++)
{
ListViewItem newAlert = new ListViewItem((i + 1).ToString());
newAlert.SubItems.Add(alerts[i].getAlertedEventName()); // Name of Event
newAlert.SubItems.Add(alerts[i].getAlert()); // Alert String
alertListView.Items.Add(newAlert);
// Clear Alert Flag
currentEventID = eve.getEventIDFromEventName(alerts[i].getAlertedEventName());
eve.clearEventUpdatedFlag(currentEventID);
eve.clearEventFullFlag(currentEventID);
eve.clearEventStartFlag(currentEventID);
}
}
alerts.Clear(); // Erase off OLD alerts
alertListView.Show();
}