Exemplo n.º 1
0
        private static void AddLinkFromCapability(ShuffleBuilder tree, string name, string tag = null, bool alignright = false)
        {
            var link = new LinkLabel
            {
                AutoSize = true,
                Dock     = alignright ? DockStyle.Right : DockStyle.Left,
                TabIndex = tree.gbNodeQuickActions.Controls.Count,
                TabStop  = true,
                Text     = name
            };
            var tagstr = tag ?? name;

            if (!string.IsNullOrEmpty(tagstr))
            {
                link.Tag          = tagstr;
                link.LinkBehavior = LinkBehavior.HoverUnderline;
                link.LinkClicked += tree.QuickActionLink_LinkClicked;
            }
            else
            {
                link.Enabled = false;
            }
            tree.gbNodeQuickActions.Controls.Add(link);
            if (!alignright)
            {
                link.BringToFront();
            }
        }
Exemplo n.º 2
0
        // Adds a link (method name, arrow, or line number) to the crumb bar for the specified record.
        private void AddLink(Record rec, LinkType linkType, int lineNum)
        {
            var newLinkLabel = new LinkLabel();

            newLinkLabel.Left              = _lastLinkLabel.Right;
            newLinkLabel.AutoSize          = true;
            newLinkLabel.LinkClicked      += linkLabel1_LinkClicked;
            newLinkLabel.LinkColor         = linkLabel1.LinkColor;
            newLinkLabel.LinkBehavior      = linkLabel1.LinkBehavior;
            newLinkLabel.DisabledLinkColor = linkLabel1.DisabledLinkColor;

            // By default, newLinkLabel.Links automatically contains one Link for the entire Text.

            var link = newLinkLabel.Links[0];

            if (linkType == LinkType.Arrow)
            {
                newLinkLabel.Name = "";

                if (_isVistaOrHigher)
                {
                    newLinkLabel.Text = "\u2192"; // Unicode arrow.
                }
                else
                {
                    // The unicode arrow char doesn't seem to work on XP.
                    newLinkLabel.Text = "->"; // Unicode arrow.
                }
            }
            else
            {
                newLinkLabel.Name    = "Not an Arrow"; // Anything but null or empty.
                newLinkLabel.Enabled = rec.IsVisible;

                if (linkType == LinkType.Method)
                {
                    newLinkLabel.Text = rec.MethodName.Name;
                }
                else if (linkType == LinkType.Linenum)
                {
                    newLinkLabel.Text = string.Format("Line {0}", rec.GetRecordNum(lineNum));
                }

                if (rec == _crumbBarRow.Rec)
                {
                    // Since newLinkLabel corresponds to the currently selected row,
                    // disable and "highlight" it.

                    DisableLink(newLinkLabel);
                    _visited = newLinkLabel;
                }
            }

            newLinkLabel.Tag = rec;
            _linkLabels.Add(newLinkLabel);
            _lastLinkLabel = newLinkLabel;
            Controls.Add(newLinkLabel);
            newLinkLabel.BringToFront();
        }
Exemplo n.º 3
0
        // Adds a link to the crumbBar for the specified record.  Adds appropriate text
        // (method name or line number) to the StringBuilder.  The lineNum parameter is
        // only relevant if the Record is not a MethodEntry record.
        private void AddToCrumbBar(StringBuilder builder, Record rec, int lineNum)
        {
            string crumb;

            if (rec.IsEntry)
            {
                crumb = rec.MethodName.Name;
            }
            else
            {
                crumb = string.Format("Line {0}", rec.GetRecordNum(lineNum));
            }

            // If the current LinkLabel is full, assign it the text we have so far
            // and make a new Linklabel for the "crumbs" we're about to add.
            if (_lastLinkLabel.Links.Count == 30)
            {
                _lastLinkLabel.Text = builder.ToString();
                builder.Length      = 0;

                int   loc       = _lastLinkLabel.Right;
                Color linkColor = _lastLinkLabel.LinkColor;

                _lastLinkLabel              = new LinkLabel();
                _lastLinkLabel.Left         = loc - _overlap;
                _lastLinkLabel.AutoSize     = true;
                _lastLinkLabel.LinkClicked += linkLabel1_LinkClicked;
                _lastLinkLabel.LinkColor    = linkColor;
                _linkLabels.Add(_lastLinkLabel);
                Controls.Add(_lastLinkLabel);
                _lastLinkLabel.BringToFront();
            }

            LinkLabel.Link link = new LinkLabel.Link(builder.Length, crumb.Length, rec);
            link.Enabled = rec.IsVisible && rec != _crumbBarRow.Rec;
            link.Name    = "M"; // Anything but string.Empty.
            _lastLinkLabel.Links.Add(link);
            _visited = link;
            builder.Append(crumb);

            // We always add a separator arrow after each method (even the last one),
            // which the user can click to get a list of methods called by the method.
            if (rec.IsEntry)
            {
                _lastLinkLabel.Links.Add(builder.Length + 1, 2, rec);
                builder.Append(" -> ");
            }
        }
