コード例 #1
0
ファイル: XmlUtils.cs プロジェクト: bensenplus/breeze
        private static void ImportMember(XmlNodeList memberElements, DDocRow row)
        {
            foreach (XmlElement memberElement in memberElements)
            {
                switch (memberElement.Name)
                {
                    case "textChar":
                        var color = memberElement.GetAttribute("fontColor");
                        var fontColor = Color.Black;
                        if (!string.IsNullOrEmpty(color))
                        {
                            fontColor = System.Drawing.ColorTranslator.FromHtml(color);
                        }
                        var fontName = memberElement.GetAttribute("fontName");
                        var fontSize = Convert.ToSingle(memberElement.GetAttribute("fontSize"));
                        var fontStyle = memberElement.GetAttribute("fontStyle");

                        var text = memberElement.InnerText;
                        var singleTexts = text.ToCharArray();
                        foreach (var singleText in singleTexts)
                        {
                            var textChar = MDocument.CreateTextChar(Convert.ToString(singleText), fontName, fontSize,
                                                                    fontColor, GetFontStyle(fontStyle));
                            row.AddMember(textChar);
                        }
                        break;
                    case "textInput":
                        var textInput = new DTextInput();
                        row.AddMember(textInput.Xml2Object(memberElement, MDocument));
                        break;
                    case "table":
                        break;
                    case "image":
                        var content = memberElement.InnerText;
                        var image = new DImage(ConvertToImage(content));
                        row.AddMember(image);
                        break;
                    case "checkBox":
                        var checkBox = new DCheckBox
                            {
                                IsChecked = "True".Equals(memberElement.GetAttribute("isChecked")) ? true : false,
                                Value = memberElement.InnerText
                            };
                        row.AddMember(checkBox);
                        break;
                    case "comboBox":
                        var comboBox = new DComboBox();
                        row.AddMember(comboBox.Xml2Object(memberElement, MDocument));
                        break;
                    case "horizonLine":
                        var hLine = new DHorizonLine
                            {
                                Width = Convert.ToInt32(memberElement.GetAttribute("width")),
                                Height = Convert.ToInt32(memberElement.GetAttribute("height"))
                            };
                        break;
                }
            }
        }
コード例 #2
0
ファイル: EditorDocument.cs プロジェクト: bensenplus/breeze
 public override DCheckBox CreateCheckBox()
 {
     var dCheckBox = new DCheckBox();
     HangUpMember = dCheckBox;
     UpdateDocument(MConstant.EventType.Write);
     Context.Invalidate(new Rectangle(CurrentPage.X, CurrentPage.Y, CurrentPage.Width,
                                      CurrentPage.Height));
     return dCheckBox;
 }