Пример #1
0
        protected ColumnStyle[] getcs(params float[] ps)
        {
            ColumnStyle[]      rss = default(ColumnStyle[]);
            List <ColumnStyle> rsl = new List <ColumnStyle>();

            foreach (var item in ps)
            {
                int p = (int)(item);
                int x = (int)Math.Round((item - p) * 10);
                switch (x % 3)
                {
                case 0: rsl.Add(new ColumnStyle(SizeType.AutoSize, p)); break;

                case 1: rsl.Add(new ColumnStyle(SizeType.Absolute, p)); break;

                case 2: rsl.Add(new ColumnStyle(SizeType.Percent, p)); break;

                default:
                    break;
                }
            }
            rss = new ColumnStyle[rsl.Count];
            rsl.CopyTo(rss);
            return(rss);
        }
Пример #2
0
        private void SetFirstColumnWidth(float width, int level)
        {
            if (clientControl != null)
            {
                foreach (Control control in clientControl.Controls)
                {
                    DialogSectionControl sec = control as DialogSectionControl;
                    if (sec != null)
                    {
                        sec.SetFirstColumnWidth(width, 0);
                    }
                }
//        float oldwidth = clientControl.GetColumnWidths()[0];
                ColumnStyle style = new ColumnStyle(SizeType.Absolute);
                style.Width = width - level;
                //if(enclosure != null) {
                //  enclosure.Width += (int)(width - oldwidth);
                //}
                clientControl.ColumnStyles.Add(style);
                clientControl.Width = clientControl.PreferredSize.Width;
                if (enclosure != null)
                {
                    enclosure.Width = enclosure.PreferredSize.Width;
                    minWidth        = this.Width = enclosure.Width;
                }
                else
                {
                    minWidth = this.Width = clientControl.Width;
                }
                ColumnStyle style2 = new ColumnStyle(SizeType.Percent);
                style2.Width = 100;
//        clientControl.ColumnStyles.Add(style2);
            }
        }
        void sizeCol(int newWidth)
        {   // change the height of one row
            if (newWidth == 0)
            {
                return;
            }
            if (sizingCol < 0)
            {
                return;
            }
            SuspendLayout();
            colWidths = GetColumnWidths();
            if (sizingCol >= colWidths.Length)
            {
                return;
            }

            if (newWidth > 0)
            {
                ColumnStyles[sizingCol] = new ColumnStyle(SizeType.Absolute, newWidth);
            }
            ResumeLayout();
            colWidths = GetColumnWidths();
            getColRectangles(SplitterSize);
        }
Пример #4
0
        // použití tablelayoutpanelu (obdobné jako Java Grid Layout) aplikace se nehorázně zasekává -> ukázka automatického resizování buňěk
        // imho je lepší použít klasický panel, práce s tablelayoutpanelem je sice jednodušší a
        //nastaví si sám velikost jednotlivých buněk, avšak hrozně se to seká, nedoporučuju používat pro tyto účely (snažil sem se aby byl výsledek shodný ve všech jazycích)
        public void createField()
        {
            _form.field = new TableLayoutPanel();
            _form.field.CellBorderStyle = TableLayoutPanelCellBorderStyle.Outset;
            _form.field.AutoSize        = true;
            _form.field.Dock            = DockStyle.Fill;
            _form.field.GrowStyle       = TableLayoutPanelGrowStyle.FixedSize;

            _form.field.ColumnCount = _xLength;
            _form.field.RowCount    = _yLength;

            this.generateMines();
            _buttons = new MineButton[_xLength, _yLength];

            for (int y = 0; y < _yLength; y++)
            {
                // mění velikost řádku dle velikosti celé tabulky
                RowStyle rowstyle = new RowStyle(SizeType.Percent, (float)(100 / _xLength));
                _form.field.RowStyles.Add(rowstyle);

                for (int x = 0; x < _xLength; x++)
                {
                    // mení velikost sloupce v závislosti na celé tabulce
                    ColumnStyle colstyle = new ColumnStyle(SizeType.Percent, (float)(100 / _xLength));
                    _form.field.ColumnStyles.Add(colstyle);

                    _buttons[x, y]            = new MineButton(x, y);
                    _buttons[x, y].MouseDown += new MouseEventHandler(Mines_MouseDown);

                    _form.field.Controls.Add(_buttons[x, y], x, y);
                }
            }

            _form.Controls.Add(_form.field);
        }