Exemplo n.º 4
0
        private void streamingToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frec.pictureBoxFrameGrabber = this.picBox_Original;
            frec.StartStreaming();
            this.panel_mainPanel.Enabled = false;
            LinkLabel llablStopStreaming = new LinkLabel();

            llablStopStreaming.Text     = "Stop Streaming";
            llablStopStreaming.Location = new Point(137, 480);
            this.Controls.Add(llablStopStreaming);
            llablStopStreaming.BringToFront();
            llablStopStreaming.BackColor = Color.Black;
            llablStopStreaming.Font      = linkLabel1.Font;
            llablStopStreaming.Click    += new EventHandler(llablStopStreaming_Click);
            llablStopStreaming.AutoSize  = true;
        }
Exemplo n.º 5
0
        private static void AddLinkFromCapability(TreeBuilderControl tree, string name, string tag = null, bool alignright = false)
        {
            var link = new LinkLabel();

            link.AutoSize     = true;
            link.Dock         = alignright ? DockStyle.Right : DockStyle.Left;
            link.TabIndex     = tree.gbQuickActions.Controls.Count;
            link.TabStop      = true;
            link.Text         = name;
            link.Tag          = tag ?? name;
            link.LinkBehavior = LinkBehavior.HoverUnderline;
            link.LinkClicked += tree.QuickActionLink_LinkClicked;
            tree.gbQuickActions.Controls.Add(link);
            if (!alignright)
            {
                link.BringToFront();
            }
        }
