Пример #1
0
        private void InitializeDiagram()
        {
            OrgContainerShape org = new OrgContainerShape();

            this.WindowState = FormWindowState.Maximized;
            //if (Program.themeName != "") //set the example theme to the same theme QSF uses
            //{
            //    this.ThemeName = Program.themeName;
            //} else {
            //    this.ThemeName = "TelerikMetro";
            //}
            this.ApplyThemeRecursively(this.Controls);
            this.radDiagram1.BackColor = System.Drawing.Color.White;
            this.radDiagram1.ForeColor = System.Drawing.Color.Black;
            this.radDiagram1.IsInformationAdornerVisible = false;
            this.radDiagram1.ActiveTool            = Telerik.Windows.Diagrams.Core.MouseTool.PanTool;
            this.radDiagram1.IsSnapToGridEnabled   = false;
            this.radDiagram1.IsSnapToItemsEnabled  = false;
            this.radDiagram1.RouteConnections      = false;
            this.radDiagram1.RoutingService.Router = new Telerik.Windows.Diagrams.Core.OrgTreeRouter()
            {
                TreeLayoutType = Telerik.Windows.Diagrams.Core.TreeLayoutType.TreeDown
            };
            this.radDiagram1.RoutingService.AutoUpdate     = true;
            this.radDiagram1.RouteConnections              = true;
            this.radDiagram1.BackgroundGrid.Visibility     = Telerik.WinControls.ElementVisibility.Hidden;
            this.radDiagram1.BackgroundPageGrid.Visibility = Telerik.WinControls.ElementVisibility.Hidden;
            this.radDiagram1.IsSettingsPaneEnabled         = false;
            currentLayoutSettings = new Telerik.Windows.Diagrams.Core.TreeLayoutSettings()
            {
                HorizontalSeparation         = 80d,
                VerticalSeparation           = 60d,
                UnderneathVerticalTopOffset  = 50d,
                UnderneathHorizontalOffset   = 130d,
                UnderneathVerticalSeparation = 40d,
                VerticalDistance             = 10d,
            };
            if (cbofilter.SelectedIndex == -1)
            {
                this.PopulateWithData();
            }
            else
            {
                this.Filtrar();
            }
            this.radDiagram1.Zoom = 0.8;
            this.radDiagram1.DiagramElement.HorizontalScrollbar.Value = 250;
            this.radDiagram1.DiagramElement.VerticalScrollbar.Value   = 100;
            this.radDiagram1.SetLayout(Telerik.Windows.Diagrams.Core.LayoutType.Tree, currentLayoutSettings);
        }
Пример #2
0
        public OrgChartForm()
        {
            this.InitializeComponent();
            if (Program.themeName != "") //set the example theme to the same theme QSF uses
            {
                this.ThemeName = Program.themeName;
            }
            else
            {
                this.ThemeName = "TelerikMetro";
            }
            this.ApplyThemeRecursively(this.Controls);
            this.radDiagram1.BackColor = System.Drawing.Color.White;
            this.radDiagram1.IsInformationAdornerVisible = false;
            this.radDiagram1.ActiveTool            = Telerik.Windows.Diagrams.Core.MouseTool.PanTool;
            this.radDiagram1.IsSnapToGridEnabled   = false;
            this.radDiagram1.IsSnapToItemsEnabled  = false;
            this.radDiagram1.RouteConnections      = false;
            this.radDiagram1.RoutingService.Router = new Telerik.Windows.Diagrams.Core.OrgTreeRouter()
            {
                TreeLayoutType = Telerik.Windows.Diagrams.Core.TreeLayoutType.TreeDown
            };
            this.radDiagram1.RoutingService.AutoUpdate     = true;
            this.radDiagram1.RouteConnections              = true;
            this.radDiagram1.BackgroundGrid.Visibility     = Telerik.WinControls.ElementVisibility.Hidden;
            this.radDiagram1.BackgroundPageGrid.Visibility = Telerik.WinControls.ElementVisibility.Hidden;
            this.radDiagram1.IsSettingsPaneEnabled         = false;
            currentLayoutSettings = new Telerik.Windows.Diagrams.Core.TreeLayoutSettings()
            {
                HorizontalSeparation         = 120d,
                VerticalSeparation           = 180d,
                UnderneathVerticalTopOffset  = 50d,
                UnderneathHorizontalOffset   = 230d,
                UnderneathVerticalSeparation = 40d,
                VerticalDistance             = 10d,
            };

            if (Environment.OSVersion.Version.Major > 5)
            {
                this.PopulateWithData();
                this.radDiagram1.Zoom = 0.8;
                this.radDiagram1.DiagramElement.HorizontalScrollbar.Value = 250;
                this.radDiagram1.DiagramElement.VerticalScrollbar.Value   = 100;
                this.radDiagram1.SetLayout(Telerik.Windows.Diagrams.Core.LayoutType.Tree, currentLayoutSettings);
            }
        }