Пример #5
0
        private void SetTableStyle()
        {
            // 行スタイル
            for (; table.RowCount != table.RowStyles.Count;)
            {
                if (table.RowCount < table.RowStyles.Count)
                {
                    this.table.RowStyles.RemoveAt(this.table.RowStyles.Count - 1);
                }
                else
                {
                    var rowStyle = new RowStyle(SizeType.Percent, (float)100.0 / table.RowCount);
                    this.table.RowStyles.Add(rowStyle);
                }
            }

            // 列スタイル
            for (; table.ColumnCount != table.ColumnStyles.Count;)
            {
                if (table.ColumnCount < table.ColumnStyles.Count)
                {
                    this.table.ColumnStyles.RemoveAt(this.table.ColumnStyles.Count - 1);
                }
                else
                {
                    var colStyle = new ColumnStyle(SizeType.Percent, (float)100.0 / table.ColumnCount);
                    this.table.ColumnStyles.Add(colStyle);
                }
            }
        }
Пример #6
0
        /// <summary>
        /// Adds a new column. The column width is calculated based on the given <paramref name="value"/>.
        /// <list type="bullet">
        ///     <item>Auto - The width is calculated automatically.</item>
        ///     <item>* - The column grabs all available space.</item>
        ///     <item>125 - The column has a fixed width of 125.</item>
        /// </list>
        /// </summary>
        /// <param name="value">Value of column definition</param>
        /// <exception cref="ArgumentNullException">If <paramref name="value"/> is NULL or empty</exception>
        /// <exception cref="FormatException">If <paramref name="value"/> cannot be parsed</exception>
        void IGridPanel.AddColumnDefinition(string value)
        {
            ColumnDefinition columnDefinition = new ColumnDefinition(value);
            ColumnStyle      columnStyle      = new ColumnStyle();
            SizeBehavior     mode             = columnDefinition.Mode;

            columnStyle.SizeType = mode == SizeBehavior.Auto
                ? SizeType.AutoSize
                : (mode == SizeBehavior.Fill ? SizeType.Percent : SizeType.Absolute);

            if (columnStyle.SizeType == SizeType.Percent)
            {
                columnStyle.Width = 1.0f;
            }

            if (columnStyle.SizeType == SizeType.Absolute)
            {
                columnStyle.Width = columnDefinition.Width;
            }

            ColumnStyles.Add(columnStyle);

            if (ColumnStyles.Count > ColumnCount)
            {
                ((IGridPanel)this).GridColumns++;
            }
        }
Пример #7
0
        private void loadTable()
        {
            tableLayoutPanel1.RowStyles.Clear();
            for (int i = 0; i < tableLayoutPanel1.RowCount; i++)
            {
                tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Percent, 100 / tableLayoutPanel1.RowCount));
            }
            tableLayoutPanel1.ColumnStyles.Clear();
            for (int i = 0; i < tableLayoutPanel1.ColumnCount; i++)
            {
                ColumnStyle sty = new ColumnStyle(SizeType.Percent, 100 / tableLayoutPanel1.ColumnCount);
                tableLayoutPanel1.ColumnStyles.Add(sty);
            }

            for (int i = 0; i < (tableLayoutPanel1.RowCount * tableLayoutPanel1.ColumnCount); i++)
            {
                PictureBox a1 = new PictureBox();
                a1.Dock                  = DockStyle.Fill;
                a1.InitialImage          = Properties.Resources.loading_gif;
                a1.SizeMode              = PictureBoxSizeMode.StretchImage;
                a1.BackgroundImageLayout = ImageLayout.Stretch;
                a1.Margin                = new Padding(0, 0, 0, 0);
                a1.BackColor             = Color.White;
                tableLayoutPanel1.Controls.Add(a1);
            }
        }
Пример #8
0
        public LanesContainer(ILanesDatabaseService lanesDatabaseService, ICardDatabaseService cardDatabaseService)
        {
            SetupToolTip();
            InitializeComponent();
            _lanesDatabaseService = lanesDatabaseService;
            _cardDatabaseService  = cardDatabaseService;
            this.Dock             = DockStyle.Fill;
            var mainLayoutPanel = new TableLayoutPanel()
            {
                Dock = DockStyle.Fill,
                Size = new Size(400, 800)
            };
            var row1        = new RowStyle(SizeType.Absolute, 50);
            var row2        = new RowStyle(SizeType.Percent, 100);
            var columnStyle = new ColumnStyle(SizeType.Percent, 100);

            mainLayoutPanel.RowStyles.Add(row1);
            mainLayoutPanel.RowStyles.Add(row2);
            mainLayoutPanel.ColumnStyles.Add(columnStyle);
            mainLayoutPanel.Controls.Add(BuildMainMenu(), 0, 0);


            LanesCollection = new List <Lane>();
            _layoutPanel    = new FlowLayoutPanel
            {
                FlowDirection    = FlowDirection.LeftToRight, Dock = DockStyle.Fill, WrapContents = false,
                HorizontalScroll = { Enabled = true }, AutoScroll = true,
                Size             = new Size(this.Width, 800)
            };
            this.Controls.Add(_layoutPanel);
            this.Resize += LanesContainer_Resize;

            mainLayoutPanel.Controls.Add(_layoutPanel, 0, 1);
            this.Controls.Add(mainLayoutPanel);
        }