Exemplo n.º 6
0
        private void LoadLinkLabels()
        {
            this.splitContainer3.Panel2.Controls.Clear();
            Point location = new Point(12, 8);

            for (int i = 65; i <= 90; i++)
            {
                LinkLabel label = new LinkLabel();
                label.Name      = ((char)i).ToString();
                label.Text      = ((char)i).ToString();
                label.AutoSize  = true;
                label.LinkColor = Color.Navy;
                label.Location  = location;
                label.Font      = new Font("Times New Roman", 10.2F);
                label.BringToFront();
                label.Click += CapitalLinkLabel_Click;
                location.X  += 35;
                this.splitContainer3.Panel2.Controls.Add(label);
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Generate a LinkLabel to the right of a control which will open the corresponding Wiki help page for that control.
        /// </summary>
        public static void createHelpLinkLabel(Control control, string helpKey)
        {
            try
            {
                LinkLabel lnk = new LinkLabel();
                lnk.Text     = "?";
                lnk.Location = new System.Drawing.Point(control.Left + control.Width + 1, control.Top);
                lnk.Tag      = helpKey;
                lnk.Width    = 16;
                lnk.Height   = 16;
                lnk.Font     = new System.Drawing.Font("Courier New", 10);
                control.Parent.Controls.Add(lnk);
                lnk.BringToFront();

                lnk.LinkClicked += new LinkLabelLinkClickedEventHandler(lnk_LinkClicked);
            }
            catch (Exception ex)
            {
                Eh.GlobalErrorHandler(ex);
            }
        }
Exemplo n.º 8
0
        private void AddLinkLabel2()
        {
            var linkLabel = new LinkLabel
            {
                Name         = @"linkLabel2",
                Text         = @"How to solve sudoku puzzles",
                Font         = new Font("Verdana", 9),
                Location     = new Point(325, 29),
                Size         = new Size(560, 23),
                BorderStyle  = BorderStyle.None,
                LinkVisited  = false,
                TextAlign    = ContentAlignment.MiddleLeft,
                FlatStyle    = FlatStyle.Flat,
                LinkBehavior = LinkBehavior.NeverUnderline,
                BackColor    = Color.Transparent
            };

            linkLabel.Links.Add(0, linkLabel.Text.Length, LinkData2);
            linkLabel.LinkClicked += LinkLabel2_LinkClicked;

            Controls.Add(linkLabel);
            linkLabel.BringToFront();
        }
Exemplo n.º 9
0
        private void AddLinkLabel()
        {
            var linkLabel = new LinkLabel
            {
                Name         = "linkLabel1",
                Text         = @"Download blank-sudoku-grid-candidates.pdf",
                Font         = new Font("Verdana", 9),
                Location     = new Point(325, 6),
                Size         = new Size(560, 23),
                BorderStyle  = BorderStyle.None,
                LinkVisited  = false,
                TextAlign    = ContentAlignment.MiddleLeft,
                FlatStyle    = FlatStyle.Flat,
                LinkBehavior = LinkBehavior.NeverUnderline,
                BackColor    = Color.Transparent
            };

            linkLabel.Links.Add(0, linkLabel.Text.Length, LinkData);
            linkLabel.LinkClicked += LinkLabel1_LinkClicked;

            Controls.Add(linkLabel);
            linkLabel.BringToFront();
        }
Exemplo n.º 10
0
        private void InitBookmarks(DataTable dt)
        {
            var letters = dt.AsEnumerable()
                          .Select(c => c["FullName"].ToString().Substring(0, 1))
                          .GroupBy(r => r)
                          .Select(x => x.Key).ToList();
            Point prevlocation = new Point(12, 27);

            foreach (var letter in letters)
            {
                LinkLabel newLink = new LinkLabel();
                newLink.Location = new Point(
                    prevlocation.X, prevlocation.Y + 15);
                prevlocation   = newLink.Location;
                newLink.Text   = letter;
                newLink.Width  = 15;
                newLink.Height = 13;
                this.Controls.Add(newLink);
                newLink.BringToFront();
                newLink.Click += new System.EventHandler(this.filterDGView);
            }
            this.ResumeLayout(false);
            this.PerformLayout();
        }
Exemplo n.º 11
0
        internal BuildDetailSectionStatus Initialize(IBuildDetail bd, ImageList imageList)
        {
            var result = new BuildDetailSectionStatus();

            this.imageList = imageList;

            bd.RefreshAllDetails();
            List <IBuildInformationNode> stepsNodes = BuildStepsNodes(bd);

            int successedCount = 0;

            this.lvItems.BeginUpdate();
            try
            {
                this.lvItems.Controls.Clear();
                this.table.Rows.Clear();
                stepsNodes.ForEach(node =>
                {
                    var newRow = new Row();
                    //newRow.Height = 20;

                    // icon cell
                    var iconCell = new Cell();
                    newRow.Cells.Add(iconCell);

                    // Build step message cell
                    string message  = node.Fields["Message"];
                    var messageCell = new Cell(message);
                    newRow.Cells.Add(messageCell);

                    // Completed On cell
                    string finishTime    = node.Fields["FinishTime"];
                    DateTime completedOn = DateTime.Parse(finishTime);
                    var completedOnCell  = new Cell(completedOn.ToString());
                    newRow.Cells.Add(completedOnCell);

                    this.table.Rows.Add(newRow);

                    // icon cell image
                    string status         = node.Fields["Status"];
                    bool successed        = status.ToLower() == "succeeded";
                    LinkLabel iconControl = CreateIcon(successed);
                    this.lvItems.Controls.Add(iconControl);
                    Rectangle iconCellRect = this.lvItems.CellRect(iconCell);
                    iconControl.Location   = new Point(iconCellRect.X, iconCellRect.Y + 1);
                    iconControl.BringToFront();

                    if (successed)
                    {
                        successedCount++;
                    }
                });

                result.Success = successedCount == stepsNodes.Count;
                result.Message = string.Format("{0} succeeded, {1} failed", successedCount,
                                               stepsNodes.Count - successedCount);
            }
            finally
            {
                this.lvItems.EndUpdate();
            }

            return(result);
        }
Exemplo n.º 12
0
        private void ОписаниеВсего()
        {
            СписокЯзыков.Items.Insert(0, "English");
            СписокЯзыков.Items.Insert(1, "Русский");
            СписокЯзыков.SelectedIndex = 0;
            СписокЯзыков.DropDownStyle = ComboBoxStyle.DropDownList;
            СписокЯзыков.Location      = new Point(20, 180);
            СписокЯзыков.Size          = new Size(200, 20);
            СписокЯзыков.Visible       = true;

            btnAdd3.Text     = "Обзор";
            btnAdd3.Location = new Point(360, 184);
            btnAdd3.Size     = new Size(80, 22);
            btnAdd3.Click   += new EventHandler(button3_Click);
            btnAdd3.Visible  = true;
            btnAdd3.BringToFront();

            btnAdd.Text     = "Отмена";
            btnAdd.Location = new Point(365, 315);
            btnAdd.Size     = new Size(70, 22);
            btnAdd.Click   += new EventHandler(button0_Click);
            btnAdd.BringToFront();

            btnAdd1.Text     = "Далее";
            btnAdd1.Location = new Point(280, 315);
            btnAdd1.Size     = new Size(70, 22);
            btnAdd1.Click   += new EventHandler(button1_Click);
            btnAdd1.BringToFront();

            btnAdd2.Text     = "Назад";
            btnAdd2.Location = new Point(209, 315);
            btnAdd2.Size     = new Size(70, 22);
            btnAdd2.Click   += new EventHandler(button2_Click);
            btnAdd2.BringToFront();
            btnAdd2.Enabled = false;

            panel.BackColor   = SystemColors.Control;
            panel.Location    = new Point(0, 300);
            panel.Size        = new Size(465, 85);
            panel.BorderStyle = BorderStyle.FixedSingle;

            picture.Location = new Point(12, 12);
            picture.Size     = new Size(161, 259);
            picture.Image    = Properties.Resources.Cezar;

            link.Text         = "О разработчике";
            link.AutoSize     = true;
            link.Location     = new Point(180, 250);
            link.Size         = new Size(80, 30);
            link.LinkClicked += new LinkLabelLinkClickedEventHandler(linkLabel1);

            Cezar.Name = "Cezar";
            Cezar.Text = "Добро пожаловать в Enigma! \n\nЭто приложение созданное для преобразования текста с секретом (ключом) для обеспечения секретности передаваемой информации при ведении тайной переписки . Программа для преобразования информации использует шифр Цезаря.\n\n" +
                         "Пожалуйста обратите внимание, что шифр Цезаря является самым простым и наиболее широко известным методом шифрования. И если предложить любому человеку придумать свой алгоритм шифровки, то он, наверняка, «придумает» именно такой способ, ввиду его простоты.";
            Cezar.Location = new Point(180, 25);
            Cezar.Size     = new Size(240, 210);
            Cezar.Links.Add(239, 6);
            Cezar.Font = new Font("Microsoft Sans Serif", 8.25f, System.Drawing.FontStyle.Regular);
            Cezar.BringToFront();
            Cezar.LinkClicked += new LinkLabelLinkClickedEventHandler(linkLabel2);

            RB1.Location  = new Point(20, 100);
            RB1.Size      = new Size(200, 20);
            RB1.BackColor = SystemColors.Control;
            RB1.Text      = "Кодирование текста";
            RB1.BringToFront();

            RB2.Location  = new Point(20, 160);
            RB2.Size      = new Size(200, 20);
            RB2.BackColor = SystemColors.Control;
            RB2.Text      = "Декодирование текста";
            RB2.BringToFront();

            label3.Font      = new Font("Microsoft Sans Serif", 8.25f, System.Drawing.FontStyle.Bold);
            label3.BackColor = SystemColors.ControlLightLight;
            label3.Location  = new Point(20, 10);
            label3.Size      = new Size(140, 15);

            label4.Text      = "Кодирование или декодирование текста";
            label4.BackColor = SystemColors.ControlLightLight;
            label4.Location  = new Point(40, 25);
            label4.Size      = new Size(350, 15);

            ОписаниеКодирования.Text      = "Шифрует входной текст на русском языке всеми возможными\nкомбинациями шифра Цезаря.";
            ОписаниеКодирования.Font      = new Font("Microsoft Sans Serif", 8.25f, FontStyle.Regular);
            ОписаниеКодирования.BackColor = SystemColors.Control;
            ОписаниеКодирования.Location  = new Point(40, 122);
            ОписаниеКодирования.Size      = new Size(450, 30);

            ОписаниеДекодирования.Text      = "Выдает таблицу всех возможных в шифре Цезаря\nпреобразований введенного текста.";
            ОписаниеДекодирования.Font      = new Font("Microsoft Sans Serif", 8.25f, FontStyle.Regular);
            ОписаниеДекодирования.BackColor = SystemColors.Control;
            ОписаниеДекодирования.Location  = new Point(40, 182);
            ОписаниеДекодирования.Size      = new Size(450, 30);

            picture1.Location = new Point(401, 5);
            picture1.Size     = new Size(35, 35);
            picture1.Image    = Properties.Resources._300px;

            panel1.BackColor   = SystemColors.Control;
            panel1.Location    = new Point(-1, 55);
            panel1.Size        = new Size(465, 335);
            panel1.BorderStyle = BorderStyle.FixedSingle;

            RB3.Location  = new Point(20, 100);
            RB3.Size      = new Size(100, 20);
            RB3.BackColor = SystemColors.Control;
            RB3.Text      = "Ввод текста";
            RB3.BringToFront();

            RB4.Location        = new Point(20, 125);
            RB4.BackColor       = SystemColors.Control;
            RB4.Size            = new Size(110, 20);
            RB4.Text            = "Текст из файла";
            RB4.CheckedChanged += new EventHandler(radioButton2_CheckedChanged);
            RB4.BringToFront();


            label3.Font      = new Font("Microsoft Sans Serif", 8.25f, System.Drawing.FontStyle.Bold);
            label3.BackColor = SystemColors.ControlLightLight;
            label3.Location  = new Point(20, 10);
            label3.Size      = new Size(250, 15);

            label4.BackColor = SystemColors.ControlLightLight;
            label4.Location  = new Point(40, 25);
            label4.Size      = new Size(300, 15);

            label2.Text      = "Файл для декодирования:";
            label2.BackColor = SystemColors.Control;
            label2.Location  = new Point(50, 165);
            label2.AutoSize  = true;

            text1.Location  = new Point(50, 185);
            text1.Multiline = true;
            text1.Size      = new Size(300, 20);

            panel1.BackColor   = SystemColors.Control;
            panel1.Location    = new Point(-1, 55);
            panel1.Size        = new Size(465, 335);
            panel1.BorderStyle = BorderStyle.FixedSingle;

            Язык.Text      = "Выберите язык:";
            Язык.Font      = new Font("Microsoft Sans Serif", 8.25f, System.Drawing.FontStyle.Bold);
            Язык.BackColor = SystemColors.ControlLightLight;
            Язык.Location  = new Point(20, 10);
            Язык.Size      = new Size(140, 15);

            Язык1.Text      = "Выберите язык изменяемого текста";
            Язык1.BackColor = SystemColors.ControlLightLight;
            Язык1.Location  = new Point(40, 25);
            Язык1.Size      = new Size(300, 15);

            ОписаниеЯзычков.Text      = "Энигма может работать только с 1 языком.\nПожалуйста убедитесь, что выбрали нужный язык и перейдите к следующему шагу нажав \"Далее\".";
            ОписаниеЯзычков.BackColor = SystemColors.Control;
            ОписаниеЯзычков.Location  = new Point(20, 85);
            ОписаниеЯзычков.Size      = new Size(380, 55);

            ОписаниеВыбора.Text      = "Язык для кодирования:";
            ОписаниеВыбора.Font      = new Font("Microsoft Sans Serif", 8.25f, System.Drawing.FontStyle.Regular);
            ОписаниеВыбора.BackColor = SystemColors.Control;
            ОписаниеВыбора.Location  = new Point(20, 150);
            ОписаниеВыбора.Size      = new Size(140, 15);
        }