当前位置: 首页>>代码示例>>C#>>正文


C# Label.?.Dispose方法代码示例

本文整理汇总了C#中System.Windows.Forms.Label.?.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# Label.?.Dispose方法的具体用法?C# Label.?.Dispose怎么用?C# Label.?.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.Label的用法示例。


在下文中一共展示了Label.?.Dispose方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddLabel

        /// <summary>
        /// Adds the label.
        /// </summary>
        /// <param name="method">The method.</param>
        /// <param name="height">The height.</param>
        private void AddLabel(Enum method, int height)
        {
            Label tempLabel = null;
            try
            {
                tempLabel = new Label();
                toolTip.SetToolTip(tempLabel, method.GetDescription());
                tempLabel.AutoSize = false;
                tempLabel.Text = method.GetHeader();
                tempLabel.TextAlign = ContentAlignment.MiddleLeft;
                tempLabel.Location = new Point(labelMethod.Location.X, height);
                tempLabel.Width = labelMethod.Width;
                tempLabel.Height = RowHeight;

                Label label = tempLabel;
                tempLabel = null;

                Controls.Add(label);
            }
            finally
            {
                tempLabel?.Dispose();
            }
        }
开发者ID:RapidFiring,项目名称:evemon,代码行数:29,代码来源:UpdateSettingsControl.cs

示例2: CreateAccountsNotTrainingPanel

        /// <summary>
        /// Creates a panel contains the warning message for accounts not in training.
        /// </summary>
        /// <param name="warningMessage"></param>
        /// <returns></returns>
        private static FlowLayoutPanel CreateAccountsNotTrainingPanel(string warningMessage)
        {
            // Create a flowlayout to hold the content
            FlowLayoutPanel warningPanel;
            FlowLayoutPanel tempWarningPanel = null;
            try
            {
                tempWarningPanel = new FlowLayoutPanel
                {
                    AutoSize = true,
                    AutoSizeMode = AutoSizeMode.GrowAndShrink,
                    Margin = new Padding(0, 0, 0, 2)
                };

                // Add a picture on the left with a warning icon
                if (!Settings.UI.SafeForWork)
                {
                    int portraitSize = Int32.Parse(Settings.UI.SystemTrayPopup.PortraitSize.ToString().Substring(1),
                                                   CultureConstants.InvariantCulture);

                    PictureBox tempPictureBoxWarning = null;
                    try
                    {
                        tempPictureBoxWarning = new PictureBox();
                        tempPictureBoxWarning.Image = SystemIcons.Warning.ToBitmap();
                        tempPictureBoxWarning.SizeMode = PictureBoxSizeMode.StretchImage;
                        tempPictureBoxWarning.Size = new Size(portraitSize, portraitSize);
                        tempPictureBoxWarning.Margin = new Padding(2);

                        PictureBox pbWarning = tempPictureBoxWarning;
                        tempPictureBoxWarning = null;

                        tempWarningPanel.Controls.Add(pbWarning);
                    }
                    finally
                    {
                        tempPictureBoxWarning?.Dispose();
                    }
                }

                // Adds a label to hold the message
                Label tempLabelMessage = null;
                try
                {
                    tempLabelMessage = new Label
                    {
                        AutoSize = true,
                        Text = warningMessage
                    };

                    Label lblMessage = tempLabelMessage;
                    tempLabelMessage = null;

                    tempWarningPanel.Controls.Add(lblMessage);
                }
                finally
                {
                    tempLabelMessage?.Dispose();
                }

                tempWarningPanel.CreateControl();

                warningPanel = tempWarningPanel;
                tempWarningPanel = null;
            }
            finally
            {
                tempWarningPanel?.Dispose();
            }

            return warningPanel;
        }
开发者ID:RapidFiring,项目名称:evemon,代码行数:77,代码来源:TrayPopUpWindow.cs

示例3: AddLabel

        /// <summary>
        /// Adds the label.
        /// </summary>
        /// <param name="height">The height.</param>
        /// <param name="cat">The cat.</param>
        private void AddLabel(int height, NotificationCategory cat)
        {
            Label tempLabel = null;
            try
            {
                tempLabel = new Label();
                tempLabel.AutoSize = false;
                tempLabel.Text = cat.GetHeader();
                tempLabel.TextAlign = ContentAlignment.MiddleLeft;
                tempLabel.Location = new Point(labelNotification.Location.X, height);
                tempLabel.Width = labelBehaviour.Location.X - 3;
                tempLabel.Height = RowHeight;

                Label label = tempLabel;
                tempLabel = null;

                Controls.Add(label);
            }
            finally
            {
                tempLabel?.Dispose();
            }
        }
开发者ID:RapidFiring,项目名称:evemon,代码行数:28,代码来源:NotificationsControl.cs

示例4: AddComboBoxAndLabel

        /// <summary>
        /// Adds the combo box and label.
        /// </summary>
        /// <param name="control">The control.</param>
        private void AddComboBoxAndLabel(IDisposable control)
        {
            DropDownMouseMoveComboBox combo = control as DropDownMouseMoveComboBox;
            if (combo == null)
                return;

            int slotIndex = Int32.Parse(combo.Name.Replace("cbSlot", String.Empty), CultureConstants.InvariantCulture) - 1;
            ImplantSlots slot = (ImplantSlots)slotIndex;

            combo.Tag = slot;
            combo.MouseMove += combo_MouseMove;
            combo.DropDownClosed += combo_DropDownClosed;
            combo.DropDownMouseMove += combo_DropDownMouseMove;
            foreach (Implant implant in StaticItems.GetImplants(slot))
            {
                combo.Items.Add(implant);
            }

            Label tempLabel = null;
            try
            {
                tempLabel = new Label();
                tempLabel.MouseMove += label_MouseMove;
                tempLabel.AutoSize = false;
                tempLabel.Anchor = combo.Anchor;
                tempLabel.Bounds = combo.Bounds;
                tempLabel.TextAlign = ContentAlignment.MiddleLeft;

                Label label = tempLabel;
                tempLabel = null;

                m_labels[(int)slot] = label;
            }
            finally
            {
                tempLabel?.Dispose();
            }
        }
