Пример #1
0
        private void LoadWarningBitmap(TrustManagerWarningLevel warningLevel)
        {
            Bitmap bitmap;

            switch (warningLevel)
            {
            case TrustManagerWarningLevel.Green:
                bitmap = new Bitmap(typeof(System.Windows.Forms.Form), "TrustManagerOK.bmp");
                this.pictureBoxWarning.AccessibleDescription = string.Format(CultureInfo.CurrentCulture, SR.GetString(SR.TrustManager_WarningIconAccessibleDescription_LowRisk), this.pictureBoxWarning.AccessibleDescription);
                break;

            case TrustManagerWarningLevel.Yellow:
                bitmap = new Bitmap(typeof(System.Windows.Forms.Form), "TrustManagerWarning.bmp");
                this.pictureBoxWarning.AccessibleDescription = string.Format(CultureInfo.CurrentCulture, SR.GetString(SR.TrustManager_WarningIconAccessibleDescription_MediumRisk), this.pictureBoxWarning.AccessibleDescription);
                break;

            default:
                Debug.Assert(warningLevel == TrustManagerWarningLevel.Red);
                bitmap = new Bitmap(typeof(System.Windows.Forms.Form), "TrustManagerHighRisk.bmp");
                this.pictureBoxWarning.AccessibleDescription = string.Format(CultureInfo.CurrentCulture, SR.GetString(SR.TrustManager_WarningIconAccessibleDescription_HighRisk), this.pictureBoxWarning.AccessibleDescription);
                break;
            }
            if (bitmap != null)
            {
                bitmap.MakeTransparent();
                this.pictureBoxWarning.Image = bitmap;
            }
        }
