예제 #1
0
        public void SetIconInfo(CustomMessageBoxKind kind)
        {
            CustomMessageBoxIconType iconInfo = CustomMessageBoxIconType.None;

            switch (kind)
            {
            case CustomMessageBoxKind.WarningOk:
            case CustomMessageBoxKind.WarningOkCancel:
                iconInfo = CustomMessageBoxIconType.WarningIcon;
                break;

            case CustomMessageBoxKind.QuestionYesNo:
            case CustomMessageBoxKind.QuestionYesNoCancel:
            case CustomMessageBoxKind.QuestionOkCancel:
                iconInfo = CustomMessageBoxIconType.QuestionIcon;
                break;

            case CustomMessageBoxKind.ErrorOk:
            case CustomMessageBoxKind.ErrorOkCancel:
            case CustomMessageBoxKind.ErrorYes:
            case CustomMessageBoxKind.ErrorYesNo:
            case CustomMessageBoxKind.ErrorYesNoCancel:
                iconInfo = CustomMessageBoxIconType.ErrorIcon;
                break;

            case CustomMessageBoxKind.InformationOk:
                iconInfo = CustomMessageBoxIconType.InformationIcon;
                break;
            }
            this.SetIconInfo(iconInfo);
        }
예제 #2
0
        public void SetIconInfo(CustomMessageBoxIconType iconType)
        {
            Image icon = null;

            switch (iconType)
            {
            case CustomMessageBoxIconType.ErrorIcon:
                //icon = MainInfo.GetIcon(ResourceNames.Error);
                icon = Resources.ResourceManager.GetImage(Resources.ResourceNames.MessageBoxError);
                break;

            case CustomMessageBoxIconType.InformationIcon:
                //icon = MainInfo.GetIcon(ResourceNames.Information);
                icon = Resources.ResourceManager.GetImage(Resources.ResourceNames.MessageBoxMessage);
                break;

            case CustomMessageBoxIconType.QuestionIcon:
                //icon = MainInfo.GetIcon(ResourceNames.Question);
                icon = Resources.ResourceManager.GetImage(Resources.ResourceNames.MessageBoxPrompt);
                break;

            case CustomMessageBoxIconType.WarningIcon:
                //icon = MainInfo.GetIcon(ResourceNames.Warning);
                icon = Resources.ResourceManager.GetImage(Resources.ResourceNames.MessageBoxWarning);
                break;

            default:
                break;
            }
            if (icon == null)
            {
                return;
            }
            Bitmap bmp = new Bitmap(icon);

            if (bmp != null)
            {
                bmp.MakeTransparent(Color.Magenta);
                //pictureBoxIcon.Image = bmp;
                pictureBoxIcon.BackgroundImage       = bmp;
                pictureBoxIcon.BackgroundImageLayout = ImageLayout.Stretch;
            }
            else
            {
                pictureBoxIcon.Image = icon;
            }
        }
예제 #3
0
        public void SetIconInfo(CustomMessageBoxIconType iconType)
        {
            Image image = null;

            switch (iconType)
            {
            case CustomMessageBoxIconType.WarningIcon:
                image = ResourceManager.GetImage("MessageBoxWarning.png");
                break;

            case CustomMessageBoxIconType.ErrorIcon:
                image = ResourceManager.GetImage("MessageBoxError.png");
                break;

            case CustomMessageBoxIconType.QuestionIcon:
                image = ResourceManager.GetImage("MessageBoxPrompt.png");
                break;

            case CustomMessageBoxIconType.InformationIcon:
                image = ResourceManager.GetImage("MessageBoxMessage.png");
                break;
            }
            if (image != null)
            {
                Bitmap bitmap = new Bitmap(image);
                if (bitmap != null)
                {
                    bitmap.MakeTransparent(Color.Magenta);
                    this.pictureBoxIcon.BackgroundImage       = bitmap;
                    this.pictureBoxIcon.BackgroundImageLayout = ImageLayout.Stretch;
                }
                else
                {
                    this.pictureBoxIcon.Image = image;
                }
            }
        }