本文整理汇总了C#中System.Windows.Forms.ListView.ResumeLayout方法的典型用法代码示例。如果您正苦于以下问题:C# ListView.ResumeLayout方法的具体用法?C# ListView.ResumeLayout怎么用?C# ListView.ResumeLayout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.ListView
的用法示例。
在下文中一共展示了ListView.ResumeLayout方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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();
}
示例2: ResizeColumnHeaders
/// <summary>
/// Resizes the column headers (maximize the space per column)
/// WARNING: If this is triggered within a Resize event the listview should have
/// a minimum size set to avoid the vertical scroll bar on the column headers themselves.
/// If not properly set the result may be an infinite loop of resize calls.
/// This has no affect on vertical scroll bars for the items within the listview
/// </summary>
/// <param name="lvInput">The listview to update the column widths of</param>
public static void ResizeColumnHeaders(ListView lvInput)
{
if (0 == lvInput.Columns.Count) return; // bad!
if (0 == lvInput.ClientSize.Width) return; // no width? (minimized?)
lvInput.Visible = false;
lvInput.SuspendLayout();
var arrayPercents = new float[lvInput.Columns.Count];
int nColumnsWidth = 0;
for (int nIdx = 0; nIdx < lvInput.Columns.Count; nIdx++)
{
nColumnsWidth += lvInput.Columns[nIdx].Width;
}
for (int nIdx = 0; nIdx < lvInput.Columns.Count; nIdx++)
{
arrayPercents[nIdx] = (float)lvInput.Columns[nIdx].Width / (float)nColumnsWidth;
}
for (int nIdx = 0; nIdx < lvInput.Columns.Count; nIdx++)
{
lvInput.Columns[nIdx].Width = (int)(arrayPercents[nIdx] * (float)lvInput.ClientSize.Width);
}
lvInput.ResumeLayout();
lvInput.Visible = true;
}
示例3: FillList
private void FillList(ListView list, DataTable table)
{
list.SuspendLayout();
// Clear list
list.Items.Clear();
list.Columns.Clear();
int colcounter = 1;
// Columns
foreach (DataColumn col in table.Columns)
{
ColumnHeader ch = new ColumnHeader();
ch.Text = col.Caption;
if (IsNumeric(col.DataType))
ch.TextAlign = HorizontalAlignment.Right;
// if 2nd column set width to 150
if (colcounter == 2)
{
ch.Width = 200;
}
else if (colcounter == 1)
{
ch.Width = 80;
}
else if (colcounter == 3)
{
ch.Width = 150;
}
else
{
ch.Width = 70;
}
list.Columns.Add(ch);
colcounter++;
}
// Rows
foreach (DataRow row in table.Rows)
{
ListViewItem item = new ListViewItem();
item.Text = row[0].ToString();
for (int i = 1; i < table.Columns.Count; i++)
{
item.SubItems.Add(row[i].ToString());
}
list.Items.Add(item);
}
list.ResumeLayout();
}
示例4: UpdateView
private void UpdateView(ListView list, ExpertRegistry registry)
{
LoggingService.EnterMethod();
list.SuspendLayout();
list.Items.Clear();
foreach (ExpertInfo expert in registry.Experts)
{
AppendTo(list, expert);
}
list.ResumeLayout();
LoggingService.LeaveMethod();
}
示例5: ClearListView
internal static void ClearListView(ListView lst, bool removeRows)
{
try
{
lst.SuspendLayout();
if (removeRows)
{
lst.Items.Clear();
}
else
{
for (var i = 0; i < lst.Items.Count; i++)
{
var subs = lst.Items[i].SubItems;
for (var j = 0; j < subs.Count; j++)
{
subs[j].Text = string.Empty;
}
}
}
}
catch (Exception e)
{
LogHelper.Dump(e);
}
finally
{
lst.ResumeLayout();
}
}
示例6: RemoveSelectedItemsFor
private void RemoveSelectedItemsFor(ListView actualListControl, StoredItemsList storedItemsList) {
ArrayList itemsToRemove = new ArrayList(actualListControl.SelectedItems);
actualListControl.SuspendLayout();
foreach (ListViewItem item in itemsToRemove) {
storedItemsList.Items.Remove(item.Tag);
actualListControl.Items.Remove(item);
}
actualListControl.ResumeLayout();
}
示例7: FillPicturesList
// Fill the list control with a list of all multimedia files associated with the record
private static void FillPicturesList( ListView listView, ArrayList alMultimediaFileRefs )
{
listView.SuspendLayout();
LogFile.TheLogFile.WriteLine( LogFile.DT_APP, LogFile.EDebugLevel.Note, "FillPicturesList() : " + alMultimediaFileRefs.Count.ToString() );
CMultimediaFileReference mfrSelected = null;
CListableMFR lmfr = GetSelectedItem( listView );
if( lmfr != null )
{
mfrSelected = lmfr.MultimediaFileReference;
}
alMultimediaFileRefs.Sort( new CMultimediaFileReference.OrderComparer() );
string sMmFilename;
Cursor.Current = Cursors.WaitCursor;
Cursor.Show();
listView.Items.Clear();
ListViewItem[] temporaryItemsList = new ListViewItem[ alMultimediaFileRefs.Count ];
int nItem = 0;
foreach( CMultimediaFileReference mfr in alMultimediaFileRefs )
{
if( mfr.m_bEmbedded )
{
sMmFilename = "embedded media";
}
else
{
sMmFilename = mfr.m_sMultimediaFileReference;
}
CListableMFR item = new CListableMFR( mfr );
if( mfrSelected == mfr )
{
item.Selected = true;
}
if( mfr.m_bVisible )
{
item.Checked = true;
}
else
{
item.Checked = false;
}
if( sMmFilename != null && sMmFilename.Length > 0)
{
item.SubItems.Add( sMmFilename );
}
temporaryItemsList[ nItem++ ] = item;
}
listView.Items.AddRange( temporaryItemsList );
listView.ResumeLayout();
Cursor.Current = Cursors.Default;
Cursor.Hide();
}
示例8: AutoResizeList
private void AutoResizeList(ListView list, int mainCol)
{
list.SuspendLayout();
int widthAvailable = list.Width - SystemInformation.BorderSize.Width - SystemInformation.VerticalScrollBarWidth;
for (int i = 0; i < list.Columns.Count; i++)
if (i != mainCol)
{
list.Columns[i].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
widthAvailable -= list.Columns[i].Width + SystemInformation.BorderSize.Width;
}
if (list.Columns[mainCol].Width != widthAvailable)
list.Columns[mainCol].Width = widthAvailable;
list.ResumeLayout(false);
}