本文整理汇总了C#中Editor.Layout方法的典型用法代码示例。如果您正苦于以下问题:C# Editor.Layout方法的具体用法?C# Editor.Layout怎么用?C# Editor.Layout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Editor
的用法示例。
在下文中一共展示了Editor.Layout方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FetchForm
public static void FetchForm(AbsoluteLayout Parent, System.Xml.Linq.XNode Nodes)
{
int cIndex = 0;
int TabIndexes = ((System.Xml.Linq.XElement) Nodes).Elements().Count();
foreach(XElement C in ((System.Xml.Linq.XElement) Nodes).Elements()) {
if (C.Name == "Object") {
cIndex++;
if (true) {
if (C.Attribute("type").Value.StartsWith("System.Windows.Forms.PictureBox")) {
var CP = new Image();
foreach (XElement V in C.Elements()) {
if (V.Name == "Property") {
switch (V.Attribute("name").Value) {
case "Location":
CP.ORect = new Rectangle(Convert.ToInt32(String.Concat(V.Nodes()).Substring(0, String.Concat(V.Nodes()).IndexOf(","))), Convert.ToInt32(String.Concat(V.Nodes()).Substring(String.Concat(V.Nodes()).IndexOf(",") + 1)), CP.ORect.Width, CP.ORect.Height);
CP.Layout(new Rectangle(
Convert.ToInt32(String.Concat(V.Nodes()).Substring(0, String.Concat(V.Nodes()).IndexOf(","))) * App.ScaleFactorX,
Convert.ToInt32(String.Concat(V.Nodes()).Substring(String.Concat(V.Nodes()).IndexOf(",") + 1)) * App.ScaleFactorY,
CP.Width,
CP.Height));
Point pt = new Point(Convert.ToInt32(String.Concat(V.Nodes()).Substring(0, String.Concat(V.Nodes()).IndexOf(","))) * App.ScaleFactorX,
Convert.ToInt32(String.Concat(V.Nodes()).Substring(String.Concat(V.Nodes()).IndexOf(",") + 1)) * App.ScaleFactorY);
break;
case "Size":
CP.ORect = new Rectangle(CP.ORect.Left, CP.ORect.Top, Convert.ToInt32(String.Concat(V.Nodes()).Substring(0, String.Concat(V.Nodes()).IndexOf(","))), Convert.ToInt32(String.Concat(V.Nodes()).Substring(String.Concat(V.Nodes()).IndexOf(",") + 1)));
CP.Layout(new Rectangle(CP.X, CP.Y, Convert.ToInt32(String.Concat(V.Nodes()).Substring(0, String.Concat(V.Nodes()).IndexOf(","))) * App.ScaleFactorX, Convert.ToInt32(String.Concat(V.Nodes()).Substring(String.Concat(V.Nodes()).IndexOf(",") + 1)) * App.ScaleFactorY));
break;
case "SizeMode":
if (V.Value == "StretchImage") {
CP.Aspect = Aspect.Fill ;
} else if (V.Value == "Zoom") {
CP.Aspect = Aspect.AspectFill;
} else if (V.Value == "Normal") {
CP.Aspect = Aspect.AspectFit;
}
break;
case "Image":
string IMGData = String.Concat(V.Value);
byte[] B = System.Convert.FromBase64String(IMGData);
CP.Source = ImageSource.FromStream(() => new System.IO.MemoryStream(B));
break;
case "BackColor":
CP.BackgroundColor = ColorExtensions.GetXColor(String.Concat(V.Nodes()));
break;
case "Tag":
CP.ClassId = String.Concat(V.Nodes());
break;
}
}
}
CP.Aspect = Aspect.AspectFill;
Parent.Children.Add(CP, new Rectangle(CP.X, CP.Y, CP.Width, CP.Height), AbsoluteLayoutFlags.None);
Parent.LowerChild(CP);
} else if (C.Attribute("type").Value.StartsWith("System.Windows.Forms.Button")) {
var CP = new Button ();
foreach(XElement V in C.Elements()) {
if (V.Name == "Property") {
switch (V.Attribute("name").Value) {
case "Location":
CP.ORect = new Rectangle(Convert.ToInt32(String.Concat(V.Nodes()).Substring(0, String.Concat(V.Nodes()).IndexOf(","))), Convert.ToInt32(String.Concat(V.Nodes()).Substring(String.Concat(V.Nodes()).IndexOf(",") + 1)), CP.ORect.Width, CP.ORect.Height);
CP.Layout(new Rectangle(
Convert.ToInt32(String.Concat(V.Nodes()).Substring(0, String.Concat(V.Nodes()).IndexOf(","))) * App.ScaleFactorX,
Convert.ToInt32(String.Concat(V.Nodes()).Substring(String.Concat(V.Nodes()).IndexOf(",") + 1)) * App.ScaleFactorY,
CP.Width,
CP.Height));
Point pt = new Point(Convert.ToInt32(String.Concat(V.Nodes()).Substring(0, String.Concat(V.Nodes()).IndexOf(","))) * App.ScaleFactorX,
Convert.ToInt32(String.Concat(V.Nodes()).Substring(String.Concat(V.Nodes()).IndexOf(",") + 1)) * App.ScaleFactorY);
break;
case "Size":
CP.ORect = new Rectangle(CP.ORect.Left, CP.ORect.Top, Convert.ToInt32(String.Concat(V.Nodes()).Substring(0, String.Concat(V.Nodes()).IndexOf(","))), Convert.ToInt32(String.Concat(V.Nodes()).Substring(String.Concat(V.Nodes()).IndexOf(",") + 1)));
CP.Layout(new Rectangle(CP.X, CP.Y, Convert.ToInt32(String.Concat(V.Nodes()).Substring(0, String.Concat(V.Nodes()).IndexOf(","))) * App.ScaleFactorX, Convert.ToInt32(String.Concat(V.Nodes()).Substring(String.Concat(V.Nodes()).IndexOf(",") + 1)) * App.ScaleFactorY));
break;
case "Image":
string IMGData = String.Concat(V.Value);
byte[] B = System.Convert.FromBase64String(IMGData);
var TempFile = System.IO.Path.GetTempFileName();
System.IO.File.WriteAllBytes(System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData) + "/" + System.IO.Path.GetFileName(TempFile), B);
CP.Image = System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData) + "/" + System.IO.Path.GetFileName(TempFile);
break;
case "ForeColor":
CP.TextColor = ColorExtensions.GetXColor(String.Concat(V.Nodes()));
break;
case "BackColor":
CP.BackgroundColor = ColorExtensions.GetXColor(String.Concat(V.Nodes()));
break;
case "Caption":
case "Text":
CP.Text = String.Concat(V.Nodes()).Replace("##", "\r\n");
break;
case "Tag":
CP.ClassId = String.Concat(V.Nodes());
break;
case "Font":
string[] UFont = String.Concat(V.Nodes()).Replace("style=", "").Replace("Microsoft Sans Serif", "Helvetica").Split(new[] {
","
}, StringSplitOptions.RemoveEmptyEntries);
CP.FontFamily = UFont[0];
CP.FontSize = float.Parse(UFont[1].Replace("pt", ""));
if (Array.IndexOf(UFont, " Bold") > -1) {
CP.FontAttributes = CP.FontAttributes | FontAttributes.Bold;
//.........这里部分代码省略.........