开发者ID:RapidFiring,项目名称:evemon,代码行数:42,代码来源:ImplantSetsWindow.cs

示例5: UpdateRecommendations

        /// <summary>
        /// Updates the recommendations.
        /// </summary>
        /// <param name="newItems">The new items list.</param>
        /// <param name="rSplCont">The right splitter container.</param>
        private void UpdateRecommendations(List<Control> newItems, SplitContainer rSplCont)
        {
            rightSplitContainer.Panel2.Controls.Clear();

            if (newItems.Count != 0)
            {
                newItems.Reverse();
                rSplCont.Panel2.Controls.AddRange(newItems.ToArray());
            }
            else
            {
                Label tempLabel = null;
                try
                {
                    tempLabel = new Label();
                    tempLabel.Text = @"No Recommendations";
                    tempLabel.Enabled = false;
                    tempLabel.Dock = DockStyle.Fill;
                    tempLabel.TextAlign = ContentAlignment.MiddleCenter;

                    Label tsl = tempLabel;
                    tempLabel = null;

                    rSplCont.Panel2.Controls.Add(tsl);

                    Size tslTextSize = TextRenderer.MeasureText(tsl.Text, Font);
                    rSplCont.Panel2MinSize = tslTextSize.Width + HPad;
                    rSplCont.SplitterDistance = rSplCont.Width - rSplCont.Panel2MinSize;
                }
                finally
                {
                    tempLabel?.Dispose();
                }
            }
        }
开发者ID:RapidFiring,项目名称:evemon,代码行数:40,代码来源:CertificateBrowserControl.cs

示例6: UpdateContent

        /// <summary>
        /// Updates the content.
        /// </summary>
        private void UpdateContent()
        {
            // When no certificate class is selected, we just hide the right panel.
            if (m_selectedCertificate == null)
            {
                // View help message
                lblHelp.Visible = true;

                panelRight.Visible = false;
                return;
            }

            // Hide help message
            lblHelp.Visible = false;

            // Updates controls visibility
            panelRight.Visible = true;

            lblName.Text = m_selectedCertificate.Name;
            lblCategory.Text = m_selectedCertificate.Category.Name;
            textboxDescription.Text = m_selectedCertificate.Certificate.Description;

            // Training time per certificate level
            for (int i = 1; i <= 5; i++)
            {
                UpdateLevelLabel(panelHeader.Controls.OfType<Label>()
                    .First(label => label.Name == $"lblLevel{i}Time"), i);
            }

            // Only read the recommendations from one level, because they are all the same
            PersistentSplitContainer rSplCont = rightSplitContainer;
            List<Control> newItems = new List<Control>();
            SortedList<string, Item> ships = new SortedList<string, Item>();
            foreach (Item ship in m_selectedCertificate.Certificate.Recommendations)
            {
                ships.Add(ship.Name, ship);
            }

            Label tempLabel = null;
            try
            {
                tempLabel = new Label();
                tempLabel.Font = new Font(tempLabel.Font, FontStyle.Bold);
                tempLabel.AutoSize = true;
                tempLabel.Dock = DockStyle.Top;
                tempLabel.Text = @"Recommended For";
                tempLabel.Padding = new Padding(5);

                Label tsl = tempLabel;
                tempLabel = null;

                newItems.Add(tsl);

                Size tslTextSize = TextRenderer.MeasureText(tsl.Text, Font);
                int panelMinSize = rSplCont.Panel2MinSize;
                rSplCont.Panel2MinSize = panelMinSize > tslTextSize.Width + HPad
                    ? panelMinSize
                    : tslTextSize.Width + HPad;
                rSplCont.SplitterDistance = rSplCont.Width - rSplCont.Panel2MinSize;
            }
            finally
            {
                tempLabel?.Dispose();
            }

            foreach (LinkLabel linkLabel in ships.Values
                .Select(ship =>
                {
                    LinkLabel linkLabel;
                    LinkLabel tempLinkLabel = null;
                    try
                    {
                        tempLinkLabel = new LinkLabel();
                        tempLinkLabel.LinkBehavior = LinkBehavior.HoverUnderline;
                        tempLinkLabel.Padding = new Padding(16, 0, 0, 0);
                        tempLinkLabel.Dock = DockStyle.Top;
                        tempLinkLabel.Text = ship.Name;
                        tempLinkLabel.Tag = ship;

                        linkLabel = tempLinkLabel;
                        tempLinkLabel = null;
                    }
                    finally
                    {
                        tempLinkLabel?.Dispose();
                    }

                    return linkLabel;
                }))
            {
                linkLabel.MouseClick += recommendations_MenuItem;
                newItems.Add(linkLabel);
            }

            // Updates the recommendations for this certificate
            UpdateRecommendations(newItems, rSplCont);

//.........这里部分代码省略.........
开发者ID:RapidFiring,项目名称:evemon,代码行数:101,代码来源:CertificateBrowserControl.cs


注:本文中的System.Windows.Forms.Label.?.Dispose方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。