protected void AlterarTextoFonte(Label label, string texto, int máximoCaracteresTexto)
        {
            if (texto.Length > máximoCaracteresTexto)
                texto = texto.Substring(0, máximoCaracteresTexto - 4) + " ...";

            label.SuspendLayout();
            label.Text = texto;
            AjustarTamanhoFonte(label);
            label.ResumeLayout();
        }
Exemple #2
0
 public void AddProgressBarX(string title)
 {
     this.m_baseWnd.SuspendLayout();
     Label label = new Label();
     label.SuspendLayout();
     label.AutoSize = false;
     label.Text = title;
     using (Graphics graphics = Graphics.FromHwnd(label.Handle))
     {
         this.m_titleWidth = ((int) graphics.MeasureString(label.Text, this.m_Font).Width) + label.Margin.Size.Width;
     }
     label.Size = new Size(this.m_titleWidth, label.Font.Height);
     label.Location = new Point(this.m_baseWnd.Location.X + this.m_fromPt.X, (this.m_baseWnd.Location.Y + this.m_fromPt.Y) + (this.m_intervalBarH * this.m_ValuePair.Count));
     ProgressBarX rx = new ProgressBarX();
     rx.SuspendLayout();
     rx.Size = new Size(this.m_barWidth, 0x17);
     rx.Style = ProgressBarStyle.Continuous;
     rx.Location = new Point((label.Location.X + label.Width) + 10, label.Location.Y - ((rx.Height - label.Height) >> 1));
     Label label2 = new Label();
     label2.SuspendLayout();
     label2.AutoSize = true;
     label2.Size = new Size(50, label2.Font.Height);
     label2.Text = string.Empty;
     label2.Location = new Point((rx.Location.X + rx.Width) + 10, label.Location.Y);
     rx.TitleLable = label;
     rx.TextLable = label2;
     ValuePair item = new ValuePair();
     item.Key = title;
     item.Value = rx;
     this.m_ValuePair.Add(item);
     this.m_baseWnd.Controls.Add(rx);
     this.m_baseWnd.Controls.Add(label);
     this.m_baseWnd.Controls.Add(label2);
     this.AdjustWindow();
     label2.ResumeLayout();
     rx.ResumeLayout();
     label.ResumeLayout();
     this.m_baseWnd.ResumeLayout();
     this.m_baseWnd.PerformLayout();
 }
        public static Label Label(IXsdPart part, ToolTip tooltip = null)
        {
            try
            {
                if (String.IsNullOrWhiteSpace(part.Name))
                {
                    throw new ArgumentNullException();
                }
                var label = new Label();
                label.SuspendLayout();
                label.ForeColor = System.Drawing.Color.Black;
                label.AutoSize = true;
                label.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
                label.Font = Methods.BaseFont;
                label.Size = new System.Drawing.Size(41, 13);
                label.Text = part.Name;
                label.Name = "l" + part.Name;

                if (tooltip != null)
                {
                    tooltip.SetToolTip(label, part.Documentation);
                }

                if (part.Name == "HeaderLabel")
                {
                    label.Visible = false;
                    label.Margin = new Padding(0, 0, 0, 10);
                }

                label.ResumeLayout();
                return label;
            }
            catch (Exception ex)
            {
                log.Debug(ex);
                return null;
            }
        }