Пример #9
0
            private void InitListView()
            {
                this.columnsAndRowsListView.Items.Clear();
                string str = this.isRowCollection ? "Row" : "Column";
                int    num = this.isRowCollection ? this.tlp.RowStyles.Count : this.tlp.ColumnStyles.Count;

                for (int i = 0; i < num; i++)
                {
                    string str2;
                    string str3;
                    if (this.isRowCollection)
                    {
                        RowStyle style = this.tlp.RowStyles[i];
                        str2 = style.SizeType.ToString();
                        str3 = this.FormatValueString(style.SizeType, style.Height);
                    }
                    else
                    {
                        ColumnStyle style2 = this.tlp.ColumnStyles[i];
                        str2 = style2.SizeType.ToString();
                        str3 = this.FormatValueString(style2.SizeType, style2.Width);
                    }
                    string[] items = new string[] { str + ((i + 1)).ToString(CultureInfo.InvariantCulture), str2, str3 };
                    this.columnsAndRowsListView.Items.Add(new ListViewItem(items));
                }
                if (num > 0)
                {
                    this.ClearAndSetSelectionAndFocus(0);
                }
                this.removeButton.Enabled = this.columnsAndRowsListView.Items.Count > 1;
            }
Пример #10
0
        private void ControlPanel_OnDock(object sender, EventArgs e)
        {
            if (m_ControlPanelForm == null)
            {
                m_ControlPanelForm      = new Form();
                m_ControlPanelForm.Text = "Control Panel";
                m_ControlPanelForm.Size = new Size(310, 566);

                MainLayoutPanel.Controls.Remove(m_ControlPanel);
                m_DockColumn = MainLayoutPanel.ColumnStyles[1];
                MainLayoutPanel.ColumnStyles.Remove(m_DockColumn);

                m_ControlPanelForm.Controls.Add(m_ControlPanel);
                m_ControlPanel.Dock = DockStyle.Fill;

                m_ControlPanelForm.Show();
            }
            else
            {
                if (m_DockColumn != null)
                {
                    MainLayoutPanel.ColumnStyles.Add(m_DockColumn);
                }

                m_ControlPanelForm.Controls.Remove(m_ControlPanel);
                MainLayoutPanel.Controls.Add(m_ControlPanel, 1, 0);
                m_ControlPanel.Dock = DockStyle.Fill;

                m_ControlPanelForm.Close();
                m_ControlPanelForm = null;
            }
        }
Пример #11
0
        public void OpenProject(Project project)
        {
            CurrentProject = project;
            if (Settings.Default.RecentFolders == null)
            {
                Settings.Default.RecentFolders = new System.Collections.Specialized.StringCollection();
            }
            else
            {
                if (Settings.Default.RecentFolders.Contains(project.Path))
                {
                    Settings.Default.RecentFolders.Remove(project.Path);
                }
                Settings.Default.RecentFolders.Insert(0, project.Path);
            }

            unlocked = project.Encryted ? MatchResult.Locked : MatchResult.ChiefAdmin;
            UpdateRibbonMenu(true);

            Relayout();
            ColumnStyle column = projectPanel.ColumnStyles[0];

            column.SizeType = SizeType.Percent;
            column.Width    = 50f;
            FormBorderStyle = FormBorderStyle.Sizable;

            UpdateGroupView();
            DrawCharts();

            project.OperationDone += UpdateUndoRedoMenuStrip;
            if (ProjectOpen != null)
            {
                ProjectOpen.Invoke(project);
            }
        }
Пример #12
0
        public void ColumnStyle_Ctor_SizeType(SizeType sizeType)
        {
            var style = new ColumnStyle(sizeType);

            Assert.Equal(sizeType, style.SizeType);
            Assert.Equal(0, style.Width);
        }
Пример #13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Column"/> class.
 /// </summary>
 /// <param name="table">The table.</param>
 /// <param name="styleName">Name of the style.</param>
 public Column(Table table, string styleName)
 {
     this.Table    = table;
     this.Document = table.Document;
     this.NewXmlNode(styleName);
     this.ColumnStyle = this.Document.StyleFactory.Request <ColumnStyle>(styleName);
 }
