本文整理汇总了C#中Nodes.Node类的典型用法代码示例。如果您正苦于以下问题:C# Node类的具体用法?C# Node怎么用?C# Node使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Node类属于Nodes命名空间,在下文中一共展示了Node类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Draw
public override void Draw(Node node, PaintMode printMode, Color color)
{
if ((printMode == PaintMode.BACKGROUND))
{
base.painter_.FillRectangle(node);
}
}
示例2: getSize
public override void getSize(Node containerNode)
{
int d = 0;
float dpi = base.painter_.DpiX();
float f = base.painter_.FontSize(containerNode, containerNode.style_);
base.rect.width = AttributeBuilder.SizeByAttr(f, dpi, containerNode, "width", this.width);
base.rect.height = AttributeBuilder.SizeByAttr(f, dpi, containerNode, "height", this.height);
d = AttributeBuilder.SizeByAttr(f, dpi, containerNode, "depth", this.depth);
if (base.rect.height == 0)
{
base.rect.height = 2;
}
if (base.rect.width == 0)
{
base.rect.width = 2;
}
if (d == 0)
{
base.rect.baseline = base.rect.height / 2;
}
else if (d > base.rect.height)
{
base.rect.height += d;
base.rect.baseline = 0;
}
else
{
base.rect.baseline = base.rect.height - d;
}
}
示例3: Draw
public override void Draw(Node node, PaintMode printMode, Color color)
{
if (((printMode == PaintMode.FOREGROUND)) && ((node.firstChild == null)))
{
base.painter_.OutlineRect(node);
}
}
示例4: Main
public static void Main()
{
StreamReader reader = new StreamReader("../../input.txt");
Console.SetIn(reader);
int treeSize = int.Parse(Console.ReadLine());
Node[] nodes = new Node[treeSize];
for (int i = 0; i < nodes.Length; i++)
{
nodes[i] = new Node(i);
}
for (int i = 0; i < nodes.Length - 1; i++)
{
var input = Console.ReadLine().Split(' ');
int parentNodeValue = int.Parse(input[0]);
int childNodeValue = int.Parse(input[1]);
nodes[parentNodeValue].Childrens.Add(nodes[childNodeValue]);
nodes[childNodeValue].HasParent = true;
}
// C : find all middle nodes
List<Node> middleNodes = FindMiddleNodes(nodes);
var middleNodesValues = middleNodes.Select(n => n.Value);
Console.WriteLine("Middle nodes values: {0}", string.Join(", ", middleNodesValues));
}
示例5: UpdateChildPosition
public override void UpdateChildPosition(Node childNode)
{
if (childNode.childIndex == 0)
{
this.table.update(this.fontWidth, this.fontHeight);
}
}
示例6: getSize
public override void getSize(Node containerNode)
{
if (this.target == null)
{
base.painter_.MeasureBox(containerNode, containerNode.style_, "X");
}
}
示例7: Draw
public override void Draw(Node node, PaintMode printMode, Color color)
{
if (((printMode != PaintMode.BACKGROUND)) && ((printMode == PaintMode.FOREGROUND)))
{
if ((node.isVisible && (node.literalText != null)) && (node.literalText.Length > 0))
{
if (node.parent_ != null)
{
bool notInBrackets = true;
try
{
if ((node.parent_.type_.type == ElementType.Mo) && ((Box_Mo) node.parent_.box).isBracketed)
{
notInBrackets = false;
}
}
catch
{
}
if (notInBrackets)
{
base.painter_.DrawString(node, node.parent_.style_, color);
}
}
else
{
base.painter_.DrawString(node, null, color);
}
}
}
}
示例8: getSize
public override void getSize(Node containerNode)
{
BoxRect boxRect;
this.attrs = AttributeBuilder.QuoteAttributes(containerNode);
if (containerNode.numChildren <= 0)
{
if ((containerNode.literalText != null) && (containerNode.literalText.Length > 0))
{
base.painter_.MeasureBox(containerNode, containerNode.style_);
}
else
{
base.painter_.MeasureBox(containerNode, containerNode.style_, "X");
}
}
if (this.attrs != null)
{
if (this.attrs.lquote != "NONE")
{
this.leftQuote = this.attrs.lquote;
}
else
{
this.leftQuote = "";
}
if (this.attrs.rquote != "NONE")
{
this.rightQuote = this.attrs.rquote;
}
else
{
this.rightQuote = "";
}
}
else
{
this.leftQuote = "\"";
this.rightQuote = "\"";
}
if (this.leftQuote.Length > 0)
{
boxRect = base.painter_.MeasureTextRect(containerNode, this.leftQuote, containerNode.scriptLevel_, containerNode.style_);
this.leftQuoteWidth = boxRect.width;
}
else
{
this.leftQuoteWidth = 0;
}
if (this.leftQuote.Length > 0)
{
boxRect = base.painter_.MeasureTextRect(containerNode, this.rightQuote, containerNode.scriptLevel_, containerNode.style_);
this.rightQuoteWidth = boxRect.width;
}
else
{
this.rightQuoteWidth = 0;
}
base.rect.width += this.leftQuoteWidth + this.rightQuoteWidth;
}
示例9: create
private Node create(Node node, Node selectedNode, Node lastSelectedNode)
{
Node n = new Node();
n.tagDeleted = node.tagDeleted;
n.tokenType = node.tokenType;
n.xmlTagName = node.xmlTagName;
n.namespaceURI = node.namespaceURI;
n.isVisible = node.isVisible;
n.isGlyph = node.isGlyph;
n.skip = node.skip;
n.literalText = node.literalText;
n.literalCaret = node.literalCaret;
n.literalStart = node.literalStart;
n.yOffset = node.yOffset;
n.displayStyle = node.displayStyle;
n.glyph = node.glyph;
n.scriptLevel_ = node.scriptLevel_;
n.type_ = node.type_;
if (node.attrs != null)
{
n.attrs = new AttributeList();
node.attrs.CopyTo(n.attrs);
}
n.FontStyle = node.FontStyle;
if (node.style_ != null)
{
n.style_ = new StyleAttributes();
node.style_.CopyTo(n.style_);
}
if (node == selectedNode)
{
this.selected_ = n;
}
if (node == lastSelectedNode)
{
this.lastSel_ = n;
}
if (node.HasChildren())
{
NodesList list = node.GetChildrenNodes();
int count = list.Count;
for (int i = 0; i < count; i++)
{
Node c = list.Get(i);
Node child = this.create(c, selectedNode, lastSelectedNode);
if (child != null)
{
n.AdoptChild(child);
}
}
}
return n;
}
示例10: getSize
public override void getSize(Node containerNode)
{
if (containerNode.firstChild == null)
{
containerNode.box.Width = 15;
containerNode.box.Height = 15;
containerNode.box.Baseline = 10;
}
}
示例11: NodesInfo
public NodesInfo(Node rootNode, Node selectedNode, int selectedNode_Caret, Node lastSelectedNode)
{
this.selected_ = null;
this.root_ = null;
this.lastSel_ = null;
this.mark_ = 0;
this.root_ = this.create(rootNode, selectedNode, lastSelectedNode);
this.root_.UpdateLevel();
this.mark_ = selectedNode_Caret;
}
示例12: getSize
public override void getSize(Node tableNode)
{
this.table = new MTable(tableNode);
float height = base.painter_.FontSize(tableNode, tableNode.style_);
float dpi = base.painter_.DpiX();
this.table.CalcSize(dpi, height);
base.rect.width = this.table.totalWidth;
base.rect.height = this.table.totalVertFrameSpacing;
base.rect.baseline = this.table.tableAlign + ((this.height - (2 * (this.height - this.baseline))) / 2);
}
示例13: Draw
public override void Draw(Node node, PaintMode printMode, Color color)
{
if (printMode == PaintMode.BACKGROUND)
{
DrawBackground(node);
}
else if (printMode == PaintMode.FOREGROUND)
{
DrawForeground(color, node);
}
}
示例14: Draw
public override void Draw(Node node, PaintMode printMode, Color color)
{
if ((printMode == PaintMode.BACKGROUND))
{
base.painter_.FillRectangle(node);
}
else if (((printMode == PaintMode.FOREGROUND)) && ((node.literalText != null) && (node.literalText.Length > 0)))
{
base.painter_.DrawString(node, node.style_, color);
}
}
示例15: UpdateChildPosition
public override void UpdateChildPosition(Node childNode)
{
if (childNode.prevSibling != null)
{
childNode.box.X = childNode.prevSibling.box.X + childNode.prevSibling.box.Width;
}
else
{
childNode.box.X = (base.rect.x + this.ftlineThick_);
}
childNode.box.Y = (base.rect.y + base.rect.baseline) - childNode.box.Baseline;
}