示例#1
0
        /// <summary>
        /// Initializes the styles.
        /// </summary>
        protected virtual void InitializeStyles()
        {
            customerNodeStyle = new NodeControlNodeStyle("CustomerNodeTemplate");
            productNodeStyle  = new NodeControlNodeStyle("ProductNodeTemplate");
            labelStyle        = new LabelControlLabelStyle("LabelTemplate");
            edgeStyle         = new EdgeSegmentControlEdgeStyle("EdgeSegmentTemplate")
            {
                SegmentThickness = 5, PathStyle = new PolylineEdgeStyle {
                    Pen = new Pen(Brushes.Black, 5)
                }
            };
            portStyle = new PortControlPortStyle("PortTemplate")
            {
                RenderSize = new SizeD(5, 5)
            };

            // set an initial default size for all nodes
            Graph.NodeDefaults.Size = new SizeD(150, 80);

            // and set the customer node style as the default
            Graph.NodeDefaults.Style = customerNodeStyle;

            // the same for the edges labels....
            Graph.EdgeDefaults.Labels.Style = labelStyle;
            // edges....
            Graph.EdgeDefaults.Style = edgeStyle;

            // and the ports
            Graph.NodeDefaults.Ports.Style = portStyle;
        }
 public override void UpdateFor(IRenderContext context, ILabel label, LabelControlLabelStyle style)
 {
     base.UpdateFor(context, label, style);
     UpdateOrientationState(true);
 }
 public override void InitializeFrom(IRenderContext context, ILabel label, LabelControlLabelStyle style)
 {
     base.InitializeFrom(context, label, style);
     UpdateOrientationState(false);
 }