/// <summary> /// Initialize a new instance of the KryptonBorderEdgeActionList class. /// </summary> /// <param name="owner">Designer that owns this action list instance.</param> public KryptonBorderEdgeActionList(KryptonBorderEdgeDesigner owner) : base(owner.Component) { _borderEdge = owner.Component as KryptonBorderEdge; // Assuming we were correctly passed an actual component... if (_borderEdge != null) { // Get access to the actual Orientation property PropertyDescriptor orientationProp = TypeDescriptor.GetProperties(_borderEdge)[@"Orientation"]; // If we succeeded in getting the property if (orientationProp != null) { // Decide on the next action to take given the current setting _action = (Orientation)orientationProp.GetValue(_borderEdge) == Orientation.Vertical ? "Horizontal border orientation" : "Vertical border orientation"; } } // Cache service used to notify when a property has changed _service = (IComponentChangeService)GetService(typeof(IComponentChangeService)); }
public KryptonBorderEdgeProxy(KryptonBorderEdge borderEdge) { _borderEdge = borderEdge; }
private void AddNode(XmlNode node, System.Windows.Forms.Control.ControlCollection ctrls) { XmlAttribute attr = node.Attributes["X"]; int x = attr != null?int.Parse(attr.Value) : 0; attr = node.Attributes["Y"]; int y = attr != null?int.Parse(attr.Value) : 0; if (node.Name == "page") { TabControl tc = this.GetTabControl(ctrls); if (tc == null) { tc = new TabControl(); tc.Location = new Point(x, y); attr = node.Attributes["anchor"]; if (attr != null) { tc.Anchor = this.GetAnchor(attr.Value); } attr = node.Attributes["width"]; int w = attr == null ? 0 : int.Parse(attr.Value); attr = node.Attributes["height"]; int h = attr == null ? 0 : int.Parse(attr.Value); if (w > 0 || h > 0) { tc.Size = new Size(w == 0 ? tc.Width : w, h == 0 ? tc.Height : h); } ctrls.Add(tc); } attr = node.Attributes["name"]; string pageName = attr == null ? Strings.CategoryDefault : attr.Value; TabPage tp = this.GetPage(tc, pageName); foreach (XmlNode controlNode in node.ChildNodes) { AddNode(controlNode, tp.Controls); } } if (node.Name == "label") { attr = node.Attributes["text"]; if (attr != null) { KryptonLabel label = new KryptonLabel(); label.Text = attr.Value; label.Location = new Point(x, y); ctrls.Add(label); } } else if (node.Name == "line") { KryptonBorderEdge line = new KryptonBorderEdge(); line.Location = new Point(x, y); line.AutoSize = false; attr = node.Attributes["width"]; if (attr != null) { line.Size = new Size(int.Parse(attr.Value), 1); } else { line.Size = new Size(50, 1); } attr = node.Attributes["anchor"]; if (attr != null) { line.Anchor = this.GetAnchor(attr.Value); } ctrls.Add(line); } else if (node.Name == "control") { attr = node.Attributes["field"]; if (attr != null) { Field field = Obj.ObjectClass.FindField(attr.Value, true); if (field != null) { Control control = AddFieldControl(field); attr = node.Attributes["anchor"]; if (attr != null) { control.Anchor = this.GetAnchor(attr.Value); } attr = node.Attributes["width"]; int w = attr == null ? 0 : int.Parse(attr.Value); attr = node.Attributes["height"]; int h = attr == null ? 0 : int.Parse(attr.Value); if (w > 0 || h > 0) { control.Size = new Size(w == 0 ? control.Width : w, h == 0 ? control.Height : h); } control.Location = new Point(x, y); if (field.FieldType == FieldType.Boolean) { attr = node.Attributes["text"]; if (attr != null) { bool view_text = bool.Parse(attr.Value); control.Text = field.Name; } } else if (field.FieldType == FieldType.List) { attr = node.Attributes["small_buttons"]; if (attr != null) { bool sb = bool.Parse(attr.Value); ((ListBoxControl)control).SmallButtons = sb; } } ctrls.Add(control); } } } }