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


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

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


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

示例1: AddIcon

        /// <summary>
        /// Adds the icon.
        /// </summary>
        /// <param name="height">The height.</param>
        private void AddIcon(int height)
        {
            PictureBox tempPicture = null;
            try
            {
                tempPicture = new PictureBox();
                tempPicture.Location = new Point(DeletePictureBox.Location.X,
                                                 height + (RowHeight - DeletePictureBox.Size.Height) / 2);
                tempPicture.Image = DeletePictureBox.Image;
                tempPicture.Size = DeletePictureBox.Size;
                tempPicture.Click += DeletePictureBox_Click;

                PictureBox picture = tempPicture;
                tempPicture = null;

                Controls.Add(picture);
            }
            finally
            {
                tempPicture?.Dispose();
            }
        }
开发者ID:RapidFiring,项目名称:evemon,代码行数:26,代码来源:PortableEveClientsControl.cs

示例2: AddIcon

        /// <summary>
        /// Adds the icon.
        /// </summary>
        /// <param name="method">The method.</param>
        /// <param name="height">The height.</param>
        private void AddIcon(Enum method, int height)
        {
            Bitmap icon = Resources.KeyGrey16;
            string iconToolTip = "This is a basic feature query.";
            if (method is CCPAPICharacterMethods)
            {
                CCPAPICharacterMethods apiMethod = (CCPAPICharacterMethods)method;
                if ((long)apiMethod == ((long)apiMethod & (long)CCPAPIMethodsEnum.AdvancedCharacterFeatures))
                {
                    icon = Resources.KeyGold16;
                    iconToolTip = "This is an advanced feature query.";
                }
            }

            if (method is CCPAPIGenericMethods)
            {
                CCPAPIGenericMethods apiGenericMethod = (CCPAPIGenericMethods)method;
                if (CCPAPIGenericMethods.PlanetaryColonies.Equals(apiGenericMethod))
                {
                    icon = Resources.KeyGold16;
                    iconToolTip = "This is an advanced feature query.";
                }
            }

            // Uncomment upon implementing an exclicit corporation monitor feature
            //if (method is APICorporationMethods)
            //{
            //    APICorporationMethods apiMethod = (APICorporationMethods)method;
            //    if ((int)apiMethod == ((int)apiMethod & (int)APIMethodsEnum.AdvancedCorporationFeatures))
            //    {
            //        icon = CommonProperties.Resources.KeyGold16;
            //        iconToolTip = "This is an advanced feature query.";
            //    }
            //}

            PictureBox tempPicture = null;
            try
            {
                tempPicture = new PictureBox();
                toolTip.SetToolTip(tempPicture, iconToolTip);
                tempPicture.Location = new Point(0, height + (RowHeight - icon.Size.Height) / 2);
                tempPicture.Image = icon;
                tempPicture.Size = icon.Size;

                PictureBox picture = tempPicture;
                tempPicture = null;

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

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

示例4: ShowImage

 private static void ShowImage(byte[] data, string title = "Graph Output")
 {
     using (Form form = new Form {
         TopMost = true,
         Text = title
     }) {
         MemoryStream ms = null;
         Image image = null;
         PictureBox pictureBox = null;
         try {
             ms = new MemoryStream(data, false);
             image = Image.FromStream(ms);
             form.Size = (image.Size.Width > Screen.PrimaryScreen.WorkingArea.Size.Width ||
                          image.Size.Height > Screen.PrimaryScreen.WorkingArea.Size.Height)
                 ? Screen.PrimaryScreen.WorkingArea.Size
                 : image.Size;
             pictureBox = new PictureBox {
                 Image = image,
                 SizeMode = PictureBoxSizeMode.StretchImage,
                 Dock = DockStyle.Fill
             };
             form.Controls.Add(pictureBox);
             AutoResetEvent closed = new AutoResetEvent(false);
             form.FormClosed += (_, __) => closed.Set();
             Application.Run(form);
             closed.WaitOne();
         } finally {
             ms?.Dispose();
             image?.Dispose();
             pictureBox?.Dispose();
         }
     }
 }
开发者ID:maxwellb,项目名称:GraphEx,代码行数:33,代码来源:Program.cs


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