本文整理汇总了C#中System.Windows.Forms.ListViewItem.EnsureVisible方法的典型用法代码示例。如果您正苦于以下问题:C# ListViewItem.EnsureVisible方法的具体用法?C# ListViewItem.EnsureVisible怎么用?C# ListViewItem.EnsureVisible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.ListViewItem
的用法示例。
在下文中一共展示了ListViewItem.EnsureVisible方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddToList
private void AddToList(DebugDataEventArgs args)
{
string[] dbgArgs = args.Data.Split(sep);
ListViewItem item = new ListViewItem(dbgArgs);
this.listView1.SafeControlInvoke
(
listViewCtrl =>
{
if (listViewCtrl.Items.Count > 300)
{
listViewCtrl.Items.RemoveAt(0);
}
listViewCtrl.Items.Add(item);
item.EnsureVisible();
if (lineCount == 300)
{
listViewCtrl.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
}
lineCount--;
if ( lineCount == 0)
{
lineCount = 300;
}
}
);
item = null;
}
示例2: AddListViewItem
public void AddListViewItem(bool recieve, MQTTPacketTypes packetType, int? packetId, string topic, string data, DateTime time)
{
if (testing) return;
// type id topic data time
ListViewItem newItem = new ListViewItem(new[]
{
(packetId != null ? ((int) packetId).ToString() : ""),
GetPacketTypeString(packetType),
topic,
data,
time.ToShortDateString() + " " + time.ToLongTimeString()
}) {BackColor = recieve ? Color.FromArgb(148, 255, 114, 114) : Color.FromArgb(148, 61, 218, 61)};
_listViewItems.Add(newItem);
if (packetType == MQTTPacketTypes.PINGRESP)
UpdateLastPingTimeLabel(@"Last successful ping at ",time);
if (autoScrollCheckBox.Checked)
newItem.EnsureVisible();
if (_showPings // if it is a ping and we are allowed to show it just let it through
|| (packetType != MQTTPacketTypes.PINGREQ && packetType != MQTTPacketTypes.PINGRESP)) // or if it isn't a ping
{
outputListView.Invoke((MethodInvoker) delegate
{
AddListViewItem(newItem);
});
}
}
示例3: SelectItem
/**************************************************************/
/* Protected
/**************************************************************/
/// <summary>
/// Selects an item.
/// </summary>
/// <param name="aListView">List view</param>
/// <param name="aListViewItem">Item</param>
private static void SelectItem(Vista_Api.ListView aListView, ListViewItem aListViewItem) {
if (aListViewItem != null) {
aListView.SelectedItems.Clear();
aListViewItem.Selected = true;
aListViewItem.Focused = true;
aListViewItem.EnsureVisible();
}
}
示例4: addPatientForm_PatientUpdateEvent
private void addPatientForm_PatientUpdateEvent(object sender, PersonIdentityEventArgs e)
{
var patientAttributesArray = new string[] { e.Id, e.Surname, e.Name, e.Patronymic };
var patientItem = new ListViewItem(patientAttributesArray);
PatientList.Items.Add(patientItem);
patientItem.EnsureVisible();
patientItem.Selected = true;
PatientList.Focus();
}
示例5: AddEntry
public void AddEntry()
{
ListViewItem item = new ListViewItem();
EntryList.Items.Add(item);
item.EnsureVisible();
EntryList.LabelEdit = true;
item.BeginEdit();
}
示例6: addMedicForm_MedicAddEvent
void addMedicForm_MedicAddEvent(object sender, MedicIdentityEventArgs e)
{
var medicAttributesArray = new string[] { e.Id, e.Surname, e.Name, e.Patronymic, e.Profession, e.Category, e.Degree, e.Department };
var medicItem = new ListViewItem(medicAttributesArray);
medicList.Items.Add(medicItem);
medicItem.Group = medicList.Groups[e.Profession];
medicItem.EnsureVisible();
medicItem.Selected = true;
medicList.Focus();
}
示例7: AddVariable
private void AddVariable()
{
ListViewItem item = new ListViewItem();
VarList.Items.Add(item);
item.Selected = true;
item.EnsureVisible();
VarList.LabelEdit = true;
item.BeginEdit();
}
示例8: AddIndication
private void AddIndication(IndicationEventArgs obj)
{
var item = new ListViewItem(new[]
{
((DateTime)obj.IndicationProperties["IndicationTime"]).ToLongTimeString(),
(string)obj.IndicationProperties["QueryText"],
(string)obj.IndicationProperties["Parameters"],
string.Format("{0} ms", obj.IndicationProperties["ExecutionTimeMS"])
});
listView1.Items.Add(item);
item.EnsureVisible();
}
示例9: AddFailedData
private void AddFailedData()
{
foreach (KeyValuePair<string, string> kv in this.mFailedItems)
{
ListViewItem oItem = new ListViewItem(kv.Key);
oItem.SubItems.Add(kv.Value);
oItem.Group = this.lstSummary.Groups["lstGrpFailed"];
this.lstSummary.Items.Add(oItem);
oItem.EnsureVisible();
}
}
示例10: Log
// -- internal funcs
private void Log(string msg)
{
if (InvokeRequired)
{
Invoke(new Action<string>(Log), msg);
return;
}
var lvi = new ListViewItem();
lvi.Text = lvLog.Items.Count.ToString("00000");
lvi.SubItems.Add(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"));
lvi.SubItems.Add(msg);
lvLog.Items.Add(lvi);
lvi.EnsureVisible();
}
示例11: doSelectItem
/// <summary>
/// Does the select item.
/// </summary>
/// <param name="listViewItem">The list view item.</param>
private void doSelectItem(
ListViewItem listViewItem )
{
colorsListView.SelectedItems.Clear();
listViewItem.Selected = true;
listViewItem.Focused = true;
listViewItem.EnsureVisible();
_needEnsureVisibleListViewItem = listViewItem;
colorsListView.Select();
colorsListView.Focus();
}
示例12: AddLog
public void AddLog(Logs.Log log)
{
logs.Add(log);
listViewExLogs.Invoke(new MethodInvoker(delegate
{
ListViewItem lvi = new ListViewItem();
lvi.Tag = log;
lvi.Text = log.datetime.ToShortTimeString();
lvi.SubItems.Add(log.logType.ToString());
lvi.SubItems.Add(log.message);
listViewExLogs.Items.Add(lvi);
lvi.EnsureVisible();
}));
}
示例13: Add
public void Add(string item_no)
{
try
{
List<string[]> result=new List<string[]>();
issueHelper.Issue_ListView_Query(item_no, ref result);
if (result == null || result.Count == 0 || result[0] == null)
{
MessageBox.Show(item_no + "没有查到数据,无法添加!");
}
ListViewItem item = new ListViewItem( result[0]);
listView1.Items.Add(item);
item.EnsureVisible();
}
catch (System.Exception ex)
{
MessageBox.Show(ex.Message);
}
}
示例14: ProcessResponse
/// <summary>
/// Process the given response.
/// </summary>
internal void ProcessResponse(Response value)
{
var inpRep = value as SwitchReport;
if (inpRep != null)
{
var item = new ListViewItem(string.Format("Switch {0} turned {1}", inpRep.Address + 1, inpRep.SensorLevel ? "On" : "Off"));
item.ForeColor = inpRep.SensorLevel ? Color.Red : Color.Green;
try
{
lvInputs.BeginUpdate();
lvInputs.Items.Add(item);
}
finally
{
lvInputs.EndUpdate();
item.EnsureVisible();
}
}
}
示例15: listener_EventOccurred
private void listener_EventOccurred(object sender, ManagedWinapi.Accessibility.AccessibleEventArgs e)
{
if (nomouse.Checked && e.EventType == AccessibleEventType.EVENT_OBJECT_LOCATIONCHANGE && e.HWnd == IntPtr.Zero && e.ObjectID == (uint)AccessibleObjectID.OBJID_CURSOR) return;
if (e.HWnd == clear.Handle || e.HWnd == skip.Handle || e.HWnd == list.Handle) return;
if (skip.Checked)
{
skipped++;
skip.Text = "Skip (" + skipped + ")";
}
else
{
ListViewItem lvi = new ListViewItem(new string[] { ""+(idx++), e.EventType.ToString(), "0x"+e.HWnd.ToString("x8"),
"0x"+e.ObjectID.ToString("x8"), "0x"+e.ChildID.ToString("x8"), "0x"+e.Thread.ToString("x8"),
e.Time.ToString()});
lvi.Tag = e;
list.Items.Add(lvi);
lvi.EnsureVisible();
}
}