Ejemplo n.º 1
0
        public MyButton(int x, int y, int width, int height, ButtonStyles style)
        {
            // InitializeComponent();
            this.Size     = new Size(width, height);
            this.Location = new Point(x, y);

            check_contain  = false;
            focus          = false;
            pDragging      = false;
            pMousePosition = Point.Empty;
            _ButtonStyle   = style;

            //this.SetStyle(
            //ControlStyles.SupportsTransparentBackColor |
            //ControlStyles.OptimizedDoubleBuffer |
            //ControlStyles.AllPaintingInWmPaint |
            //ControlStyles.ResizeRedraw |
            //ControlStyles.UserPaint, true);
            //this.BackColor = Color.Transparent;
            //SetStyle(ControlStyles.UserPaint, true);
            //SetStyle(ControlStyles.SupportsTransparentBackColor, true);
            //SetStyle(ControlStyles.Opaque, true);
            //this.BackColor = Color.Transparent;
            //this.BackColor = Color.Transparent;
        }
Ejemplo n.º 2
0
        internal static MvcHtmlString ButtonInternal(this HtmlHelper helper, string tagName, string text,
                                                     IDictionary <string, object> htmlAttributes,
                                                     ButtonStyles style         = ButtonStyles.Default,
                                                     ButtonSize size            = ButtonSize.Default,
                                                     bool block                 = false,
                                                     bool disabled              = false,
                                                     Nullable <Glyphicons> icon = null,
                                                     bool inverted              = false)
        {
            string className = "btn button ";

            if (style != ButtonStyles.Default)
            {
                className += style.ToClassName("btn-");
            }

            if (size != ButtonSize.Default)
            {
                className += size.ToClassName("button-");
            }

            if (block)
            {
                className += " btn-block";
            }

            if (disabled)
            {
                htmlAttributes = htmlAttributes ?? new Dictionary <string, object>();
                var key = "disabled";
                className += " " + key;
                if (htmlAttributes.ContainsKey(key))
                {
                    htmlAttributes[key] = key;
                }
                else
                {
                    htmlAttributes.Add(key, key);
                }
            }
            var innerText = new StringBuilder();

            innerText.Append("<span>").Append(text);

            if (icon.HasValue)
            {
                innerText.Append(icon.Value.Render(null, inverted));
            }

            innerText.Append("</span>");

            var buttonBuilder = new TagBuilder(tagName)
            {
                InnerHtml = innerText.ToString()
            };

            buttonBuilder.MergeAttributes(htmlAttributes);
            buttonBuilder.AddCssClass(className);
            return(MvcHtmlString.Create(buttonBuilder.ToString(TagRenderMode.Normal)));
        }
Ejemplo n.º 3
0
        // --------------------------------------------------------------------------------------------------------------------

        /// <summary> Configures a button control for rendering on a web view page. </summary>
        /// <param name="content">    The button content. </param>
        /// <param name="buttonStyle"> (Optional) Style of the button. </param>
        /// <param name="buttonType"> (Optional) Type of the button. </param>
        /// <returns> The button instance. </returns>
        public Button Configure(RazorTemplateDelegate <object> content, ButtonStyles buttonStyle = ButtonStyles.Primary, ButtonTypes buttonType = ButtonTypes.Button)
        {
            ContentTemplate = content;
            ButtonStyle     = buttonStyle;
            ButtonType      = buttonType;
            return(this);
        }
Ejemplo n.º 4
0
        public MenuButton(Vector2 location, string text, ButtonStyles style, MenuPageEventArgs args, ButtonType type)
        {
            _location = location;
            _text     = text;
            _style    = style;
            _args     = args;
            _type     = type;

            _state    = ButtonStates.Enabled;
            _animator = new Animator(ButtonAnimator.GetAnimationsFromStyle(_style), (int)ButtonStates.Enabled, ButtonAnimator.GetImageSizeFromStyle(_style));
        }
Ejemplo n.º 5
0
 public static MvcHtmlString Button(this HtmlHelper htmlHelper, string text,
                                    IDictionary <string, object> htmlAttributes,
                                    ButtonStyles style         = ButtonStyles.Default,
                                    ButtonSize size            = ButtonSize.Default,
                                    bool block                 = false,
                                    bool disabled              = false,
                                    Nullable <Glyphicons> icon = null,
                                    bool inverted              = false)
 {
     return(ButtonInternal(htmlHelper, "button", text, htmlAttributes, style, size, block, disabled, icon, inverted));
 }
