當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。