Exemple #4
0
        private void InitializeComponents()
        {
            nameLabel = new Label();
              pathLabel = new Label();
              nameTextBox = new TextBox();
              pathTextBox = new TextBox();
              okButton = new Button();
              cancelButton = new Button();

              this.SuspendLayout();
              nameLabel.SuspendLayout();
              pathLabel.SuspendLayout();
              nameTextBox.SuspendLayout();
              pathTextBox.SuspendLayout();
              okButton.SuspendLayout();
              cancelButton.SuspendLayout();

              nameLabel.Text = "Name";
              nameLabel.AutoSize = true;
              nameLabel.Location = new Point(3, 3);

              pathLabel.Text = "Path";
              pathLabel.AutoSize = true;
              pathLabel.Location = new Point(3, 30);

              nameTextBox.Size = new Size(250, 19);
              nameTextBox.Location = new Point(40, 2);
              nameTextBox.BorderStyle = BorderStyle.FixedSingle;

              pathTextBox.Size = new Size(250, 19);
              pathTextBox.Location = new Point(40, 29);
              pathTextBox.BorderStyle = BorderStyle.FixedSingle;

              okButton.Text = "OK";
              okButton.Size = new Size(75, 23);
              okButton.Location = new Point((300-75)/2, 60);
              okButton.FlatStyle = FlatStyle.Flat;
              okButton.Click += delegate {
            this.DialogResult = DialogResult.OK;
            this.Close();
              };

              cancelButton.Text = "Cancel";
              cancelButton.Size = new Size(75, 23);
              cancelButton.Location = new Point(215, 60);
              cancelButton.FlatStyle = FlatStyle.Flat;
              cancelButton.Click += delegate {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
              };

              this.Size = new Size(300, 120);
              this.FormBorderStyle = FormBorderStyle.FixedSingle;
              this.Text = "Jump target";
              this.Controls.AddRange(new Control[]{
            nameLabel,
            pathLabel,
            nameTextBox,
            pathTextBox,
            okButton,
            cancelButton
              });

              nameLabel.ResumeLayout(false);
              pathLabel.ResumeLayout(false);
              nameTextBox.ResumeLayout(false);
              pathTextBox.ResumeLayout(false);
              okButton.ResumeLayout(false);
              cancelButton.ResumeLayout(false);
              this.ResumeLayout(false);
              this.PerformLayout();
        }
 public static Label OccursLabel(decimal maxCount)
 {
     try
     {
         var label = new Label();
         label.SuspendLayout();
         label.ForeColor = System.Drawing.Color.Black;
         label.AutoSize = true;
         label.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
         label.Font = Methods.BaseFont;
         label.BackColor = System.Drawing.Color.FromArgb(255, 195, 194);
         label.Size = new System.Drawing.Size(41, 13);
         label.Text = "Maximum of entries " + maxCount + " allowed";
         label.Name = "OccursError";
         label.Margin = new System.Windows.Forms.Padding(0, 0, 0, 0);
         label.Visible = true;
         label.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
         label.Location = new System.Drawing.Point(0, 0);
         label.ResumeLayout();
         return label;
     }
     catch (Exception ex)
     {
         return null;
     }
 }
