本文整理汇总了C#中System.Windows.Forms.ListView.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# ListView.GetType方法的具体用法?C# ListView.GetType怎么用?C# ListView.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.ListView
的用法示例。
在下文中一共展示了ListView.GetType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: propPrinter
// DEBUGGING
private void propPrinter(string fileLoc, ListView l)
{
string s = String.Empty;
foreach (var prop in l.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public))
{
if (prop.Name != "TopItem")
{
if (prop.GetValue(l, null) != null)
s += (prop.Name + " = " + prop.GetValue(l, null).ToString() + Environment.NewLine);
}
}
using (StreamWriter sWr = new StreamWriter(fileLoc))
{
sWr.Write(s);
}
}
示例2: EnableDoubleBuffering
void EnableDoubleBuffering(ListView listView)
{
if (listView == null)
return;
var doubleBufferedProperty = listView.GetType().GetProperty(
"DoubleBuffered",
System.Reflection.BindingFlags.NonPublic | BindingFlags.Instance
);
if (doubleBufferedProperty == null)
return;
doubleBufferedProperty.SetValue(listView, true, null);
}
示例3: CorrectEventsForListView
/// <summary>
/// Patches the events for a specific ListView.
/// </summary>
/// <param name="lView">The source ListView.</param>
private static void CorrectEventsForListView(ListView lView)
{
Delegate[] EventDelegates = null;
if (EventsPatched.ContainsKey(lView))
throw new InvalidOperationException("Events for this list view has been previously patched: '" + lView.Name + "'");
EventsPatched.Add(lView, new Dictionary<string, List<Delegate>>());
foreach (string eventName in EventsToCorrect.Keys)
{
EventInfo eInfo = lView.GetType().GetEvent(eventName);
if (eInfo == null)
throw new InvalidOperationException("Event info for event '" + eventName + "' could not be found");
EventsPatched[lView].Add(eventName, new List<Delegate>());
EventDelegates = ContainerHelper.GetEventSubscribers(lView, eventName);
if (EventDelegates != null)
{
foreach (Delegate del in EventDelegates)
{
EventsPatched[lView][eventName].Add(del);
eInfo.RemoveEventHandler(lView, del);
}
}
eInfo.AddEventHandler(lView, EventsToCorrect[eventName]);
}
}
示例4: PatchDrawItemEvents
/// <summary>
/// In order to handle the property SmallIcons of a ListItem some Draw events must be handled.
/// </summary>
/// <param name="lView">The ListView source.</param>
private static void PatchDrawItemEvents(ListView lView)
{
Delegate[] EventDelegates = null;
bool PatchDrawItem = true;
bool PatchDrawSubItem = true;
bool PatchDrawColumnHeader = true;
EventInfo eInfo = null;
if (EventsPatched.ContainsKey(lView))
{
//The events were previously patched
if (EventsPatched[lView].ContainsKey(DrawItemEventName))
PatchDrawItem = false;
if (EventsPatched[lView].ContainsKey(DrawColumnHeaderEventName))
PatchDrawColumnHeader = false;
if (EventsPatched[lView].ContainsKey(DrawSubItemEventName))
PatchDrawSubItem = false;
}
else
EventsPatched.Add(lView, new Dictionary<string, List<Delegate>>());
if (PatchDrawItem)
{
eInfo = lView.GetType().GetEvent(DrawItemEventName);
if (eInfo == null)
throw new InvalidOperationException("Event info for event '" + DrawItemEventName + "' could not be found");
EventsPatched[lView].Add(DrawItemEventName, new List<Delegate>());
EventDelegates = ContainerHelper.GetEventSubscribers(lView, DrawItemEventName);
if (EventDelegates != null)
{
foreach (Delegate del in EventDelegates)
{
EventsPatched[lView][DrawItemEventName].Add(del);
eInfo.RemoveEventHandler(lView, del);
}
}
lView.DrawItem += new System.Windows.Forms.DrawListViewItemEventHandler(ListView_DrawItem);
}
if (PatchDrawColumnHeader)
{
eInfo = lView.GetType().GetEvent(DrawColumnHeaderEventName);
if (eInfo == null)
throw new InvalidOperationException("Event info for event '" + DrawColumnHeaderEventName + "' could not be found");
EventsPatched[lView].Add(DrawColumnHeaderEventName, new List<Delegate>());
EventDelegates = ContainerHelper.GetEventSubscribers(lView, DrawColumnHeaderEventName);
if (EventDelegates != null)
{
foreach (Delegate del in EventDelegates)
{
EventsPatched[lView][DrawColumnHeaderEventName].Add(del);
eInfo.RemoveEventHandler(lView, del);
}
}
lView.DrawColumnHeader += new System.Windows.Forms.DrawListViewColumnHeaderEventHandler(ListView_DrawColumnHeader);
}
if (PatchDrawSubItem)
{
eInfo = lView.GetType().GetEvent(DrawSubItemEventName);
if (eInfo == null)
throw new InvalidOperationException("Event info for event '" + DrawSubItemEventName + "' could not be found");
EventsPatched[lView].Add(DrawSubItemEventName, new List<Delegate>());
EventDelegates = ContainerHelper.GetEventSubscribers(lView, DrawSubItemEventName);
if (EventDelegates != null)
{
foreach (Delegate del in EventDelegates)
{
EventsPatched[lView][DrawSubItemEventName].Add(del);
eInfo.RemoveEventHandler(lView, del);
}
}
lView.DrawSubItem += new DrawListViewSubItemEventHandler(ListView_DrawSubItem);
}
lView.OwnerDraw = true;
}
示例5: GetListViewState
static string GetListViewState(ListView listview)
{
return listview.GetType().ToString() + ":" + ListViewUtil.GetColumnWidthListString(listview);
}