示例#1
0
        public static NPersonalInfo[] CreateCompanyInfo()
        {
            NPersonalInfo[] personalInfo = new NPersonalInfo[10];

            string biograhy = "William Smith graduated from NYC with a BSC degree in 1990.  He founded the company in 1998.  Mr. Smith business skills quickly made the company profitable. He speaks fluently French and German.";

            personalInfo[0] = new NPersonalInfo(0, 0, "William Smith", "President", "~\\Images\\man2.jpg", biograhy, new NRectangleF(305, 70, 190, 110), -8);

            biograhy        = "Charlie Good graduated from Washington university with a BSC degree in 1995.  He joined the company in 2001 and his skills in marketing were quickly recognized.";
            personalInfo[1] = new NPersonalInfo(1, 1, "Charlie Good", "VP Marketing", "~\\Images\\man1.jpg", biograhy, new NRectangleF(60, 220, 190, 110), -45);

            biograhy        = "Kevin Taylor graduated from Colorado university with a BSC degree in 1990.  He joined the company in 1999. Kevin likes to ski and surf when he's not working overtime.";
            personalInfo[2] = new NPersonalInfo(2, 1, "Kevin Tylor", "VP Sales", "~\\Images\\man4.jpg", biograhy, new NRectangleF(290, 220, 190, 110), -45);

            biograhy        = "Patricia Holgate has a BA degree from St. Lawrence College. Patricia has in depth knowledge in production. She loves music and sports.";
            personalInfo[3] = new NPersonalInfo(3, 1, "Patricia Holgate", "VP Production", "~\\Images\\woman3.jpg", biograhy, new NRectangleF(520, 220, 190, 110), -45);

            biograhy        = "Peter Marchall has a BS degree in chemistry from Boston College (1988).";
            personalInfo[4] = new NPersonalInfo(5, 2, "Peter Marshall", "Manager", "~\\Images\\man3.jpg", biograhy, new NRectangleF(90, 350, 190, 110), 0);

            biograhy        = "Tracy Chapmann is a graduate of Sussex University (MA, economics).  She has also taken the courses 'Multi-Cultural Selling' and 'Time Management for the Sales Professional'. She is fluent in Japanese.";
            personalInfo[5] = new NPersonalInfo(6, 2, "Tracy Chapmann", "Manager", "~\\Images\\woman1.jpg", biograhy, new NRectangleF(90, 480, 190, 110), 0);

            biograhy        = "Jane Buckley has a degree in international marketing from the University of Colorado.  She joined the company as a sales representative and was promoted to sales manager.";
            personalInfo[6] = new NPersonalInfo(7, 2, "Jane Buckley", "Manager", "~\\Images\\woman2.jpg", biograhy, new NRectangleF(320, 350, 190, 110), 0);

            biograhy        = "Dave Zak joined the company after completing his military service in 1997. He has also taken the courses 'Multi-Cultural Selling' and 'Time Management for the Sales Professional'.";
            personalInfo[7] = new NPersonalInfo(8, 2, "Dave Zak", "Manager", "~\\Images\\man5.jpg", biograhy, new NRectangleF(320, 480, 190, 110), 0);

            biograhy        = "Stephen Maule has a BA degree in Marketing from St. Christopher College.  He is fluent in French and German.";
            personalInfo[8] = new NPersonalInfo(9, 2, "Stephen Maule", "Manager", "~\\Images\\man7.jpg", biograhy, new NRectangleF(550, 350, 190, 110), 0);

            biograhy        = "Steve Tucker has a BA degree in Economics from the university of London.  He is fluent in French and German.";
            personalInfo[9] = new NPersonalInfo(10, 2, "Steve Tucker", "Manager", "~\\Images\\man6.jpg", biograhy, new NRectangleF(550, 480, 190, 110), 0);

            return(personalInfo);
        }
