本文整理汇总了C#中System.Windows.Forms.ListView.FindForm方法的典型用法代码示例。如果您正苦于以下问题:C# ListView.FindForm方法的具体用法?C# ListView.FindForm怎么用?C# ListView.FindForm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.ListView
的用法示例。
在下文中一共展示了ListView.FindForm方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: listViewPrinter
public listViewPrinter(ListView lv, Point location, bool border, bool hasGroups, string title,string rezultat)
{
this.lv = lv;
this.location = location;
this.border = border;
this.hasGroups = hasGroups;
this.title = title;
this.rezultat = rezultat;
titleHeight = !string.IsNullOrEmpty(title) ? lv.FindForm().CreateGraphics().MeasureString(title, new Font(lv.Font.Name, 25)).ToSize().Height : 0;
pd.BeginPrint += pd_BeginPrint;
pd.PrintPage += pd_PrintPage;
}
示例2: PatchItemClickEvent
/// <summary>
/// Patchs the custom event ItemClick for a listView.
/// </summary>
/// <param name="lView">The source ListView.</param>
private static void PatchItemClickEvent(ListView lView)
{
Delegate del = null;
try
{
string methodName = Convert.ToString(newProperties[lView][newPropertiesEnum.ItemClickMethod]).Trim();
if (!string.IsNullOrEmpty(methodName))
{
if (!EventsPatched[lView].ContainsKey(ItemClickEventName))
{
MethodInfo mInfo = lView.FindForm().GetType().GetMethod(methodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
if (mInfo.IsStatic)
del = Delegate.CreateDelegate(typeof(ListView_ItemClickDelegate), mInfo);
else
del = Delegate.CreateDelegate(typeof(ListView_ItemClickDelegate), lView.FindForm(), mInfo);
if (!EventsPatched.ContainsKey(lView))
EventsPatched.Add(lView, new Dictionary<string, List<Delegate>>());
EventsPatched[lView].Add(ItemClickEventName, new List<Delegate>());
EventsPatched[lView][ItemClickEventName].Add(del);
}
}
}
catch (Exception e)
{
MessageBox.Show(string.Format(UpgradeHelpers.VB6.Resources.UpgradeHelpers_VB6.UpgradeHelpers_VB6_Help_ListViewHelper_PatchItemClickEvent_Err_Msg, e.Message));
}
}
示例3: DownloadSpoiler
public void DownloadSpoiler(XmlDocument xSet, XmlDocument xSetLang, ListView list, ProgressBar progressBar)
{
mList = list;
ListViewItem item;
if(Directory.Exists("cards"))
Directory.Delete("cards", true);
Directory.CreateDirectory("cards");
foreach(XmlNode nodeSet in xSet.DocumentElement.SelectNodes("card_sets/item"))
{
string setCode = nodeSet.Attributes["code"].Value;
string setName = xSetLang.DocumentElement.SelectSingleNode("card_sets_lang/item[@code='" + setCode + "' and @language='ENG']/@name").InnerText;
if(setCode != "M12")
continue;
string cardsPath = "cards\\" + setCode + ".xml";
string cardsLangPath = "cards\\" + setCode + ".eng.xml";
if(File.Exists(cardsPath))
File.Delete(cardsPath);
if(File.Exists(cardsLangPath))
File.Delete(cardsLangPath);
XmlDocument xCards = new XmlDocument();
xCards.LoadXml("<cards />");
XmlDocument xCardsLang = new XmlDocument();
xCardsLang.LoadXml("<cards />");
DateTime setDate = XmlConvert.ToDateTime(nodeSet.Attributes["releaseDate"].Value, "yyyy-MM-ddTHH:mm:ss");
xCards.DocumentElement.Attributes.Append(xCards.CreateAttribute("releaseDate")).Value = setDate.ToString("yyyy-MM-ddTHH:mm:ss");
xCards.DocumentElement.Attributes.Append(xCards.CreateAttribute("code")).Value = setCode;
xCardsLang.DocumentElement.Attributes.Append(xCardsLang.CreateAttribute("name")).Value = setName;
string contentTextPath = Path.Combine(Path.Combine(CARDS_DIRPATH, setCode), "CONTENT.txt");
string contentXmlPath = Path.Combine(Path.Combine(CARDS_DIRPATH, setCode), "CONTENT.xml");
string listPath = Path.Combine(Path.Combine(CARDS_DIRPATH, setCode), "list.xml");
item = new ListViewItem(setCode);
ListViewItem.ListViewSubItem subItem = item.SubItems.Add("Working...");
mList.Items.Add(item);
mList.EnsureVisible(mList.Items.Count - 1);
Application.DoEvents();
progressBar.Minimum = 0;
progressBar.Step = 1;
progressBar.Value = 0;
XmlDocument xCardList = new XmlDocument();
xCardList.Load(listPath);
XmlDocument xContent = new XmlDocument();
string allContent;
if(!File.Exists(contentTextPath))
{
// download page content
subItem.Text = "Downloading...";
mList.FindForm().Refresh();
Application.DoEvents();
allContent = string.Empty;
xContent.LoadXml("<content />");
progressBar.Maximum = xCardList.SelectNodes("//card").Count;
foreach(XmlNode cardNode in xCardList.SelectNodes("//card"))
{
string id = cardNode.SelectSingleNode("@id").InnerText;
string content = Download(URL_SPOILER + id);
allContent += content;
XmlNode nodeContent = xContent.ImportNode(GetDocument(content).DocumentElement, true);
xContent.DocumentElement.AppendChild(nodeContent);
progressBar.PerformStep();
mList.FindForm().Refresh();
Application.DoEvents();
}
File.WriteAllText(contentTextPath, allContent);
xContent.Save(contentXmlPath);
subItem.Text = "OK!";
mList.FindForm().Refresh();
Application.DoEvents();
}
subItem.Text = "Creating...";
mList.FindForm().Refresh();
Application.DoEvents();
xContent.Load(contentXmlPath);
progressBar.Value = 0;
progressBar.Maximum = xContent.DocumentElement.SelectNodes("td").Count;
XmlNodeList cardListNodes = xCardList.DocumentElement.SelectNodes("card");
XmlNodeList contentNodes = xContent.DocumentElement.SelectNodes("td");
for(int i = 0; i < cardListNodes.Count; i++)
{
SpoilerReader spoilerReader = new SpoilerReader(cardListNodes[i].SelectSingleNode("@name").InnerText,
cardListNodes[i].SelectSingleNode("@color").InnerText);
spoilerReader.CreateCardNode(contentNodes[i], xCards, xCardsLang, setCode, setDate, i + 1);
progressBar.PerformStep();
mList.FindForm().Refresh();
Application.DoEvents();
}
//.........这里部分代码省略.........
示例4: GetImageListHelper
/// <summary>
/// Returns a ImageListHelper created based on a VB6 ImageList (name).
/// </summary>
/// <param name="lView">The ListView is used to get access to
/// the original VB6 ImageList based on its name.</param>
/// <param name="VB6ImageListName">The name of the VB6 Image List.</param>
/// <param name="onDesignMode">Is Design Mode?</param>
/// <returns>An instance of a ImageListHelper.</returns>
private static ImageListHelper GetImageListHelper(ListView lView, string VB6ImageListName, bool onDesignMode)
{
ImageListHelper imgHelper = new ImageListHelper();
Form parentForm = lView.FindForm();
if (parentForm != null)
{
object imlControl = ContainerHelper.Controls(parentForm)[VB6ImageListName];
if (imlControl != null)
{
imgHelper.LoadVB6ImageList(imlControl);
}
else
{
if (!onDesignMode)
{
Type type = parentForm.GetType();
FieldInfo finfo = type.GetField(VB6ImageListName);
if (finfo != null)
{
object field_value = finfo.GetValue(parentForm);
imgHelper.NETImageList = field_value as ImageList;
}
}
}
}
return imgHelper;
}