Пример #14
0
        public void ColumnStyle_Width_SetWithOwner_GetReturnsExpected(float value, int expectedLayoutCallCount)
        {
            using var control = new TableLayoutPanel();
            var style = new ColumnStyle();

            control.LayoutSettings.RowStyles.Add(style);
            int layoutCallCount = 0;

            control.Layout += (sender, e) =>
            {
                Assert.Same(control, sender);
                Assert.Same(control, e.AffectedControl);
                Assert.Equal("Style", e.AffectedProperty);
                layoutCallCount++;
            };

            style.Width = value;
            Assert.Equal(value, style.Width);
            Assert.Equal(expectedLayoutCallCount, layoutCallCount);
            Assert.False(control.IsHandleCreated);

            // Set same.
            style.Width = value;
            Assert.Equal(value, style.Width);
            Assert.Equal(expectedLayoutCallCount, layoutCallCount);
            Assert.False(control.IsHandleCreated);
        }
Пример #15
0
        public void ColumnStyle_Ctor_SizeType_Float(SizeType sizeType, float width)
        {
            var style = new ColumnStyle(sizeType, width);

            Assert.Equal(sizeType, style.SizeType);
            Assert.Equal(width, style.Width);
        }
Пример #16
0
        public void WidthTest1()
        {
            ColumnStyle cs = new ColumnStyle();

            cs.Width = 1.0f;
            Assert.AreEqual(1.0f, cs.Width, "1");
        }
Пример #17
0
        public void CtorTest3()
        {
            ColumnStyle cs = new ColumnStyle(SizeType.Absolute, 5.0f);

            Assert.AreEqual(5.0, cs.Width, "1");
            Assert.AreEqual(SizeType.Absolute, cs.SizeType, "2");
        }
Пример #18
0
        public void CtorTest1()
        {
            ColumnStyle cs = new ColumnStyle();

            Assert.AreEqual(0.0f, cs.Width, "1");
            Assert.AreEqual(SizeType.AutoSize, cs.SizeType, "2");
        }
Пример #19
0
        private void FrmCourseChoice_Load(object sender, EventArgs e)
        {
            this.TextForeColor = ConfigSetting.TextForeColor;
            this.Icon          = ConfigSetting.ProjectIcon;
            List <XF.Model.Base_Course> models = bll.GetModelList(string.Empty);

            if (models.Count > 0)
            {
                tableLayoutPanel1.ColumnStyles.Clear();

                for (int i = 0; i < models.Count; i++)
                {
                    QQButton btn = new QQButton();
                    btn.Dock   = DockStyle.Fill;
                    btn.Name   = "BtnCourse" + models[i].CourseID.ToString();
                    btn.Text   = models[i].CourseName;
                    btn.Tag    = models[i];
                    btn.Click += new EventHandler(BtnCourse_Click);
                    ColumnStyle columnStyle = new ColumnStyle();
                    columnStyle.SizeType          = SizeType.Percent;
                    columnStyle.Width             = 100 / models.Count;
                    tableLayoutPanel1.ColumnCount = models.Count;
                    tableLayoutPanel1.ColumnStyles.Add(columnStyle);
                    tableLayoutPanel1.Controls.Add(btn);
                }
            }
        }
Пример #20
0
        public void ColumnStyle_Ctor_Default()
        {
            var style = new ColumnStyle();

            Assert.Equal(SizeType.AutoSize, style.SizeType);
            Assert.Equal(0, style.Width);
        }
        private void setStyleTLPParamMain()
        {
            RowStyle    rowStyle01, rowStyle02, rowStyle03;
            ColumnStyle columnStyle01, columnStyle02, columnStyle03;

            rowStyle01    = new RowStyle();
            rowStyle02    = new RowStyle();
            rowStyle03    = new RowStyle();
            columnStyle01 = new ColumnStyle();
            columnStyle02 = new ColumnStyle();
            columnStyle03 = new ColumnStyle();

            rowStyle01.SizeType    = SizeType.Percent;
            rowStyle02.SizeType    = SizeType.Percent;
            rowStyle03.SizeType    = SizeType.Percent;
            columnStyle01.SizeType = SizeType.Percent;
            columnStyle02.SizeType = SizeType.Percent;
            columnStyle03.SizeType = SizeType.Percent;

            rowStyle01.Height   = 9;
            rowStyle02.Height   = 81;
            rowStyle03.Height   = 10;
            columnStyle01.Width = 45;
            columnStyle02.Width = 45;
            columnStyle03.Width = 10;

            tLPParamMain.RowStyles.Add(rowStyle01);
            tLPParamMain.RowStyles.Add(rowStyle02);
            tLPParamMain.RowStyles.Add(rowStyle03);
            tLPParamMain.ColumnStyles.Add(columnStyle01);
            tLPParamMain.ColumnStyles.Add(columnStyle02);
            tLPParamMain.ColumnStyles.Add(columnStyle03);
        }