示例#2
0
        protected NCompositeShape CreateOrgChartShape(NPersonalInfo info)
        {
            NRectangleF bounds = info.Bounds;
            float       bottomPortAlignment = info.BottomPortAlignment;
            Bitmap      photo = new Bitmap(this.MapPathSecure(info.Picture));

            // compose a new graph vertex from a frame and an image
            NRectanglePath frame = new NRectanglePath(bounds);
            NRectanglePath image = new NRectanglePath(new NPointF(bounds.X + 5, bounds.Y + 5), new NSizeF(photo.Size));

            NStyle.SetFillStyle(image, new NImageFillStyle(photo, 0xff));

            NCompositeShape shape = new NCompositeShape();

            shape.Primitives.AddChild(frame);
            shape.Primitives.AddChild(image);
            shape.UpdateModelBounds();
            Document.ActiveLayer.AddChild(shape);

            // set the vertex fill style
            NColorFillStyle fillStyle = null;

            switch (info.Level)
            {
            case 0:
                fillStyle = new NColorFillStyle(Color.FromArgb(241, 100, 34));
                break;

            case 1:
                fillStyle = new NColorFillStyle(Color.FromArgb(249, 167, 26));
                break;

            case 2:
                fillStyle = new NColorFillStyle(Color.FromArgb(255, 247, 151));
                break;
            }

            fillStyle.ImageFiltersStyle.Filters.Add(new NLightingImageFilter());
            shape.Style.FillStyle = fillStyle;

            // add a new label for the person name
            NRotatedBoundsLabel nameLabel = new NRotatedBoundsLabel(info.Name, shape.UniqueId, new Nevron.Diagram.NMargins(40, 1, 50, 1));

            shape.Labels.AddChild(nameLabel);
            NStyle.SetTextStyle(nameLabel, nameLabel.ComposeTextStyle().Clone() as NTextStyle);
            nameLabel.Style.TextStyle.StringFormatStyle.HorzAlign = HorzAlign.Right;
            nameLabel.Style.TextStyle.StringFormatStyle.VertAlign = VertAlign.Top;

            // configure default label (used for the person position)
            NRotatedBoundsLabel positionLabel = shape.Labels.DefaultLabel as NRotatedBoundsLabel;

            NStyle.SetTextStyle(positionLabel, positionLabel.ComposeTextStyle().Clone() as NTextStyle);
            positionLabel.Style.TextStyle.FontStyle.InitFromFont(new Font("Arial", 10, FontStyle.Bold));
            positionLabel.Style.TextStyle.StringFormatStyle.HorzAlign = HorzAlign.Right;
            positionLabel.Style.TextStyle.StringFormatStyle.VertAlign = VertAlign.Bottom;
            positionLabel.Margins = new Nevron.Diagram.NMargins(40, 5, 1, 50);
            positionLabel.Text    = info.Position;

            // create the optional ports of the shape
            shape.CreateShapeElements(ShapeElementsMask.Ports);

            // add rotated bounds ports
            NPort leftPort = new NRotatedBoundsPort(shape.UniqueId, new NContentAlignment(ContentAlignment.MiddleLeft));

            leftPort.Name = "Left";
            shape.Ports.AddChild(leftPort);

            NPort rightPort = new NRotatedBoundsPort(shape.UniqueId, new NContentAlignment(ContentAlignment.MiddleRight));

            rightPort.Name = "Right";
            shape.Ports.AddChild(rightPort);

            NPort topPort = new NRotatedBoundsPort(shape.UniqueId, new NContentAlignment(ContentAlignment.TopCenter));

            topPort.Name = "Top";
            shape.Ports.AddChild(topPort);

            NRotatedBoundsPort bottomPort = new NRotatedBoundsPort(shape.UniqueId, new NContentAlignment(bottomPortAlignment, 50));

            bottomPort.Name = "Bottom";
            shape.Ports.AddChild(bottomPort);

            return(shape);
        }
