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


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

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


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

示例1: 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

示例2: PerformCustomLayout

        /// <summary>
        /// Performs the custom layout.
        /// </summary>
        private void PerformCustomLayout()
        {
            // Remove controls and dispose them
            IEnumerable<Control> oldControls = MainFlowLayoutPanel.Controls.Cast<Control>().ToList();
            MainFlowLayoutPanel.Controls.Clear();
            foreach (Control ctl in oldControls)
            {
                ctl.Dispose();
            }

            IEnumerable<Character> characters = GetCharacters;

            // Add controls for characters
            if (Settings.UI.SystemTrayPopup.GroupBy == TrayPopupGrouping.Account &&
                Settings.UI.SystemTrayPopup.IndentGroupedAccounts)
            {
                List<APIKey> prevAPIKeys = new List<APIKey>();
                foreach (Character character in characters)
                {
                    OverviewItem charPanel = GetOverviewItem(character);
                    List<APIKey> apiKeys = character.Identity.APIKeys.ToList();

                    if (!apiKeys.Exists(apiKey => prevAPIKeys.Contains(apiKey)))
                    {
                        MainFlowLayoutPanel.Controls.Add(charPanel);
                        prevAPIKeys = apiKeys;
                    }
                    else
                    {
                        FlowLayoutPanel tempAccountGroupPanel = null;
                        try
                        {
                            tempAccountGroupPanel = new FlowLayoutPanel();
                            tempAccountGroupPanel.Controls.Add(charPanel);
                            tempAccountGroupPanel.AutoSize = true;
                            tempAccountGroupPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink;
                            tempAccountGroupPanel.FlowDirection = FlowDirection.TopDown;
                            tempAccountGroupPanel.Padding = new Padding(10, 0, 0, 0);

                            tempAccountGroupPanel.CreateControl();

                            FlowLayoutPanel accountGroupPanel = tempAccountGroupPanel;
                            tempAccountGroupPanel = null;

                            MainFlowLayoutPanel.Controls.Add(accountGroupPanel);
                        }
                        finally
                        {
                            tempAccountGroupPanel?.Dispose();
                        }

                        prevAPIKeys = apiKeys;
                    }
                }
            }
            else
                MainFlowLayoutPanel.Controls.AddRange(characters.Select(GetOverviewItem).ToArray<Control>());
        }
开发者ID:RapidFiring,项目名称:evemon,代码行数:61,代码来源:TrayPopUpWindow.cs


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