Ejemplo n.º 6
0
 public static MvcHtmlString LinkButton(this HtmlHelper htmlHelper,
                                        string text,
                                        string action,
                                        ButtonStyles style         = ButtonStyles.Default,
                                        ButtonSize size            = ButtonSize.Default,
                                        bool block                 = false,
                                        bool disabled              = false,
                                        Nullable <Glyphicons> icon = null,
                                        bool inverted              = false)
 {
     return(LinkButton(htmlHelper, text, action, null, null, null, style, size, block, disabled, icon, inverted));
 }
Ejemplo n.º 7
0
        public MainWindow()
        {
            InitializeComponent();
            //DataContext = this;
            ButtonStyles.Add(this.FindResource("Color0") as Style);
            ButtonStyles.Add(this.FindResource("Color1") as Style);
            ButtonStyles.Add(this.FindResource("Color2") as Style);
            ButtonStyles.Add(this.FindResource("Color3") as Style);
            ButtonStyles.Add(this.FindResource("Color4") as Style);

            StringStyle = this.FindResource("ColorBlue") as Style;

            NumberOfQuestions = 25;
            DialogString      = "Обери складність і натисни «Старт»!";
            NewExercise();
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Send a interface user button, with selected parameters.
 /// </summary>
 /// <param name="Text">Text that will show on button.</param>
 /// <param name="Style">Button style.</param>
 /// <param name="Height">Height of button.</param>
 /// <param name="Width">Width of button.</param>
 /// <param name="Top">Top screen position of button.</param>
 /// <param name="Left">Left screen position of button.</param>
 /// <param name="Button">Button ID.</param>
 /// <param name="UCID">Unique ID of user to be sended.</param>
 public static void Send(string Text, ButtonStyles Style, byte Height, byte Width, byte Top, byte Left, byte Button, byte UCID)
 {
     try
     {
         Program.insim.Send(new IS_BTN
         {
             Text    = Text,
             BStyle  = Style,
             H       = Height,
             W       = Width,
             T       = Top,
             L       = Left,
             ClickID = Button,
             UCID    = UCID,
             ReqI    = 2
         });
     }
     catch (InSimException IEx) { Logger.Error(IEx.Message, Logger.Types.BTN); }
 }
Ejemplo n.º 9
0
        /// <summary>Initializes a new instance of the <see cref="VisualComboBox" /> class.</summary>
        public VisualComboBox()
        {
            SetStyle(
                ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw |
                ControlStyles.OptimizedDoubleBuffer | ControlStyles.SupportsTransparentBackColor,
                true);

            SetStyle((ControlStyles)139286, true);
            SetStyle(ControlStyles.Selectable, false);

            _styleManager      = new StyleManager(Settings.DefaultValue.DefaultStyle);
            _textImageRelation = TextImageRelation.ImageBeforeText;
            _textAlignment     = StringAlignment.Center;
            _textLineAlignment = StringAlignment.Center;
            _itemImageVisible  = true;
            _imageVisible      = false;
            _buttonWidth       = 30;
            _buttonStyle       = ButtonStyles.Arrow;
            _buttonVisible     = Settings.DefaultValue.TextVisible;
            _watermark         = new Watermark();
            _mouseState        = MouseStates.Normal;
            _textStyle         = new TextStyle();
            DrawMode           = DrawMode.OwnerDrawVariable;
            DropDownStyle      = ComboBoxStyle.DropDownList;

            _borderEdge = new BorderEdge();

            Size       = new Size(135, 26);
            ItemHeight = 24;
            UpdateStyles();
            DropDownHeight = 100;

            // BackColor = SystemColors.Control;
            _border = new Border();

            _textRendererHint = Settings.DefaultValue.TextRenderingHint;

            Controls.Add(_borderEdge);
            UpdateTheme(_styleManager.Theme);
        }
Ejemplo n.º 10
0
        //public int Width
        //{
        //    get
        //    {
        //        return _width;
        //    }
        //    set
        //    {
        //        _width = value;
        //    }
        //}

        //private int Height
        //{
        //    get
        //    {
        //        return _height;
        //    }
        //    set
        //    {
        //        _height = value;
        //    }
        //}

        //private int Xpos
        //{
        //    get
        //    {
        //        return _Xpos;
        //    }
        //    set
        //    {
        //        _Xpos = value;
        //    }
        //}
        //private int Ypos
        //{
        //    get
        //    {
        //        return _Ypos;
        //    }
        //    set
        //    {
        //        _Ypos = value;
        //    }
        //}
        public MyButton()
        {
            // InitializeComponent();
            check_contain  = false;
            focus          = false;
            pDragging      = false;
            pMousePosition = Point.Empty;
            _ButtonStyle   = ButtonStyles.Rectangle;

            //this.SetStyle(
            //ControlStyles.SupportsTransparentBackColor |
            //ControlStyles.OptimizedDoubleBuffer |
            //ControlStyles.AllPaintingInWmPaint |
            //ControlStyles.ResizeRedraw |
            //ControlStyles.UserPaint, true);
            //this.BackColor = Color.Transparent;
            //SetStyle(ControlStyles.UserPaint, true);
            //SetStyle(ControlStyles.SupportsTransparentBackColor, true);
            //SetStyle(ControlStyles.Opaque, true);
            //this.BackColor = Color.Transparent;
            //this.BackColor = Color.Transparent;
        }
Ejemplo n.º 11
0
        public static MvcHtmlString LinkButton(this HtmlHelper htmlHelper,
                                               string text,
                                               string action,
                                               string controller,
                                               object routeValues,
                                               object htmlAttributes,
                                               ButtonStyles style         = ButtonStyles.Default,
                                               ButtonSize size            = ButtonSize.Default,
                                               bool block                 = false,
                                               bool disabled              = false,
                                               Nullable <Glyphicons> icon = null,
                                               bool inverted              = false)
        {
            var values     = HtmlHelper.AnonymousObjectToHtmlAttributes(routeValues);
            var attributes = HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes);

            attributes = attributes ?? new RouteValueDictionary();
            string actionUrl = htmlHelper.GenerateUrl(action, controller, values);

            attributes.Add("href", actionUrl);
            return(ButtonInternal(htmlHelper, "a", text, attributes, style, size, block, disabled, icon, inverted));
        }