Пример #22
0
        private void MainForm_Shown(object sender, EventArgs e)
        {
            if (setDBConnectionAndLoad())
            {
                var count = Attendant.MaxAttendantsPerDay(_db);
                for (int x = 1; x <= count; x++)
                {
                    var style = new ColumnStyle(SizeType.Absolute, 125);
                    scheduleTable.ColumnStyles.Add(style);
                    scheduleTable.ColumnCount++;
                }

                if (Properties.Settings.Default.MainFormHeight != 0)
                {
                    Height = Properties.Settings.Default.MainFormHeight;
                    Width  = Properties.Settings.Default.MainFormWidth;
                    Left   = Properties.Settings.Default.MainFormX;
                    Top    = Properties.Settings.Default.MainFormY;
                }

                if (Properties.Settings.Default.StartDate == DateTime.MinValue)
                {
                    selectToolStripMenuItem_Click(null, EventArgs.Empty);
                }
                else
                {
                    loadByRange();
                }
            }
        }
Пример #23
0
        public LimitWindow(List <LimitTempView> gui, int min, int max)
            : this()
        {
            views           = gui;
            txtMinTemp.Text = min.ToString();
            txtMaxTemp.Text = max.ToString();

            for (int i = 0; i < views.Count; i++)
            {
                LimitTempView col = views[i];
                // Do not add new column on the first iteration
                // because there is already one
                if (!(limitSetter.ColumnCount == 1 && i == 0))
                {
                    limitSetter.ColumnCount++;
                    limitSetter.Width += COL_WIDTH;
                }
                ColumnStyle style = new ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F);
                limitSetter.ColumnStyles.Add(style);

                limitSetter.Controls.Add(col.LabName, i, 0);
                FillCell(col.CbSelected, col.TxtTime, i, 1);
            }

            UpdateColumnStyles();

            // Copy current model state
            beginState.Clear();
            beginState.AddRange(views.ConvertAll(view => view.Model.Clone()));
        }
Пример #24
0
        private void tableMain_SizeChanged(object sender, EventArgs e)
        {
            ColumnStyle columnLeft  = new ColumnStyle(SizeType.Absolute, 200);
            ColumnStyle columnRight = new ColumnStyle(SizeType.Absolute, 220);
            ColumnStyle columnFill  = new ColumnStyle(SizeType.Percent, 100);
            RowStyle    rowTop      = new RowStyle(SizeType.Absolute, 145);
            RowStyle    rowBottom   = new RowStyle(SizeType.Absolute, 256);
            RowStyle    rowFill     = new RowStyle(SizeType.Percent, 100);

            tableMain.SuspendLayout();

            if (tableMain.Width > columnLeft.Width + columnRight.Width)
            {
                tableMain.ColumnStyles[0] = columnFill;
                tableMain.ColumnStyles[1] = columnRight;
            }
            else
            {
                tableMain.ColumnStyles[0] = columnLeft;
                tableMain.ColumnStyles[1] = columnFill;
            }

            if (tableMain.Height > rowTop.Height + rowBottom.Height)
            {
                tableMain.RowStyles[0] = rowFill;
                tableMain.RowStyles[1] = rowBottom;
            }
            else
            {
                tableMain.RowStyles[0] = rowTop;
                tableMain.RowStyles[1] = rowFill;
            }

            tableMain.ResumeLayout();
        }
Пример #25
0
        /// <summary>
        /// Creates the column style.
        /// </summary>
        /// <param name="styleNode">The style node.</param>
        private void CreateColumnStyle(XmlNode styleNode)
        {
            ColumnStyle columnStyle = new ColumnStyle(this._document);

            columnStyle.Node = styleNode.CloneNode(true);
            IPropertyCollection pCollection = new IPropertyCollection();

            if (styleNode.HasChildNodes)
            {
                foreach (XmlNode node in styleNode.ChildNodes)
                {
                    IProperty property = this.GetProperty(columnStyle, node.CloneNode(true));
                    if (property != null)
                    {
                        pCollection.Add(property);
                    }
                }
            }

            columnStyle.Node.InnerXml = "";

            foreach (IProperty property in pCollection)
            {
                columnStyle.PropertyCollection.Add(property);
            }

            if (!this._common)
            {
                this._document.Styles.Add(columnStyle);
            }
            else
            {
                this._document.CommonStyles.Add(columnStyle);
            }
        }