Exemple #6
0
        public Label CreateLabel(string text, int xLocation, int width = -1)
        {
            var label = new Label();
            label.SuspendLayout();
            label.AutoSize = false;
            label.AutoEllipsis = true;
            label.Text = text;
            label.Font = font;
            label.Size = new Size(width == -1 ? TextRenderer.MeasureText(label.Text, label.Font).Width : width, this.barHeight);
            label.Location = new Point(xLocation, 0);
            label.TextAlign = ContentAlignment.MiddleLeft; // TODO: this doesn't work when there are ellipsis
            label.ResumeLayout();

            return label;
        }
        public NodeTargetContinuousUI(NodeTargetContinuous node)
        {
            int x, y;
            x = y = 0;

            Def.PbBase.Controls.Add(this);
            this.components = new System.ComponentModel.Container();
            this.Selector = new System.Windows.Forms.ContextMenuStrip(this.components);
            this.Selector.GripMargin = new System.Windows.Forms.Padding(2);
            this.Selector.SuspendLayout();
            this.SuspendLayout();
            //            this.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells;
            //            this.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells;

            this.Node = node;
            LabelTop = new Label();
            LabelBottom = new Label();
            LabelTop.SuspendLayout();
            LabelBottom.SuspendLayout();
            Def.PbBase.Controls.Add(this.LabelTop);
            Def.PbBase.Controls.Add(this.LabelBottom);
            LabelTop.AutoSize = true;
            LabelBottom.AutoSize = true;
            this.viewdataToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.manuallysplitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.autosplitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.fullautogrowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.removeSubNodesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.MouseHover += new System.EventHandler(grid_MouseHover);
            this.MouseLeave += new System.EventHandler(grid_MouseLeave);
            this.ContextMenuStrip = this.Selector;
            //
            // Selector
            //
            this.Selector.AllowDrop = true;
            this.Selector.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.viewdataToolStripMenuItem,
            this.manuallysplitToolStripMenuItem,
            this.autosplitToolStripMenuItem,
            this.fullautogrowToolStripMenuItem,
            this.removeSubNodesToolStripMenuItem});
            this.Selector.Location = new System.Drawing.Point(23, 61);
            this.Selector.Name = "Menu";
            this.Selector.Size = new System.Drawing.Size(133, 148);
            this.Selector.Visible = true;
            //
            // viewdataToolStripMenuItem
            //
            this.viewdataToolStripMenuItem.Name = "viewdataToolStripMenuItem";
            this.viewdataToolStripMenuItem.Text = "View data";
            this.viewdataToolStripMenuItem.Click += new System.EventHandler(this.viewdataToolStripMenuItem_Click);
            //
            // manuallysplitToolStripMenuItem
            //
            this.manuallysplitToolStripMenuItem.Name = "manuallysplitToolStripMenuItem";
            this.manuallysplitToolStripMenuItem.Text = "Manually split";
            this.manuallysplitToolStripMenuItem.Click += new System.EventHandler(this.manuallysplitToolStripMenuItem_Click);
            //
            // autosplitToolStripMenuItem
            //
            this.autosplitToolStripMenuItem.Name = "autosplitToolStripMenuItem";
            this.autosplitToolStripMenuItem.Text = "Auto split";
            this.autosplitToolStripMenuItem.Click += new System.EventHandler(this.autosplitToolStripMenuItem_Click);
            //
            // fullautogrowToolStripMenuItem
            //
            this.fullautogrowToolStripMenuItem.Name = "fullautogrowToolStripMenuItem";
            this.fullautogrowToolStripMenuItem.Text = "Full auto grow";
            this.fullautogrowToolStripMenuItem.Click += new System.EventHandler(this.fullautogrowToolStripMenuItem_Click);
            //
            // removeSubNodesToolStripMenuItem
            //
            this.removeSubNodesToolStripMenuItem.Name = "removeSubNodesToolStripMenuItem";
            this.removeSubNodesToolStripMenuItem.Text = "Remove subnodes";
            this.removeSubNodesToolStripMenuItem.Click += new System.EventHandler(this.removeSubNodesToolStripMenuItem_Click);

            DataGridViewCellStyle Style1 = new DataGridViewCellStyle();
            DataGridViewCellStyle Style2 = new DataGridViewCellStyle();
            C1 = new DataGridViewTextBoxColumn();
            C2 = new DataGridViewTextBoxColumn();
            AllowUserToAddRows = false;
            AllowUserToDeleteRows = false;
            AllowUserToOrderColumns = false;
            AllowUserToResizeColumns = false;
            AllowUserToResizeRows = false;
            Style1.Alignment = DataGridViewContentAlignment.TopLeft;
            Style1.WrapMode = DataGridViewTriState.False;
            AlternatingRowsDefaultCellStyle = Style1;
            CellBorderStyle = DataGridViewCellBorderStyle.SingleVertical;
            ClipboardCopyMode = DataGridViewClipboardCopyMode.Disable;
            Style2.Alignment = DataGridViewContentAlignment.TopLeft;
            Style2.BackColor = System.Drawing.SystemColors.Control;
            Style2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            Style2.ForeColor = System.Drawing.SystemColors.WindowText;
            Style2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
            Style2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
            Style2.WrapMode = DataGridViewTriState.True;
            ColumnHeadersDefaultCellStyle = Style2;
            ColumnHeadersVisible = false;
            Columns.Add(this.C1);
            Columns.Add(this.C2);
            Cursor = Cursors.Hand;
            EditMode = DataGridViewEditMode.EditProgrammatically;
            Margin = new Padding(0);
            MultiSelect = false;
            Name = "nodeContinuous";
            ReadOnly = true;
            RowHeadersVisible = false;
            RowTemplate.Height = 18;
            ScrollBars = ScrollBars.None;
            //            SelectionMode = DataGridViewSelectionMode.ColumnHeaderSelect;
            this.C1.DefaultCellStyle = Style1;
            this.C1.Frozen = true;
            this.C1.HeaderText = "Column1";
            this.C1.Name = "c1";
            this.C1.ReadOnly = true;
            this.C1.Width = 50;
            this.C2.DefaultCellStyle = Style2;
            this.C2.Frozen = true;
            this.C2.HeaderText = "Column2";
            this.C2.Name = "c2";
            this.C2.ReadOnly = true;
            this.C2.Width = 60;

            Rows.Add(6);
            Rows[y].Cells[x].Value = "Node " + Node.Id; ++y;
            Rows[y].Cells[x].Value = "Mean"; ++y;
            Rows[y].Cells[x].Value = "Std Dev"; ++y;
            Rows[y].Cells[x].Value = "Cf Var"; ++y;
            Rows[y].Cells[x].Value = "n"; ++y;
            Rows[y].Cells[x].Value = "%"; ++y;
            ++x; y = 1;

            double mean = Node.Mean;
            double stdDev = Node.StdDev;

            Rows[y].Cells[x].Value = Math.Round(mean, 2); ++y;
            Rows[y].Cells[x].Value = Math.Round(stdDev, 2); ++y;
            Rows[y].Cells[x].Value = Math.Round(stdDev / mean, 2); ++y;
            Rows[y].Cells[x].Value = Node.Table.RowCount; ++y;
            Rows[y].Cells[x].Value = Math.Round((double)Node.Table.RowCount / (double)Def.TrainingSetRowCount * (double)100, 2); ++y;
            ++x; y = 1;

            //            AutoSizeColumn(DataGridViewAutoSizeColumnCriteria.HeaderAndRows, 0);
            //            AutoSizeColumn(DataGridViewAutoSizeColumnCriteria.HeaderAndRows, 1);

            LabelTop.Text = "";
            LabelBottom.Text = "";

            Height = (RowTemplate.Height * 6) + 4;
            Width = 110;
            removeSubNodesToolStripMenuItem.Enabled = false;
            this.Selector.ResumeLayout(false);
            this.Selector.Hide();
            this.ResumeLayout(false);
        }