本文整理汇总了C#中System.Windows.Forms.HtmlElement.SetAttribute方法的典型用法代码示例。如果您正苦于以下问题:C# HtmlElement.SetAttribute方法的具体用法?C# HtmlElement.SetAttribute怎么用?C# HtmlElement.SetAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.HtmlElement
的用法示例。
在下文中一共展示了HtmlElement.SetAttribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetValue
public override void SetValue(HtmlElement element)
{
// 如果checkbox的有属性是“checked”它将被检查。
if (Checked)
{
element.SetAttribute("checked", "checked");
}
else
{
element.SetAttribute("checked", null);
}
}
示例2: SetElementValue
public static void SetElementValue(HtmlElement htmlElement, string value)
{
if (htmlElement != null)
{
htmlElement.SetAttribute("value", value);
}
}
示例3: set
public void set(HtmlElement elm, string value)
{
if (elm == null)
return;
elm.SetAttribute("value", value);
SimpleDocument.fireChange(elm);
}
示例4: _SetItemSelected
private static HtmlElement _SetItemSelected(HtmlElement el)
{
if (el != null)
el.SetAttribute("className", "report selected");
return el;
}
示例5: SetItemUnselected
private static void SetItemUnselected(HtmlElement el)
{
if (el != null)
el.SetAttribute("className", "report");
}
示例6: BtnTest0
private void BtnTest0(HtmlElement link)
{
string orig_class = (string)link.GetAttribute("className");
if (orig_class.Contains("directjob_test"))
{
string ss = orig_class.Replace(" directjob_test", "");
link.SetAttribute("className", ss);
//MessageBox.Show(link.GetAttribute("className"));
}
}
示例7: CheckElement
private void CheckElement(HtmlElement ele)
{
if (ele != null && ele != hoveringElement)
{
if (hoveringElement != null)
{
try
{
hoveringElement.Style = hoveringElement.GetAttribute("OldStyle");
}
catch { }
}
ele.SetAttribute("OldStyle", ele.Style);
ele.Style = ele.Style + ";border:solid 1px red;";
hoveringElement = ele;
}
}
示例8: setCheckValue
private void setCheckValue (HtmlElement el, bool check)
{
if (check)
el.SetAttribute("checked", "checked");
else
el.SetAttribute("checked", "");
}
示例9: SetCheckRadioBox
public void SetCheckRadioBox(HtmlElement elem, bool val)
{
elem.SetAttribute("checked", val ? "true" : "false");
}
示例10: SetHtmlElementValue
public static void SetHtmlElementValue(HtmlElement he, string value)
{
LoggingService.DebugFormatted("将设置{0}-{1}的值:{2}", new object[] { he.Document.Url.ToString(), he.Id, value });
he.SetAttribute("value", value);
if (he.TagName.ToLower() == "select")
{
string attribute = he.GetAttribute("valuechange");
if ((attribute != null) && (attribute.Length > 0))
{
he.Document.InvokeScript(attribute, new string[] { value });
}
}
}
示例11: SelectResult
private void SelectResult(int id)
{
if(m_hilightedElement != null)
m_hilightedElement.SetAttribute("className", "result");
m_hilightedElement = outputBrowser.Document.GetElementById(id.ToString());
if (m_hilightedElement != null)
{
m_hilightedElement.SetAttribute("className", "result hilight");
int bufferHeight = m_hilightedElement.OffsetRectangle.Height * 3;
Rectangle viewRect = new Rectangle(
outputBrowser.Document.Body.ScrollLeft,
outputBrowser.Document.Body.ScrollTop + bufferHeight,
outputBrowser.Document.Body.ClientRectangle.Width,
outputBrowser.Document.Body.ClientRectangle.Height - bufferHeight * 2);
if (!viewRect.IntersectsWith(m_hilightedElement.OffsetRectangle))
{
if (m_hilightedElement.OffsetRectangle.Top < viewRect.Top)
outputBrowser.Document.Body.ScrollTop = Math.Max(0, m_hilightedElement.OffsetRectangle.Top - bufferHeight);
else
outputBrowser.Document.Body.ScrollTop = Math.Min(outputBrowser.Document.Body.ScrollRectangle.Height, m_hilightedElement.OffsetRectangle.Bottom - outputBrowser.Document.Body.ClientRectangle.Height + bufferHeight);
}
}
}
示例12: BtnTest1
private void BtnTest1(HtmlElement link)
{
string orig_class = (string)link.GetAttribute("className");
link.SetAttribute("className", orig_class + " " + "directjob_test");
//link.Focus();
//MessageBox.Show(link.GetAttribute("classname").ToString());
IHTMLElement myele = (IHTMLElement)link.DomElement;
IHTMLDOMNode n1 = (IHTMLDOMNode)myele;
//MessageBox.Show(n1.nodeName);
IHTMLAttributeCollection attrcol = (IHTMLAttributeCollection)n1.attributes;
treeView1.Nodes.Add(myele.tagName);
treeView1.Nodes[treeView1.Nodes.Count - 1].Nodes.Add("Attributes");
if (attrcol != null)
foreach (IHTMLDOMAttribute iatt1 in attrcol)
{
if (iatt1.nodeValue != null && (iatt1.nodeValue.ToString() != "") && myele.outerHTML.Contains(iatt1.nodeName))
//MessageBox.Show("att1 name : "+iatt1.nodeName +"\natt1 value : "+ iatt1.nodeValue.ToString());
{
//MessageBox.Show("att1 name : " + iatt1.nodeName + "\natt1 value : " + iatt1.nodeValue.ToString());
treeView1.Nodes[treeView1.Nodes.Count - 1].Nodes[0].Nodes.Add(iatt1.nodeName, iatt1.nodeName + "=" + iatt1.nodeValue.ToString());
treeView1.Nodes[treeView1.Nodes.Count - 1].Nodes[0].LastNode.ToolTipText = iatt1.nodeValue.ToString();
}
}
if (myele.style.cssText != null && myele.style.cssText.Length > 0)
{
treeView1.Nodes[treeView1.Nodes.Count - 1].Nodes.Add("style", "sytle=" + myele.style.cssText);
treeView1.Nodes[treeView1.Nodes.Count - 1].LastNode.ToolTipText = myele.style.cssText;
}
if (myele.outerText != null && myele.outerText.Length > 0)
{
treeView1.Nodes[treeView1.Nodes.Count - 1].Nodes.Add("outerText", "outerText=" + myele.outerText);
treeView1.Nodes[treeView1.Nodes.Count - 1].LastNode.ToolTipText = myele.outerText;
}
if (myele.outerHTML != null && myele.outerHTML.ToString().Length > 0)
{
treeView1.Nodes[treeView1.Nodes.Count - 1].Nodes.Add("outerHTML", "outerHTML=" + myele.outerHTML.ToString());
treeView1.Nodes[treeView1.Nodes.Count - 1].LastNode.ToolTipText = myele.outerHTML.ToString();
}
}
示例13: vl1f
//Insert values
public void vl1f()
{
hElement1 = webBrowser1.Document.GetElementById(textBoxJSLogin.Text);
hElement1.SetAttribute("value", textBoxBrowserLogin.Text);
hElement2 = webBrowser1.Document.GetElementById(textBoxJSPass.Text);
hElement2.SetAttribute("value", textBoxBrowserPassword.Text);
hElement3 = webBrowser1.Document.GetElementById(textBoxJSForm.Text);
hElement3.InvokeMember(textBoxJSSubmit.Text);
}
示例14: SetComboBoxValue
public void SetComboBoxValue(HtmlElement elem, string val)
{
elem.SetAttribute("selectedIndex", val);
}
示例15: SetValue
public override void SetValue(HtmlElement element)
{
element.SetAttribute("value", Value);
}