Пример #26
0
        private void ThreadPanel_Create(int Tot)
        {
            EsecuzioneTLP.ColumnCount = Tot;

            // the first column already exists
            {
                ColumnStyle ClnSt = new ColumnStyle(SizeType.Percent, ((float)1 / Tot * 100));
                EsecuzioneTLP.ColumnStyles[0] = ClnSt;
            }


            for (int Idx = 0 + 1; Idx < Tot; Idx++)
            {
                ColumnStyle ClnSt = new ColumnStyle(SizeType.Percent, ((float)1 / Tot * 100));
                int         i     = EsecuzioneTLP.ColumnStyles.Add(ClnSt);
            }


            for (int Idx = 0; Idx < Tot; Idx++)
            {
                // r 1
                EsecuzioneTLP.Controls.Add(new Label()
                {
                    Text = Idx.ToString("00")
                }, Idx, 0);
                // r 2
                TextBox NumTxt = new TextBox()
                {
                    TextAlign = HorizontalAlignment.Right, Width = 50, Name = "NumThread" + Idx.ToString("00") + "Txt"
                };
                EsecuzioneTLP.Controls.Add(NumTxt, Idx, 1);
            }
        }
        public static void GetMatrixOfScatterDiagrams(TableLayoutPanel tableLayout, Claster[] clasters)
        {
            tableLayout.Controls.Clear();
            tableLayout.ColumnStyles.Clear();
            tableLayout.RowStyles.Clear();

            int n = tableLayout.ColumnCount = tableLayout.RowCount = clasters[0].Points[0].Length;
            int k = clasters.Length;

            for (int i = 0; i < n; i++)
            {
                RowStyle    rs = new RowStyle(SizeType.Percent, 100f / n);
                ColumnStyle cs = new ColumnStyle(SizeType.Percent, 100f / n);

                tableLayout.RowStyles.Add(rs);
                tableLayout.ColumnStyles.Add(cs);
            }

            tableLayout.CellBorderStyle = TableLayoutPanelCellBorderStyle.InsetDouble;

            for (int i = 0; i < k; i++)
            {
                clasters[i].PrepareForVisualization();
            }

            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j < n; j++)
                {
                    Chart chart = new Chart();
                    chart.Dock = DockStyle.Fill;


                    ChartArea chartArea = new ChartArea();
                    chart.ChartAreas.Add(chartArea);

                    //chart.ChartAreas[0].AxisX.Minimum = stat_i.Min;
                    //chart.ChartAreas[0].AxisX.Maximum = stat_i.Max;
                    chart.ChartAreas[0].AxisX.LabelStyle.Format = "{0:0.00}";
                    chart.ChartAreas[0].AxisY.LabelStyle.Format = "{0:0.00}";


                    if (i != j)
                    {
                        for (int l = 0; l < k; l++)
                        {
                            Series s = new Series();

                            s.ChartType = SeriesChartType.Point;
                            s.Points.DataBindXY(clasters[l].Dimentions[i], clasters[l].Dimentions[j]);

                            chart.Series.Add(s);
                        }
                    }

                    tableLayout.Controls.Add(chart, j, i);
                }
            }
        }
Пример #28
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Column"/> class.
 /// </summary>
 /// <param name="table">The table.</param>
 /// <param name="styleName">Name of the style.</param>
 public Column(Table table, string styleName)
 {
     this.Table    = table;
     this.Document = table.Document;
     this.NewXmlNode(styleName);
     this.ColumnStyle = new ColumnStyle(this.Document, styleName);
     this.Document.Styles.Add(this.ColumnStyle);
 }
Пример #29
0
 public static void SplitColumnsByPercentages(
     TableLayoutColumnStyleCollection columnStyles, float[] percentages)
 {
     for (var i = 0; i < columnStyles.Count; i++)
     {
         columnStyles[i] = new ColumnStyle(SizeType.Percent, percentages[i]);
     }
 }
Пример #30
0
 /// <summary>
 /// Adds the table layout column style.
 /// </summary>
 /// <param name="objTableLayoutPanel">The obj table layout panel.</param>
 /// <param name="objColumnStyle">The obj column style.</param>
 private void AddTableLayoutColumnStyle(TableLayoutPanel objTableLayoutPanel, ColumnStyle objColumnStyle)
 {
     if (objTableLayoutPanel != null && objColumnStyle != null)
     {
         objTableLayoutPanel.ColumnStyles.Add(objColumnStyle);
         objTableLayoutPanel.ColumnCount += 1;
     }
 }