Ejemplo n.º 12
0
        public MyButton(int x, int y, int width, int height,ButtonStyles style)
        {
            // InitializeComponent();
            this.Size = new Size(width, height);
            this.Location = new Point(x, y);

            check_contain = false;
            focus = false;
            pDragging = false;
            pMousePosition = Point.Empty;
            _ButtonStyle = style;

            //this.SetStyle(
            //ControlStyles.SupportsTransparentBackColor |
            //ControlStyles.OptimizedDoubleBuffer |
            //ControlStyles.AllPaintingInWmPaint |
            //ControlStyles.ResizeRedraw |
            //ControlStyles.UserPaint, true);
            //this.BackColor = Color.Transparent;
            //SetStyle(ControlStyles.UserPaint, true);
            //SetStyle(ControlStyles.SupportsTransparentBackColor, true);
            //SetStyle(ControlStyles.Opaque, true);
            //this.BackColor = Color.Transparent;
            //this.BackColor = Color.Transparent;
        }
Ejemplo n.º 13
0
        // --------------------------------------------------------------------------------------------------------------------

        /// <summary> Configures a button control for rendering on a web view page. </summary>
        /// <param name="content">    The button content. </param>
        /// <param name="buttonStyle"> (Optional) Style of the button. </param>
        /// <param name="buttonType"> (Optional) Type of the button. </param>
        /// <returns> The button instance. </returns>
        public Button Configure(string content, ButtonStyles buttonStyle = ButtonStyles.Primary, ButtonTypes buttonType = ButtonTypes.Button)
        {
            return(Configure(item => content, buttonStyle, buttonType)); // (NOTICE: This is a RAZOR template delegate pattern to return content, which is a string in this case)
        }
Ejemplo n.º 14
0
 public static void Init()
 {
     ButtonStyles.Init();
     FormStyles.Init();
 }