Пример #2
0
        private static void LoadWarningBitmap(TrustManagerWarningLevel warningLevel, PictureBox pictureBox)
        {
            Bitmap bitmap;

            switch (warningLevel)
            {
            case TrustManagerWarningLevel.Green:
                bitmap = new Bitmap(typeof(Form), "TrustManagerOKSm.bmp");
                pictureBox.AccessibleDescription = string.Format(CultureInfo.CurrentCulture, System.Windows.Forms.SR.GetString("TrustManager_WarningIconAccessibleDescription_LowRisk"), new object[] { pictureBox.AccessibleDescription });
                break;

            case TrustManagerWarningLevel.Yellow:
                bitmap = new Bitmap(typeof(Form), "TrustManagerWarningSm.bmp");
                pictureBox.AccessibleDescription = string.Format(CultureInfo.CurrentCulture, System.Windows.Forms.SR.GetString("TrustManager_WarningIconAccessibleDescription_MediumRisk"), new object[] { pictureBox.AccessibleDescription });
                break;

            default:
                bitmap = new Bitmap(typeof(Form), "TrustManagerHighRiskSm.bmp");
                pictureBox.AccessibleDescription = string.Format(CultureInfo.CurrentCulture, System.Windows.Forms.SR.GetString("TrustManager_WarningIconAccessibleDescription_HighRisk"), new object[] { pictureBox.AccessibleDescription });
                break;
            }
            if (bitmap != null)
            {
                bitmap.MakeTransparent();
                pictureBox.Image = bitmap;
            }
        }
        private static void LoadWarningBitmap(TrustManagerWarningLevel warningLevel, System.Windows.Forms.PictureBox pictureBox)
        {
            Bitmap bitmap;

            switch (warningLevel)
            {
            case TrustManagerWarningLevel.Green:
                if (!LocalAppContextSwitches.UseLegacyImages)
                {
                    bitmap = QueryDPiMatchedSmallBitmap("TrustManagerOK.ico");
                }
                else
                {
                    bitmap = new Bitmap(typeof(System.Windows.Forms.Form), "TrustManagerOKSm.bmp");
                }
                pictureBox.AccessibleDescription = string.Format(CultureInfo.CurrentCulture, SR.GetString(SR.TrustManager_WarningIconAccessibleDescription_LowRisk), pictureBox.AccessibleDescription);
                break;

            case TrustManagerWarningLevel.Yellow:
                if (!LocalAppContextSwitches.UseLegacyImages)
                {
                    bitmap = QueryDPiMatchedSmallBitmap("TrustManagerWarning.ico");
                }
                else
                {
                    bitmap = new Bitmap(typeof(System.Windows.Forms.Form), "TrustManagerWarningSm.bmp");
                }
                pictureBox.AccessibleDescription = string.Format(CultureInfo.CurrentCulture, SR.GetString(SR.TrustManager_WarningIconAccessibleDescription_MediumRisk), pictureBox.AccessibleDescription);
                break;

            default:
                Debug.Assert(warningLevel == TrustManagerWarningLevel.Red);
                if (!LocalAppContextSwitches.UseLegacyImages)
                {
                    bitmap = QueryDPiMatchedSmallBitmap("TrustManagerHighRisk.ico");
                }
                else
                {
                    bitmap = new Bitmap(typeof(System.Windows.Forms.Form), "TrustManagerHighRiskSm.bmp");
                }
                pictureBox.AccessibleDescription = string.Format(CultureInfo.CurrentCulture, SR.GetString(SR.TrustManager_WarningIconAccessibleDescription_HighRisk), pictureBox.AccessibleDescription);
                break;
            }
            if (bitmap != null)
            {
                bitmap.MakeTransparent();
                pictureBox.Image = bitmap;
            }
        }
        private void LoadWarningBitmap(TrustManagerWarningLevel warningLevel)
        {
            Bitmap bitmap;
            switch (warningLevel)
            {
                case TrustManagerWarningLevel.Green:
                    bitmap = new Bitmap(typeof(Form), "TrustManagerOK.bmp");
                    this.pictureBoxWarning.AccessibleDescription = string.Format(CultureInfo.CurrentCulture, System.Windows.Forms.SR.GetString("TrustManager_WarningIconAccessibleDescription_LowRisk"), new object[] { this.pictureBoxWarning.AccessibleDescription });
                    break;

                case TrustManagerWarningLevel.Yellow:
                    bitmap = new Bitmap(typeof(Form), "TrustManagerWarning.bmp");
                    this.pictureBoxWarning.AccessibleDescription = string.Format(CultureInfo.CurrentCulture, System.Windows.Forms.SR.GetString("TrustManager_WarningIconAccessibleDescription_MediumRisk"), new object[] { this.pictureBoxWarning.AccessibleDescription });
                    break;

                default:
                    bitmap = new Bitmap(typeof(Form), "TrustManagerHighRisk.bmp");
                    this.pictureBoxWarning.AccessibleDescription = string.Format(CultureInfo.CurrentCulture, System.Windows.Forms.SR.GetString("TrustManager_WarningIconAccessibleDescription_HighRisk"), new object[] { this.pictureBoxWarning.AccessibleDescription });
                    break;
            }
            if (bitmap != null)
            {
                bitmap.MakeTransparent();
                this.pictureBoxWarning.Image = bitmap;
            }
        }
Пример #5
0
 private static void LoadWarningBitmap(TrustManagerWarningLevel warningLevel, System.Windows.Forms.PictureBox pictureBox)
 {
     Bitmap bitmap;
     switch (warningLevel)
     {
         case TrustManagerWarningLevel.Green:
             bitmap = new Bitmap(typeof(System.Windows.Forms.Form), "TrustManagerOKSm.bmp");
             pictureBox.AccessibleDescription = string.Format(CultureInfo.CurrentCulture, SR.GetString(SR.TrustManager_WarningIconAccessibleDescription_LowRisk), pictureBox.AccessibleDescription);
             break;
         case TrustManagerWarningLevel.Yellow:
             bitmap = new Bitmap(typeof(System.Windows.Forms.Form), "TrustManagerWarningSm.bmp");
             pictureBox.AccessibleDescription = string.Format(CultureInfo.CurrentCulture, SR.GetString(SR.TrustManager_WarningIconAccessibleDescription_MediumRisk), pictureBox.AccessibleDescription);
             break;
         default:
             Debug.Assert(warningLevel == TrustManagerWarningLevel.Red);
             bitmap = new Bitmap(typeof(System.Windows.Forms.Form), "TrustManagerHighRiskSm.bmp");
             pictureBox.AccessibleDescription = string.Format(CultureInfo.CurrentCulture, SR.GetString(SR.TrustManager_WarningIconAccessibleDescription_HighRisk), pictureBox.AccessibleDescription);
             break;
     }
     if (bitmap != null)
     {
         bitmap.MakeTransparent();
         pictureBox.Image = bitmap;
     }
 }