Пример #31
0
        /// <summary>
        /// 加载配置文件,默认路径config.xml
        /// </summary>
        private void Load()
        {
            dataGridStyles = new Dictionary<string, DataGridStyle>();
            xmlDoc = new XmlDocument();
            if (File.Exists(filePath))
            {
                xmlDoc.Load(filePath);
                XmlNode node = xmlDoc.SelectSingleNode("Config/DataGridViews");
                XmlNodeList nodeList = node.SelectNodes("DataGridView");
                XmlNodeList columnNodes;
                ColumnStyle columnStyle;
                DataGridStyle dataGridStyle;
                int index;
                foreach (XmlNode _node in nodeList)
                {
                    dataGridStyle = new DataGridStyle();
                    dataGridStyle.TableName = _node.Attributes["tablename"].Value.ToString();
                    columnNodes = _node.ChildNodes;
                    index = 0;
                    foreach (XmlNode columnNode in columnNodes)
                    {
                        columnStyle = new ColumnStyle();
                        columnStyle.Name = columnNode.Attributes["name"].Value;
                        columnStyle.DisplayName = columnNode.Attributes["displayname"].Value;
                        columnStyle.Width = Convert.ToUInt16(columnNode.Attributes["width"].Value);
                        columnStyle.Visible = Convert.ToBoolean(columnNode.Attributes["visible"].Value);
                        columnStyle.Alignment = (DataGridViewContentAlignment)Convert.ToInt32(columnNode.Attributes["alignment"].Value);
                        if (columnNode.Attributes["show"] != null)
                            columnStyle.Show = Convert.ToBoolean(columnNode.Attributes["show"].Value);
                        else
                            columnStyle.Show = true;
                        columnStyle.Index = index;
                        index++;

                        if (!dataGridStyle.ColumnStyles.ContainsKey(columnStyle.Name))
                            dataGridStyle.ColumnStyles.Add(columnStyle.Name, columnStyle);
                        else
                            dataGridStyle.ColumnStyles[columnStyle.Name] = columnStyle;
                    }
                    dataGridStyles.Add(dataGridStyle.TableName, dataGridStyle);
                }
            }
            else
                CreateConfig();
        }
        /*
         *
         Example Use

         var alistofitems = new List<string>()
            {
                "Material",
                "Additional"
            };
           PrepareValueListsClass.PrepareValueLists(utgBOM, e, alistofitems, "ItemType", ColumnStyle.DropDownList, true, "Material");

         *
         *
         */
        public static void PrepareValueLists(
            UltraGrid aGrid,
            InitializeLayoutEventArgs e,
            List<string> alistofitems,
            string itemName,
            ColumnStyle aColumnStyle,
            bool hasdefault = false,
            string adefaultValue = "")
        {
            if (!aGrid.DisplayLayout.ValueLists.Exists(itemName))
            {
                UltraGridColumn checkColumn = e.Layout.Bands[0].Columns.Add
                    (
                        itemName,
                        itemName);
                checkColumn.CellActivation = Activation.AllowEdit;
                checkColumn.Header.VisiblePosition = 0;

                ValueList svl = aGrid.DisplayLayout.ValueLists.Add(itemName);

                foreach (string alistofitem in alistofitems)
                {
                    svl.ValueListItems.Add
                        (
                            alistofitem,
                            alistofitem);
                }

                aGrid.DisplayLayout.Bands[0].Columns[itemName].ValueList = aGrid.DisplayLayout.ValueLists[itemName];
                aGrid.DisplayLayout.Bands[0].Columns[itemName].Style = aColumnStyle;
            }
            if (!hasdefault)
            {
                return;
            }
            foreach (UltraGridRow row in aGrid.Rows)
            {
                row.Cells[itemName].Value = adefaultValue;
            }
        }
Пример #33
0
        /// 从表格列中获取样式信息DevExpress
        /// </summary>
        /// <param name="column"></param>
        /// <returns></returns>
        private ColumnStyle GetColumnStyle(DevExpress.XtraGrid.Columns.GridColumn column)
        {
            ColumnStyle columnstyle = new ColumnStyle();
            columnstyle.Name = column.Name;
            if (column.Caption == "")
                columnstyle.DisplayName = column.FieldName;
            else
                columnstyle.DisplayName = column.Caption;
            columnstyle.Width = Convert.ToUInt16(column.Width);
            columnstyle.Visible = column.Visible;
            columnstyle.Alignment = ConvertToAlignment(column);  //将DevExpress.XtraGrid列的对齐方式转化为DataGridViewContentAlignment
            columnstyle.Index = column.VisibleIndex;
            return columnstyle;

        }
