本文整理汇总了C#中System.Html.Element类的典型用法代码示例。如果您正苦于以下问题:C# Element类的具体用法?C# Element怎么用?C# Element使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Element类属于System.Html命名空间,在下文中一共展示了Element类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Arrange
public override void Arrange(AxisArrangement x, AxisArrangement y, Element hostElement)
{
base.Arrange(x, y, hostElement);
if (_dom == null)
{
_dom = jQuery.FromHtml("<div class='ui-vertical-scrollbar' style='position: absolute;'></div>").AppendTo(hostElement);
_near = jQuery.FromHtml("<div class='ui-scroll-up-button'></div>").AppendTo(_dom).MouseDown(LineNear);
_track = jQuery.FromHtml("<div class='ui-scroll-vertical-track'></div>").AppendTo(_dom).MouseDown(Page);
_thumb = jQuery.FromHtml("<div class='ui-scroll-vertical-thumb' style='position: relative'></div>").AppendTo(_track).MouseDown(Scrub);
_far = jQuery.FromHtml("<div class='ui-scroll-down-button'></div>").AppendTo(_dom).MouseDown(LineFar);
}
int buttonLength = (y.Length > 2*x.Length) ? x.Length : (int)Math.Floor(y.Length/2);
int trackHeight = y.Length - 2*buttonLength;
_minThumbLength = Math.Min(buttonLength, trackHeight);
_dom.CSS("width", x.Length + "px").CSS("height", y.Length + "px").CSS("top", y.Position + "px").CSS("left", x.Position + "px");
_near.CSS("width", x.Length + "px").CSS("height", buttonLength + "px");
_far.CSS("width", x.Length + "px").CSS("height", buttonLength + "px");
_track.CSS("width", x.Length + "px").CSS("height", trackHeight + "px");
_thumb.CSS("width", x.Length + "px");
ScrollableAxisChanged();
}
示例2: Create
public static CanvasInformation Create(Element canvas, int w, int h)
{
if (w == 0) w = 1;
if (h == 0) h = 1;
return new CanvasInformation(Raphael.CreatePaper(canvas, w, h), jQuery.FromElement(canvas));
}
示例3: AttachBehaviors
/// <summary>
/// Creates and attaches behaviors specified on the element declaratively.
/// </summary>
/// <param name="element">The element whose behaviors should be created and attached.</param>
private void AttachBehaviors(Element element)
{
string[] behaviorNames = ((string)element.GetAttribute(Application.BehaviorsAttribute)).Split(",");
int behaviorCount = behaviorNames.Length;
for (int i = 0; i < behaviorCount; i++) {
string name = behaviorNames[i].Trim();
BehaviorRegistration registration = _registeredBehaviors[name];
Debug.Assert(registration != null, "Unknown behavior '" + name + "'");
if (registration != null) {
Dictionary<string, object> options = OptionsParser.GetOptions(element, name);
// Use the Application's IoC capabilities to create behaviors.
// This allows satisfying dependencies behaviors have to other services,
// and also allows behaviors to provide or register services into the container.
Behavior behavior = (Behavior)GetObject(registration.BehaviorType);
behavior.Initialize(element, options);
if (registration.ServiceType != null) {
// Special-case the common case where a behavior represents a single
// service type, and auto-register it.
// In the case where a behavior is registering multiple service types
// (not so common), it can do so manually in its Initialize method.
RegisterObject(registration.ServiceType, behavior);
}
}
}
}
示例4: FooBehavior
public FooBehavior(Element e, int i)
: base(e, null)
{
_intVal = i;
_intVal2 = i * 2;
_intVal3 = i * 4;
}
示例5: PlayerGrid
public PlayerGrid(Element element)
: base(element, "PlayerGrid")
{
// Wire up the select user even for confirming a user
jQueryUIObject selectUser = (jQueryUIObject)this.Obj.Find(".selectUser");
selectUser.Button(new JsonObject("text", true, "icons", new JsonObject("secondary", "ui-icon-carat-1-e")));
selectUser.Click(UserChallenges.SelectUser);
// Wire up the challenge event for a specific user
jQueryUIObject requestMatch = (jQueryUIObject)this.Obj.Find(".requestMatch");
requestMatch.Button(new JsonObject("text", true, "icons", new JsonObject("secondary", "ui-icon-carat-1-e")));
requestMatch.Click(Players.RequestMatch);
jQueryUIObject selects = (jQueryUIObject)this.Obj.Find("th select");
selects.Each((ElementIterationCallback)delegate(int index, Element el)
{
((jQueryUIObject)jQuery.FromElement(el)).MultiSelect(new JsonObject(
"header", false,
"minWidth", "80",
"height", "auto",
"noneSelectedText", el.Title,
"selectedText", el.Title,
"close", (Callback)delegate() { DoFilter(this.Obj, true); }));
});
this.DoFilter(this.Obj, false);
}
示例6: Measure
public Size Measure(string text, double fontSize, Typeface typeface, double maxWidth)
{
if (htmlElement == null)
{
htmlElement = Document.CreateElement("div");
style = new HtmlStyleDictionary(htmlElement);
Document.Body.AppendChild(htmlElement);
}
style.SetValue("position", "absolute");
style.SetValue("visibility", "hidden");
style.SetFontSize(fontSize, converter);
style.SetFontFamily(typeface.FontFamily, converter);
style.SetFontStretch(typeface.Stretch, converter);
style.SetFontStyle(typeface.Style, converter);
style.SetFontWeight(typeface.Weight, converter);
if (maxWidth.IsNaN() || !Double.IsFinite(maxWidth))
{
style.SetTextWrapping(TextWrapping.NoWrap, converter);
style.ClearValue("max-width");
}
else
{
style.SetTextWrapping(TextWrapping.Wrap, converter);
style.SetValue("max-width", converter.ToPixelString(maxWidth));
}
style.Apply();
htmlElement.InnerHTML = converter.ToHtmlContentString(text.DefaultIfNullOrEmpty("A"));
return new Size(text.IsNullOrEmpty() ? 0 : htmlElement.OffsetWidth + 2, htmlElement.OffsetHeight);
}
示例7: PlayerDetails
public PlayerDetails(Element element)
: base(element)
{
jQueryUIObject sendMessage = (jQueryUIObject)this.Obj.Find("#playerMessage .sendMessage");
sendMessage.Button(new JsonObject("text", true, "icons", new JsonObject("secondary", "ui-icon-carat-1-e")));
sendMessage.Click(SendMessage);
}
示例8: Dispose
public override void Dispose()
{
base.Dispose();
jQuery.FromElement(_overlay).Empty();
_titleImage = null;
_overlay = null;
}
示例9: UserOffers
public UserOffers(Element element)
: base(element, "UserOffers")
{
jQueryUIObject cancelMatch = (jQueryUIObject)this.Obj.Find(".cancelMatch");
cancelMatch.Button(new JsonObject("text", false, "icons", new JsonObject("primary", "ui-icon-closethick")));
cancelMatch.Click(CancelOffer);
}
示例10: SwitchContainer
private void SwitchContainer(Element container, Element oldContainer)
{
foreach (ControlBase control in Controls)
{
control.RemoveControlFrom(oldContainer);
control.AddControlTo(container);
}
}
示例11: OnAfterRender
public static void OnAfterRender(Element[] rendered)
{
// Layout grid everytime an image is loaded
jQuery.FromElements(rendered).Find("img").Load(delegate(jQueryEvent e)
{
wall.fitWidth();
});
}
示例12: BindValue
private static Binder BindValue(Element element, string property, Expression expression)
{
Debug.Assert((element.TagName.ToLowerCase() == "input") ||
(element.TagName.ToLowerCase() == "textarea") ||
(element.TagName.ToLowerCase() == "select"),
"Value can only be bound on user input elements.");
return new ValueBinder((InputElement)element, expression);
}
示例13: Inject
public static IControl Inject(ControlDocumentFragment f, string newId, IContainer container, Element parent) {
PrepareForInject(f);
jQuery.FromElement(parent).Html(f.html);
IControl control = (IControl)container.CreateObjectByTypeNameWithConstructorArg(f.controlType, f.configObject);
control.Id = newId;
return control;
}
示例14: RemoveControlFrom
public override void RemoveControlFrom(Element container)
{
EnsureChildControlsCreated();
if (_tempElement != _lastContainer)
{
SwitchContainer(_tempElement, _lastContainer);
_lastContainer = _tempElement;
}
}
示例15: Arrange
public override void Arrange(AxisArrangement x, AxisArrangement y, Element hostElement)
{
base.Arrange(x, y, hostElement);
/* TODO
if (_stackPanel != null)
{
_stackPanel.Arrange(horizontal, vertical, hostElement);
}
*/
}