public static NameColor PickColor()
        {
            NameColor   nameColor = new NameColor( );
            ColorDialog cd        = new ColorDialog( );

            cd.AnyColor       = true;
            cd.FullOpen       = true;
            cd.SolidColorOnly = false;
            if (cd.ShowDialog( ) == DialogResult.OK)
            {
                nameColor.color.A = cd.Color.A;
                nameColor.color.R = cd.Color.R;
                nameColor.color.G = cd.Color.G;
                nameColor.color.B = cd.Color.B;
                if (cd.Color.IsNamedColor == true)
                {
                    nameColor.Name = cd.Color.Name;
                }
                else
                {
                    nameColor.Name = cd.Color.ToString( );
                }
            }
            return(nameColor);
        }
Esempio n. 2
0
        /// <summary>
        /// In HTML konvertieren
        /// </summary>
        /// <param name="context">Der Kontext, indem das Steuerelement dargestellt wird</param>
        /// <returns>Das Control als HTML</returns>
        public override IHtmlNode Render(RenderContext context)
        {
            var icon = new HtmlElementTextSemanticsSpan()
            {
                Class = Icon?.ToClass()
            };

            var name = new HtmlElementTextSemanticsSpan(new HtmlText(Name))
            {
                ID    = string.IsNullOrWhiteSpace(ID) ? string.Empty : $"{ID}_name",
                Class = NameColor?.ToClass()
            };

            var value = new HtmlElementTextSemanticsSpan(new HtmlText(Value))
            {
                ID    = string.IsNullOrWhiteSpace(ID) ? string.Empty : $"{ID}_value",
                Class = NameColor?.ToClass()
            };

            var html = new HtmlElementTextContentDiv
                       (
                Icon != null && Icon.HasIcon ? icon : null,
                name,
                Uri != null ? new HtmlElementTextSemanticsA(value)
            {
                Href = Uri.ToString()
            } : value
                       )
            {
                ID    = ID,
                Class = GetClasses(),
                Style = string.Join("; ", Styles.Where(x => !string.IsNullOrWhiteSpace(x))),
                Role  = Role
            };

            return(html);
        }
Esempio n. 3
0
    public Options_Colors()
    {
        This = this;

        Text = " Colors ";

        String Name;
        Label  NameLabel;
        Color  NameColor;

        Name = "Tag";

        NameLabel = new Label();

        NameLabel.Parent   = this;
        NameLabel.Location = new Point(20, 10);
        NameLabel.AutoSize = true;
        NameLabel.Text     = Name;

        NameColor = ColorManager.Get(Name);

        ColorLabel1 = new Label();

        ColorLabel1.Parent    = this;
        ColorLabel1.Location  = new Point(85, 10);
        ColorLabel1.AutoSize  = true;
        ColorLabel1.Text      = NameColor.ToString();
        ColorLabel1.ForeColor = NameColor;
        ColorLabel1.Click    += new EventHandler(OnClick1);

        Name = "Content";

        NameLabel = new Label();

        NameLabel.Parent   = this;
        NameLabel.Location = new Point(20, 25);
        NameLabel.AutoSize = true;
        NameLabel.Text     = Name;

        NameColor = ColorManager.Get(Name);

        ColorLabel2 = new Label();

        ColorLabel2.Parent    = this;
        ColorLabel2.Location  = new Point(85, 25);
        ColorLabel2.AutoSize  = true;
        ColorLabel2.Text      = NameColor.ToString();
        ColorLabel2.ForeColor = NameColor;
        ColorLabel2.Click    += new EventHandler(OnClick2);

        Name = "Processing";

        NameLabel = new Label();

        NameLabel.Parent   = this;
        NameLabel.Location = new Point(20, 40);
        NameLabel.AutoSize = true;
        NameLabel.Text     = Name;

        NameColor = ColorManager.Get(Name);

        ColorLabel3 = new Label();

        ColorLabel3.Parent    = this;
        ColorLabel3.Location  = new Point(85, 40);
        ColorLabel3.AutoSize  = true;
        ColorLabel3.Text      = NameColor.ToString();
        ColorLabel3.ForeColor = NameColor;
        ColorLabel3.Click    += new EventHandler(OnClick3);

        Name = "Comment";

        NameLabel = new Label();

        NameLabel.Parent   = this;
        NameLabel.Location = new Point(20, 55);
        NameLabel.AutoSize = true;
        NameLabel.Text     = Name;

        NameColor = ColorManager.Get(Name);

        ColorLabel4 = new Label();

        ColorLabel4.Parent    = this;
        ColorLabel4.Location  = new Point(85, 55);
        ColorLabel4.AutoSize  = true;
        ColorLabel4.Text      = NameColor.ToString();
        ColorLabel4.ForeColor = NameColor;
        ColorLabel4.Click    += new EventHandler(OnClick4);

        Name = "Incidental";

        NameLabel = new Label();

        NameLabel.Parent   = this;
        NameLabel.Location = new Point(20, 70);
        NameLabel.AutoSize = true;
        NameLabel.Text     = Name;

        NameColor = ColorManager.Get(Name);

        ColorLabel5 = new Label();

        ColorLabel5.Parent    = this;
        ColorLabel5.Location  = new Point(85, 70);
        ColorLabel5.AutoSize  = true;
        ColorLabel5.Text      = NameColor.ToString();
        ColorLabel5.ForeColor = NameColor;
        ColorLabel5.Click    += new EventHandler(OnClick5);


        new Note(this, 20, 90, "Click on color to edit.");
    }