Пример #34
0
        /// 设置表格列的样式DevExpress
        /// </summary>
        /// <param name="column"></param>
        /// <param name="columnStyle"></param>
        private void SetColumnStyle(DevExpress.XtraGrid.Columns.GridColumn column, ColumnStyle columnStyle)
        {
            column.Caption = columnStyle.DisplayName;
            if (columnStyle.Width != 0)
            {
                column.OptionsColumn.FixedWidth = true;
                column.Width = columnStyle.Width;
            }
            else
            {
                column.OptionsColumn.FixedWidth = false;
                //column.Width=column.GetBestWidth();//.BestFit();
                //column.Resize(column.GetBestWidth());
            }

            DevExpress.Utils.VertAlignment vertAlignment;
            DevExpress.Utils.HorzAlignment horzAlignment;
            getDevGridViewAlignment(columnStyle.Alignment, out vertAlignment, out horzAlignment);

            column.AppearanceCell.TextOptions.VAlignment = vertAlignment;
            column.AppearanceCell.TextOptions.HAlignment = horzAlignment;
            if (columnStyle.Visible)
                column.VisibleIndex = columnStyle.Index;
            else
                column.VisibleIndex = -1;
            //column.VisibleIndex = columnStyle.Index;
            column.Visible = columnStyle.Visible;
        }
Пример #35
0
 /// <summary>
 /// 设置表格列的样式
 /// </summary>
 /// <param name="column"></param>
 /// <param name="columnStyle"></param>
 private void SetColumnStyle(DataGridViewColumn column, ColumnStyle columnStyle)
 {
     column.HeaderText = columnStyle.DisplayName;
     if (columnStyle.Width == 0)
         column.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
     else
     {
         column.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
         column.Width = columnStyle.Width;
     }
     column.Visible = columnStyle.Visible && columnStyle.Show;
     column.DefaultCellStyle.Alignment = columnStyle.Alignment;
     column.DisplayIndex = columnStyle.Index;
 }
Пример #36
0
        /// <summary>
        /// 从表格列中获取样式信息
        /// </summary>
        /// <param name="column"></param>
        /// <returns></returns>
        private ColumnStyle GetColumnStyle(DataGridViewColumn column)
        {
            ColumnStyle columnstyle = new ColumnStyle();
            columnstyle.Name = column.Name;
            columnstyle.DisplayName = column.HeaderText;
            columnstyle.Width = Convert.ToUInt16(column.Width);
            columnstyle.Visible = column.Visible;
            columnstyle.Alignment = column.DefaultCellStyle.Alignment;
            columnstyle.Show = true;
            columnstyle.Index = column.DisplayIndex;

            return columnstyle;
        }
Пример #37
0
        /// <summary>
        /// 保存或更新表格样式
        /// </summary>
        /// <param name="tableName"></param>
        /// <param name="styleGridView">样式表格控件</param>
        public void SaveGridStyle(string tableName, DataGridView styleGridView)
        {
            DataGridStyle dataGridStyle = new DataGridStyle();
            dataGridStyle.TableName = tableName;
            ColumnStyle columnStyle;
            int index = 0;
            foreach (DataGridViewRow dr in styleGridView.Rows)
            {
                columnStyle = new ColumnStyle();
                columnStyle.Name = dr.Cells["name"].Value.ToString();
                columnStyle.DisplayName = dr.Cells["列名"].Value.ToString();
                columnStyle.Width = Convert.ToUInt16(dr.Cells["列宽"].Value);
                columnStyle.Visible = Convert.ToBoolean(dr.Cells["可见性"].Value);
                columnStyle.Alignment = GetAlignment(dr.Cells["对齐方式"].Value.ToString());
                columnStyle.Show = dr.Visible;
                columnStyle.Index = index;
                index++;
                dataGridStyle.ColumnStyles.Add(columnStyle.Name, columnStyle);
            }

            SaveGridStyle(dataGridStyle);
        }
 public bool Contains(ColumnStyle columnStyle)
 {
 }
 // Methods
 public int Add(ColumnStyle columnStyle)
 {
 }
 public int IndexOf(ColumnStyle columnStyle)
 {
 }
 public void Insert(int index, ColumnStyle columnStyle)
 {
 }
 public void Remove(ColumnStyle columnStyle)
 {
 }
 public InfraColumnTypeAttribute(ColumnStyle style_)
 {
   m_style=style_;
 }
Пример #44
0
        // 从 RML 文件中读入 <columns> 元素
        static int ReadColumnStyle(XmlTextReader reader,
            out List<ColumnStyle> styles,
            out string strError)
        {
            strError = "";
            styles = new List<ColumnStyle>();

            while (true)
            {
                if (reader.Read() == false)
                    break;
                if (reader.NodeType == XmlNodeType.Element)
                {
                    if (reader.Name == "column")
                    {
                        ColumnStyle style = new ColumnStyle();
                        style.Align = reader.GetAttribute("align");
                        style.Class = reader.GetAttribute("class");
                        style.Type = reader.GetAttribute("type");
                        styles.Add(style);
                    }
                }
                if (reader.NodeType == XmlNodeType.EndElement
    && reader.Name == "columns")
                    break;
            }

            return 0;
        }