Ejemplo n.º 15
0
 /// <summary>
 /// Creates an instance of button class
 /// </summary>
 /// <param name="id">Unique id for the button</param>
 /// <param name="label">Label to display on the button</param>
 /// <param name="buttonStyle">Bootstrap button style for the button</param>
 public Button(int id, string label, ButtonStyles buttonStyle = ButtonStyles.Primary) : base(id, FormInputTypes.Button, label, false)
 {
     this.ButtonStyle = buttonStyle;
 }
Ejemplo n.º 16
0
 public ButtonClass(ButtonStyles buttonStyle)
     : base("Button")
 {
     ButtonStyle = buttonStyle;
 }
Ejemplo n.º 17
0
 public static Dictionary <int, Animation> GetAnimationsFromStyle(ButtonStyles style)
 {
     return(_animations[style]);
 }
Ejemplo n.º 18
0
 public MenuButton(Vector2 location, string text, ButtonStyles style, MenuPageEventArgs args) : this(location, text, style, args, ButtonType.Standard)
 {
 }
Ejemplo n.º 19
0
 private void btn(string text, byte height, byte width, byte top, byte length, ButtonStyles bstyle, byte clickid, byte ucid)
 {
     try
     {
         {
             insim.Send(new IS_BTN
             {
                 Text    = text,
                 UCID    = ucid,
                 ReqI    = clickid,
                 ClickID = clickid,
                 BStyle  = bstyle,
                 H       = height,
                 W       = width,
                 T       = top,
                 L       = length
             });
         }
     }
     catch
     {
     }
 }
Ejemplo n.º 20
0
 public static Vector2 GetImageSizeFromStyle(ButtonStyles style)
 {
     return(_buttonSizes[style]);
 }
Ejemplo n.º 21
0
 public static T StyleEx <T>(this T btn, ButtonStyles style) where T : class, IBootstrapButon
 {
     btn.SetAttiValue("class", "ButtonStyles", style);
     return(btn);
 }
Ejemplo n.º 22
0
 public BootStrapButton Style(ButtonStyles style)
 {
     base.SetAttiValue("class", "ButtonStyles", style);
     return(this);
 }
Ejemplo n.º 23
0
        //public int Width
        //{
        //    get
        //    {
        //        return _width;
        //    }
        //    set
        //    {
        //        _width = value;
        //    }
        //}
        //private int Height
        //{
        //    get
        //    {
        //        return _height;
        //    }
        //    set
        //    {
        //        _height = value;
        //    }
        //}
        //private int Xpos
        //{
        //    get
        //    {
        //        return _Xpos;
        //    }
        //    set
        //    {
        //        _Xpos = value;
        //    }
        //}
        //private int Ypos
        //{
        //    get
        //    {
        //        return _Ypos;
        //    }
        //    set
        //    {
        //        _Ypos = value;
        //    }
        //}
        public MyButton()
        {
            // InitializeComponent();
            check_contain = false;
            focus = false;
            pDragging = false;
            pMousePosition = Point.Empty;
            _ButtonStyle = ButtonStyles.Rectangle;

            //this.SetStyle(
            //ControlStyles.SupportsTransparentBackColor |
            //ControlStyles.OptimizedDoubleBuffer |
            //ControlStyles.AllPaintingInWmPaint |
            //ControlStyles.ResizeRedraw |
            //ControlStyles.UserPaint, true);
            //this.BackColor = Color.Transparent;
            //SetStyle(ControlStyles.UserPaint, true);
            //SetStyle(ControlStyles.SupportsTransparentBackColor, true);
            //SetStyle(ControlStyles.Opaque, true);
            //this.BackColor = Color.Transparent;
            //this.BackColor = Color.Transparent;
        }
Ejemplo n.º 24
0
 /// <summary>
 /// Gets the <see cref="ButtonStyle"/> with the specified <paramref name="name"/>
 /// </summary>
 /// <returns>The requested <see cref="ButtonStyle"/> or <c>null</c> if it couldn't be found</returns>
 internal ButtonStyle GetButtonStyle(string name)
 {
     return(ButtonStyles.FirstOrDefault(style => style.Name == name));
 }