示例#3
0
        protected void CreateScene()
        {
            NDrawingView1.Document.BackgroundStyle.FrameStyle.Visible = false;

            // configure title
            NTextShape title = new NTextShape("The Business Company", 0, 0, Document.Width, 60);

            Document.ActiveLayer.AddChild(title);

            NTextStyle textStyle = title.ComposeTextStyle().Clone() as NTextStyle;

            textStyle.FontStyle.InitFromFont(new Font("Arial Black", 22, FontStyle.Bold | FontStyle.Italic));

            // set gradient fill style
            textStyle.FillStyle = new NGradientFillStyle(
                GradientStyle.Horizontal,
                GradientVariant.Variant1,
                Color.FromArgb(241, 100, 34),
                Color.FromArgb(255, 247, 151));

            // add shadow
            textStyle.ShadowStyle = new NShadowStyle(
                ShadowType.GaussianBlur,
                Color.FromArgb(50, 122, 122, 122),
                new Nevron.GraphicsCore.NPointL(5, 5),
                1,
                new NLength(3));

            title.Style.TextStyle = textStyle;

            NPersonalInfo[] personalInfos = NPersonalInfo.CreateCompanyInfo();


            // create an Org chart shape for each person in the Org chart
            NCompositeShape presidentShape = CreateOrgChartShape(personalInfos[0]);

            NCompositeShape vpMarketingShape  = CreateOrgChartShape(personalInfos[1]);
            NCompositeShape vpSalesShape      = CreateOrgChartShape(personalInfos[2]);
            NCompositeShape vpProductionShape = CreateOrgChartShape(personalInfos[3]);

            NCompositeShape mm01Shape = CreateOrgChartShape(personalInfos[4]);
            NCompositeShape mm02Shape = CreateOrgChartShape(personalInfos[5]);

            NCompositeShape sm01Shape = CreateOrgChartShape(personalInfos[6]);
            NCompositeShape sm02Shape = CreateOrgChartShape(personalInfos[7]);

            NCompositeShape pm01Shape = CreateOrgChartShape(personalInfos[8]);
            NCompositeShape pm02Shape = CreateOrgChartShape(personalInfos[9]);

            //	connect the Org chart shapes
            // 1. President to VPs
            NShape ge = null;

            ge = new NStep3Connector(true, 50, 0, true);
            Document.ActiveLayer.AddChild(ge);
            ge.StartPlug.Connect(presidentShape.Ports.GetChildByName("Bottom", 0) as NPort);
            ge.EndPlug.Connect(vpMarketingShape.Ports.GetChildByName("Top", 0) as NPort);

            ge = new NStep3Connector(true, 50, 0, true);
            Document.ActiveLayer.AddChild(ge);
            ge.StartPlug.Connect(presidentShape.Ports.GetChildByName("Bottom", 0) as NPort);
            ge.EndPlug.Connect(vpSalesShape.Ports.GetChildByName("Top", 0) as NPort);

            ge = new NStep3Connector(true, 50, 0, true);
            Document.ActiveLayer.AddChild(ge);
            ge.StartPlug.Connect(presidentShape.Ports.GetChildByName("Bottom", 0) as NPort);
            ge.EndPlug.Connect(vpProductionShape.Ports.GetChildByName("Top", 0) as NPort);

            // 1. VPs to managers
            ge = new NStep2Connector(true);
            Document.ActiveLayer.AddChild(ge);
            ge.StartPlug.Connect(vpMarketingShape.Ports.GetChildByName("Bottom", 0) as NPort);
            ge.EndPlug.Connect(mm01Shape.Ports.GetChildByName("Left", 0) as NPort);

            ge = new NStep2Connector(true);
            Document.ActiveLayer.AddChild(ge);
            ge.StartPlug.Connect(vpMarketingShape.Ports.GetChildByName("Bottom", 0) as NPort);
            ge.EndPlug.Connect(mm02Shape.Ports.GetChildByName("Left", 0) as NPort);

            ge = new NStep2Connector(true);
            Document.ActiveLayer.AddChild(ge);
            ge.StartPlug.Connect(vpSalesShape.Ports.GetChildByName("Bottom", 0) as NPort);
            ge.EndPlug.Connect(sm01Shape.Ports.GetChildByName("Left", 0) as NPort);

            ge = new NStep2Connector(true);
            Document.ActiveLayer.AddChild(ge);
            ge.StartPlug.Connect(vpSalesShape.Ports.GetChildByName("Bottom", 0) as NPort);
            ge.EndPlug.Connect(sm02Shape.Ports.GetChildByName("Left", 0) as NPort);

            ge = new NStep2Connector(true);
            Document.ActiveLayer.AddChild(ge);
            ge.StartPlug.Connect(vpProductionShape.Ports.GetChildByName("Bottom", 0) as NPort);
            ge.EndPlug.Connect(pm01Shape.Ports.GetChildByName("Left", 0) as NPort);

            ge = new NStep2Connector(true);
            Document.ActiveLayer.AddChild(ge);
            ge.StartPlug.Connect(vpProductionShape.Ports.GetChildByName("Bottom", 0) as NPort);
            ge.EndPlug.Connect(pm02Shape.Ports.GetChildByName("Left", 0) as NPort);
        }