本文整理汇总了C#中System.Windows.Forms.HtmlElement类的典型用法代码示例。如果您正苦于以下问题:C# HtmlElement类的具体用法?C# HtmlElement怎么用?C# HtmlElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HtmlElement类属于System.Windows.Forms命名空间,在下文中一共展示了HtmlElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Click
public void Click(HtmlElement h)
{
Focus(h);
Over(h);
Down(h);
h.InvokeMember("click");
}
示例2: GetInputElement
public static HtmlInputElement GetInputElement(HtmlElement element)
{
if (!element.TagName.Equals("input", StringComparison.OrdinalIgnoreCase))
{
return null;
}
HtmlInputElement input = null;
string type = element.GetAttribute("type").ToLower();
switch (type)
{
case "checkbox":
input = new HtmlCheckBox(element);
break;
case "password":
input = new HtmlPassword(element);
break;
case "submit":
input = new HtmlSubmit(element);
break;
case "text":
input = new HtmlText(element);
break;
default:
break;
}
return input;
}
示例3: HtmlCheckBox
public HtmlCheckBox(HtmlElement element)
: base(element.Id)
{
// 如果checkbox的有属性是“checked”它将被检查。
string chekced = element.GetAttribute("checked");
Checked = !string.IsNullOrEmpty(chekced);
}
示例4: AddToContents
private void AddToContents(HtmlElement elem, int contentKey)
{
this.dicContent.Add(elem, contentKey);
elem.Click += new HtmlElementEventHandler(this.Content_Click);
elem.MouseEnter += new HtmlElementEventHandler(this.Content_MouseEnter);
elem.MouseLeave += new HtmlElementEventHandler(this.Content_MouseLeave);
}
示例5: Convert
public static List<TRow> Convert(HtmlElement table) {
List<TRow> alRow = new List<TRow>();
foreach (HtmlElement el in table.Children) {
if (String.Compare(el.TagName, "thead", true) == 0) {
foreach (HtmlElement elChild in el.Children) {
if (String.Compare(elChild.TagName, "tr", true) == 0) {
ReadTr(alRow, TRowType.Head, elChild);
}
}
}
if (String.Compare(el.TagName, "tfoot", true) == 0) {
foreach (HtmlElement elChild in el.Children) {
if (String.Compare(elChild.TagName, "tr", true) == 0) {
ReadTr(alRow, TRowType.Tail, elChild);
}
}
}
else if (String.Compare(el.TagName, "tbody", true) == 0) {
foreach (HtmlElement elChild in el.Children) {
if (String.Compare(elChild.TagName, "tr", true) == 0) {
ReadTr(alRow, TRowType.None, elChild);
}
}
}
else if (String.Compare(el.TagName, "tr", true) == 0) {
ReadTr(alRow, TRowType.None, el);
}
}
return alRow;
}
示例6: AddToPackages
private void AddToPackages(HtmlElement elem, int packageKey)
{
this.dicPackage.Add(elem, packageKey);
elem.MouseEnter += new HtmlElementEventHandler(this.Package_MouseEnter);
elem.MouseLeave += new HtmlElementEventHandler(this.Package_MouseLeave);
elem.Click += new HtmlElementEventHandler(this.Package_Click);
}
示例7: FindChildWithId
public HtmlElement FindChildWithId(HtmlElement htmlElement, string idToFind)
{
if (htmlElement.Id != null && htmlElement.Id.Equals(idToFind))
{
return htmlElement;
}
HtmlElement returnHtmlElement = null;
foreach (HtmlElement item in htmlElement.Children)
{
returnHtmlElement = FindChildWithId(item, idToFind);
}
if (returnHtmlElement != null)
{
return returnHtmlElement;
}
while ((htmlElement = htmlElement.NextSibling) != null)
{
returnHtmlElement = FindChildWithId(htmlElement, idToFind);
}
if (returnHtmlElement != null)
{
return returnHtmlElement;
}
return null;
}
示例8: TreeNodeEx
public TreeNodeEx(HtmlElement htmlElement)
: base()
{
this.htmlElement = htmlElement;
this.Text = htmlElement.TagName;
this.PrepareChildrenNodes();
}
示例9: AttachContextMenu
private void AttachContextMenu(HtmlElement he)
{
if (he.TagName.Equals(TagNames.BodyTagName))
{
if (bodyContextMenu == null)
{
InitializeBodyContextMenu();
}
}
if (he.TagName.Equals(TagNames.AnchorTagName))
{
if (!he.GetAttribute("href").Equals(string.Empty))
{
if (linkContextMenu == null)
{
InitializeLinkContextMenu();
}
}
}
if (he.TagName.Equals(TagNames.ImageTagName))
{
if (!he.GetAttribute("longdesc").Equals(string.Empty))
{
InitializeEquationContextMenu();
}
}
}
示例10: SetElementValue
public static void SetElementValue(HtmlElement htmlElement, string value)
{
if (htmlElement != null)
{
htmlElement.SetAttribute("value", value);
}
}
示例11: GetElementsByName
public HtmlElementCollection GetElementsByName(string name)
{
int count = this.Count;
HtmlElement[] elementArray = new HtmlElement[count];
int index = 0;
for (int i = 0; i < count; i++)
{
HtmlElement element = this[i];
if (element.GetAttribute("name") == name)
{
elementArray[index] = element;
index++;
}
}
if (index == 0)
{
return new HtmlElementCollection(this.shimManager);
}
HtmlElement[] array = new HtmlElement[index];
for (int j = 0; j < index; j++)
{
array[j] = elementArray[j];
}
return new HtmlElementCollection(this.shimManager, array);
}
示例12: locate
public override HtmlElement locate(HtmlElement parent)
{
HtmlElement ret = null;
if (null != parent)
{
HtmlElement toMatch = null;
foreach (HtmlElement child in parent.All)
{
toMatch = child;
if (null != Filter)
{
toMatch = Filter.locate(child);
}
if (null != toMatch)
{
if (null == Matcher || Matcher.match(toMatch))
{
ret = toMatch;
break;
}
}
}
}
return ret;
}
示例13: GetHistoryFromTable
public IList<HistoryInfo> GetHistoryFromTable(HtmlElement table)
{
IList<HistoryInfo> result = new List<HistoryInfo>();
if (table == null)
{
throw new ArgumentException();
}
HtmlElementCollection rows = table.GetElementsByTagName("tr");
if (rows == null || rows.Count == 0)
{
return result;
}
///The 1st row are columns' name
for (int i = 1; i < rows.Count; i++)
{
HtmlElement currentRow = rows[i];
HistoryInfo item = GetItemFromRow(currentRow);
if (item != null)
result.Add(item);
}
return result;
}
示例14: initbroswer
private void initbroswer()
{
HtmlElementCollection collection = webBrowser1.Document.Body.Children;
flashdoc = collection[2];
flashdoc.Children[0].Style = "display:none";
flashdoc.Children[1].Style = "display:none";
webBrowser1.Visible = true;
}
示例15: ListQueryParameters
/// <summary>
/// List, for debugging purposes, the parameters passed to a Denni Hlasatel Death Index query
/// </summary>
/// <param name="elemTarg">the HTML element into which the list outut will be directed</param>
/// <param name="sPath">the Denni Hlasatel Death Index query to be executed</param>
/// <param name="lQuery">the arguments to the query, as name/value pairs</param>
/// <param name="sBaseMessage">a header string that will be prepended to the list output</param>
private static void ListQueryParameters(HtmlElement elemTarg, string sPath, NameValueCollection lQuery, string sBaseMessage)
{
var sMessage = sBaseMessage + "Path: " + sPath + "<br>" + Environment.NewLine;
var items = lQuery.AllKeys.SelectMany(lQuery.GetValues, (k, v) => new { key = k, value = v });
sMessage = items.Aggregate(sMessage, (current, item) => current + (item.key + " = " + item.value + "<br>" + Environment.NewLine));
// MessageBox.Show(sMessage, "DH Death Index URL", MessageBoxButtons.OK, MessageBoxIcon.Information);
elemTarg.InnerHtml = sMessage;
}