public static void setButtonStyle(System.Windows.Forms.Button i_Button, ButtonStyle i_ButtonStyle) { i_Button.Font = getRegularFont(); i_Button.Height = 25; i_Button.Width = 130; i_Button.BackColor = System.Drawing.Color.LightYellow; i_Button.ForeColor = getRegularForeColor(); switch (i_ButtonStyle) { case ButtonStyle.CancelButtonStyle: i_Button.Text = "Hủy bỏ (ESC)"; break; case ButtonStyle.ExitButtonStyle: i_Button.Text = "Thoát (ESC)"; break; case ButtonStyle.OkButtonStyle: i_Button.Text = "Chấp nhận (Alt+C)"; break; case ButtonStyle.FreeFunctionButtonStyle: break; case ButtonStyle.LongFunctionButtonStyle: i_Button.Width = 200; break; case ButtonStyle.MediumFunctionButtonStyle: i_Button.Width = 160; break; case ButtonStyle.SmallFunctionButtonStyle: i_Button.Width = 130; break; } }
/// <summary> /// Initialize a new instance of the NavigatorOutlook class. /// </summary> /// <param name="navigator">Reference to owning navigator instance.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public NavigatorOutlook(KryptonNavigator navigator, NeedPaintHandler needPaint) { Debug.Assert(navigator != null); // Remember back reference _navigator = navigator; // Store the provided paint notification delegate NeedPaint = needPaint; // Create compound objects _full = new NavigatorOutlookFull(navigator, needPaint); _mini = new NavigatorOutlookMini(navigator, needPaint); // Default values _checkButtonStyle = ButtonStyle.NavigatorStack; _overflowButtonStyle = ButtonStyle.NavigatorOverflow; _borderEdgeStyle = PaletteBorderStyle.ControlClient; _orientation = Orientation.Vertical; _itemOrientation = ButtonOrientation.Auto; _headerSecondaryVisible = InheritBool.False; _textMoreButtons = _defaultMoreButtons; _textFewerButtons = _defaultFewerButtons; _textAddRemoveButtons = _defaultAddRemoveButtons; _showDropDownButton = true; }
public void SetButtonStyle (ButtonStyle style) { buttonStyle = style; switch (style) { case ButtonStyle.Normal: Button.ClearValue (SWC.Control.BackgroundProperty); Button.ClearValue (SWC.Control.BorderThicknessProperty); Button.ClearValue (SWC.Control.BorderBrushProperty); break; case ButtonStyle.Flat: Button.Background = Brushes.Transparent; Button.BorderBrush = Brushes.Transparent; break; case ButtonStyle.Borderless: Button.ClearValue (SWC.Control.BackgroundProperty); Button.BorderThickness = new Thickness (0); Button.BorderBrush = Brushes.Transparent; break; case ButtonStyle.AlwaysBorderless: Button.Style = (Style)ButtonResources["NoChromeButton"]; break; case ButtonStyle.CompactFlatMomentary: case ButtonStyle.CompactFlatToggle: Button.Focusable = false; Button.Style = (Style)ButtonResources["CompactFlat"]; break; } Button.InvalidateMeasure (); }
//---------------------------------------------------------------------- public Button( Screen _screen, ButtonStyle _style, string _strText = "", Texture2D _iconTex = null, Anchor _anchor = Anchor.Center, string _strTooltipText="", object _tag=null ) : base(_screen) { Style = _style; mPadding = new Box(5, 0); mMargin = new Box(0); mLabel = new Label( _screen ); mIcon = new Image( _screen ); mIcon.Texture = _iconTex; mIcon.Padding = new Box( Style.VerticalPadding, 0, Style.VerticalPadding, Style.HorizontalPadding ); Text = _strText; TextColor = Screen.Style.DefaultTextColor; Anchor = _anchor; mPressedAnim = new SmoothValue( 1f, 0f, 0.2f ); mPressedAnim.SetTime( mPressedAnim.Duration ); mTooltip = new Tooltip( Screen, "" ); TooltipText = _strTooltipText; Tag = _tag; UpdateContentSize(); }
/// <summary> /// Initialize a new instance of the KryptonButton class. /// </summary> public KryptonButton() { // We generate click events manually, suppress default // production of them by the base Control class SetStyle(ControlStyles.StandardClick | ControlStyles.StandardDoubleClick, false); // Set default button properties _style = ButtonStyle.Standalone; _dialogResult = DialogResult.None; _orientation = VisualOrientation.Top; _useMnemonic = true; // Create content storage _buttonValues = CreateButtonValues(NeedPaintDelegate); _buttonValues.TextChanged += new EventHandler(OnButtonTextChanged); // Create the palette storage _stateCommon = new PaletteTripleRedirect(Redirector, PaletteBackStyle.ButtonStandalone, PaletteBorderStyle.ButtonStandalone, PaletteContentStyle.ButtonStandalone, NeedPaintDelegate); _stateDisabled = new PaletteTriple(_stateCommon, NeedPaintDelegate); _stateNormal = new PaletteTriple(_stateCommon, NeedPaintDelegate); _stateTracking = new PaletteTriple(_stateCommon, NeedPaintDelegate); _statePressed = new PaletteTriple(_stateCommon, NeedPaintDelegate); _stateDefault = new PaletteTripleRedirect(Redirector, PaletteBackStyle.ButtonStandalone, PaletteBorderStyle.ButtonStandalone, PaletteContentStyle.ButtonStandalone, NeedPaintDelegate); _stateFocus = new PaletteTripleRedirect(Redirector, PaletteBackStyle.ButtonStandalone, PaletteBorderStyle.ButtonStandalone, PaletteContentStyle.ButtonStandalone, NeedPaintDelegate); // Create the override handling classes _overrideFocus = new PaletteTripleOverride(_stateFocus, _stateNormal, PaletteState.FocusOverride); _overrideNormal = new PaletteTripleOverride(_stateDefault, _overrideFocus, PaletteState.NormalDefaultOverride); _overrideTracking = new PaletteTripleOverride(_stateFocus, _stateTracking, PaletteState.FocusOverride); _overridePressed = new PaletteTripleOverride(_stateFocus, _statePressed, PaletteState.FocusOverride); // Create the view button instance _drawButton = new ViewDrawButton(_stateDisabled, _overrideNormal, _overrideTracking, _overridePressed, new PaletteMetricRedirect(Redirector), this, Orientation, UseMnemonic); // Only draw a focus rectangle when focus cues are needed in the top level form _drawButton.TestForFocusCues = true; // Create a button controller to handle button style behaviour _buttonController = new ButtonController(_drawButton, NeedPaintDelegate); // Assign the controller to the view element to treat as a button _drawButton.MouseController = _buttonController; _drawButton.KeyController = _buttonController; _drawButton.SourceController = _buttonController; // Need to know when user clicks the button view or mouse selects it _buttonController.Click += new MouseEventHandler(OnButtonClick); _buttonController.MouseSelect += new MouseEventHandler(OnButtonSelect); // Create the view manager instance ViewManager = new ViewManager(this, _drawButton); }
internal ToolbarButton(ButtonStyle style) { _button = new UIButton(style); _button.AutoSize = false; _button.VerticalTextAlignment = VerticalAlignment.Bottom; _button.Click += ButtonClick; _button.MouseUp += ButtonMouseUp; }
public static MvcHtmlString BootStrapSubmitButton( this HtmlHelper html, string text, ButtonStyle type, ButtonSize size) { return html.BootStrapSubmitButton(text, type, size, new { }); }
public static MvcHtmlString BootStrapActionLink( this HtmlHelper htmlHelper, string linkText, string actionName, ButtonStyle type, ButtonSize size) { return htmlHelper.BootStrapActionLink(linkText, actionName, type, size, new RouteValueDictionary()); }
public static string GetClassForButtonStyle(ButtonStyle buttonStyle) { if (buttonStyle == ButtonStyle.Primary) return "btn-primary"; if (buttonStyle == ButtonStyle.Info) return "btn-info"; if (buttonStyle == ButtonStyle.Success) return "btn-success"; if (buttonStyle == ButtonStyle.Warning) return "btn-warning"; if (buttonStyle == ButtonStyle.Danger) return "btn-danger"; if (buttonStyle == ButtonStyle.Inverse) return "btn-inverse"; if (buttonStyle == ButtonStyle.Link) return "btn-link"; return string.Empty; }
/// <summary> /// Creates a Zurb Foundation button /// </summary> /// <param name="html">The current HtmlHelper instance</param> /// <param name="value">The button text</param> /// <param name="id">The button id</param> /// <param name="type"> The type of button to create </param> /// <param name="size"> The button size </param> /// <param name="color">The button color</param> /// <param name="style">The button style</param> /// <param name="cssClass">Any additional css classes</param> public static MvcHtmlString ZurbButton(this HtmlHelper html, string value, string id, ButtonType type, ZurbSize size, ZurbColor color, ButtonStyle style, string cssClass) { return new MvcHtmlString(String.Format("<input type=\"{0}\" value=\"{1}\" class=\"{2} {3} {4} {5} button\" id=\"{6}\" />", type.GetStringValue(), value, size.GetStringValue(), color.GetStringValue(), style.GetStringValue(), cssClass, id)); }
public void SetButtonStyle(ButtonStyle style) { switch (style) { case ButtonStyle.Normal: Widget.Relief = Gtk.ReliefStyle.Normal; break; case ButtonStyle.Flat: Widget.Relief = Gtk.ReliefStyle.None; break; } }
/// <summary> /// 新しいインスタンスを初期化します。 /// </summary> /// <param name="location"></param> /// <param name="itemSize"></param> public Menu(Point location, Size itemSize, Position basePoint, int margin, DxSharp.Data.Font font, ButtonStyle normalStyle = null, ButtonStyle hoverStyle = null, ButtonStyle activeStyle = null) { Location = location; ItemSize = itemSize; Size = new Size(itemSize.Width, 0); BasePoint = basePoint; Margin = margin; Font = font; NormalStyle = normalStyle; HoverStyle = hoverStyle; ActiveStyle = activeStyle; }
public static MvcHtmlString BootStrapActionLink( this HtmlHelper htmlHelper, string linkText, string actionName, ButtonStyle type, ButtonSize size, object routeValues) { var actionClass = "btn " + type.GetAttribute<XmlEnumAttribute>().Name + " " + size.GetAttribute<XmlEnumAttribute>().Name; return htmlHelper.ActionLink(linkText, actionName, routeValues, new { @class = actionClass }); }
public static Texture2D ApplyBorderButton(this Texture2D texture, ButtonStyle type) { Texture2D newTexture = new Texture2D(texture.GraphicsDevice, texture.Width, texture.Height); Color[] data = texture.GetColorData(); switch (type) { case (ButtonStyle.Default): for (int y = 0; y < texture.Height; y++) { for (int x = 0; x < texture.Width; x++) { if (y == 0 || x == 0 || y == texture.Height - 1 || x == texture.Width - 1) { data[x + y * texture.Width] = Color.CornflowerBlue; } } } newTexture.SetData(data); return newTexture; case (ButtonStyle.Hover): for (int y = 0; y < texture.Height; y++) { for (int x = 0; x < texture.Width; x++) { if (y == 0 || x == 0 || y == texture.Height - 1 || x == texture.Width - 1) { data[x + y * texture.Width] = Color.DimGray; } } } newTexture.SetData(data); return newTexture; case (ButtonStyle.Click): for (int y = 0; y < texture.Height; y++) { for (int x = 0; x < texture.Width; x++) { if (y == 0 || x == 0 || y == texture.Height - 1 || x == texture.Width - 1) { data[x + y * texture.Width] = Color.Black; } else data[x + y * texture.Width] = data[x + y * texture.Width].Add(0, -10, -10, -10); } } newTexture.SetData(data); return newTexture; default: return texture; } }
/// <summary> /// Initialize a new instance of the KryptonContextMenuImageSelect class. /// </summary> public KryptonContextMenuImageSelect() { _autoClose = true; _selectedIndex = -1; _trackingIndex = -1; _imageList = null; _imageIndexStart = -1; _imageIndexEnd = -1; _lineItems = 5; _padding = new Padding(2); _style = ButtonStyle.LowProfile; // Timer used to generate tracking change event _trackingEventTimer = new Timer(); _trackingEventTimer.Interval = 120; _trackingEventTimer.Tick += new EventHandler(OnTrackingTick); }
public string GoogleCheckoutButtonImage(ButtonSize size = ButtonSize.Small, ButtonStyle style = ButtonStyle.White) { var queryString = HttpUtility.ParseQueryString(string.Empty); queryString.Add("merchant_id", _configuration.MerchantId); var dimensions = size.Dimensions(); queryString.Add("w", dimensions.Item1.ToString()); queryString.Add("h", dimensions.Item2.ToString()); queryString.Add("style", style.ToString().ToLower()); queryString.Add("variant", "text"); // TODO: Introduce different locales queryString.Add("loc", "en_GB"); return _configuration.ButtonSrc + '?' + queryString; }
public void SetButtonStyle (ButtonStyle style) { switch (style) { case ButtonStyle.Normal: Button.ClearValue (SWC.Control.BackgroundProperty); Button.ClearValue (SWC.Control.BorderThicknessProperty); Button.ClearValue (SWC.Control.BorderBrushProperty); break; case ButtonStyle.Flat: Button.Background = Brushes.Transparent; Button.BorderBrush = Brushes.Transparent; break; case ButtonStyle.Borderless: Button.ClearValue (SWC.Control.BackgroundProperty); Button.BorderThickness = new Thickness (0); Button.BorderBrush = Brushes.Transparent; break; } Button.InvalidateMeasure (); }
/// <summary> /// Initialize a new instance of the NavigatorOutlookMini class. /// </summary> /// <param name="navigator">Reference to owning navigator instance.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public NavigatorOutlookMini(KryptonNavigator navigator, NeedPaintHandler needPaint) { Debug.Assert(navigator != null); // Remember back reference _navigator = navigator; // Store the provided paint notification delegate NeedPaint = needPaint; // Default values _miniButtonStyle = ButtonStyle.NavigatorMini; _miniMapImage = MapKryptonPageImage.None; _miniMapText = MapKryptonPageText.TextTitle; _miniMapExtraText = MapKryptonPageText.None; _stackMapImage = MapKryptonPageImage.MediumSmall; _stackMapText = MapKryptonPageText.None; _stackMapExtraText = MapKryptonPageText.None; }
/// <summary> /// Initialize a new instance of the NavigatorStack class. /// </summary> /// <param name="navigator">Reference to owning navigator instance.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public NavigatorStack(KryptonNavigator navigator, NeedPaintHandler needPaint) { Debug.Assert(navigator != null); // Remember back reference _navigator = navigator; // Store the provided paint notification delegate NeedPaint = needPaint; // Default values _checkButtonStyle = ButtonStyle.NavigatorStack; _borderEdgeStyle = PaletteBorderStyle.ControlClient; _stackAnimation = true; _stackOrientation = Orientation.Vertical; _stackAlignment = RelativePositionAlign.Center; _itemOrientation = ButtonOrientation.Auto; _stackMapImage = MapKryptonPageImage.Small; _stackMapText = MapKryptonPageText.TextTitle; _stackMapExtraText = MapKryptonPageText.None; }
public static MvcHtmlString BootStrapSubmitButton( this HtmlHelper html, string text, ButtonStyle type, ButtonSize size, object routeValues) { var buttonClass = "btn " + type.GetAttribute<XmlEnumAttribute>().Name + " " + size.GetAttribute<XmlEnumAttribute>().Name; var builder = new TagBuilder("input"); builder.Attributes.Add("type", "submit"); builder.Attributes.Add("class", buttonClass); builder.Attributes.Add("value", text); builder.MergeAttributes(new RouteValueDictionary(routeValues)); return MvcHtmlString.Create(builder.ToString(TagRenderMode.SelfClosing)); }
public MvcHtmlString ActionButton(string text, string actionName, string controllerName, object routeValues, object htmlAttributes, ButtonStyle style = ButtonStyle.Default) { if (string.IsNullOrWhiteSpace(actionName)) { throw new Exception("Action name is null or empty"); } if (string.IsNullOrWhiteSpace(controllerName)) { throw new Exception("Controller name is null or empty"); } if (text == null) { text = ""; } var builder = new TagBuilder("a"); builder.SetInnerText(text); if (htmlAttributes != null) { builder.MergeAttributes(HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes)); } builder.MergeAttribute("class", "btn btn-" + style.ToString().ToLower()); // http://stackoverflow.com/questions/5453901/urlhelper-generateurl var urlHelper = new UrlHelper(HttpContext.Current.Request.RequestContext); if (routeValues != null) { builder.MergeAttribute("href", urlHelper.Action(actionName, controllerName, routeValues)); } else { builder.MergeAttribute("href", urlHelper.Action(actionName, controllerName)); } //var url = UrlHelper.GenerateUrl(null, "action", "controller", null, RouteTable.Routes, HttpContext.Current.Request.RequestContext, false); return MvcHtmlString.Create(builder.ToString()); }
private MvcHtmlString Button(string text, string glyphicon, ButtonStyle style = ButtonStyle.Default, ButtonType type = ButtonType.Button) { var builder = new TagBuilder("button"); builder.MergeAttribute("class", "btn btn-" + style.ToString().ToLower()); builder.MergeAttribute("type", type.ToString().ToLower()); if (string.IsNullOrWhiteSpace(glyphicon)) { builder.InnerHtml = text; } else { var glyphiconBuilder = new TagBuilder("span"); glyphiconBuilder.MergeAttribute("class", glyphicon); builder.InnerHtml = glyphiconBuilder.ToString() + " " + text; } return MvcHtmlString.Create(builder.ToString()); }
public MvcHtmlString Button(string text, string glyphicon, ButtonStyle style = ButtonStyle.Default) { return Button(text, glyphicon, style, ButtonType.Button); }
/// Modify this method for adding other examples. public DefaultTitleItemExample() : base() { Log.Info(this.GetType().Name, $"{this.GetType().Name} is contructed\n"); WidthSpecification = LayoutParamPolicies.MatchParent; HeightSpecification = LayoutParamPolicies.MatchParent; // Navigator bar title is added here. AppBar = new AppBar() { Title = "DefaultTitleItemExample Style", }; // Example root content view. // you can decorate, add children on this view. var rootContent = new ScrollableBase() { WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.MatchParent, ScrollingDirection = ScrollableBase.Direction.Vertical, HideScrollbar = false, Layout = new LinearLayout() { LinearOrientation = LinearLayout.Orientation.Vertical, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, CellPadding = new Size2D(10, 20), }, }; var item = new DefaultTitleItem() { WidthSpecification = LayoutParamPolicies.MatchParent, Text = "Title Item", }; rootContent.Add(item); var path = Tizen.Applications.Application.Current.DirectoryInfo.Resource; var arrowStyle = new ButtonStyle() { IsSelectable = true, Size = new Size(40, 40), ItemHorizontalAlignment = HorizontalAlignment.Center, ItemVerticalAlignment = VerticalAlignment.Center, Icon = new ImageViewStyle() { ResourceUrl = new Selector <string>() { Normal = path + "/icon/icon_arrow_down.svg", Pressed = path + "/icon/icon_arrow_up.svg", Selected = path + "/icon/icon_arrow_up.svg", } } }; var itemWithArrow = new DefaultTitleItem() { WidthSpecification = LayoutParamPolicies.MatchParent, Text = "Title Item With Arrow", EnableControlStatePropagation = true, Icon = new Button(arrowStyle) { EnableControlStatePropagation = true, }, IsSelectable = true, }; rootContent.Add(itemWithArrow); Content = rootContent; }
/// Modify this method for adding other examples. public RadioButtonExample() : base() { WidthSpecification = LayoutParamPolicies.MatchParent; HeightSpecification = LayoutParamPolicies.MatchParent; // Navigator bar title is added here. AppBar = new AppBar() { Title = "RadioButton Default Style", }; var path = Tizen.Applications.Application.Current.DirectoryInfo.Resource; // Example root content view. // you can decorate, add children on this view. rootContent = new View() { WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.MatchParent, Layout = new LinearLayout() { LinearOrientation = LinearLayout.Orientation.Vertical, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, CellPadding = new Size2D(10, 20), }, }; // RadioButton examples. // Create by Property left = new View() { Weight = 0.5f, Layout = new LinearLayout() { LinearOrientation = LinearLayout.Orientation.Vertical } }; //Create left description text. createText[0] = new TextLabel(); createText[0].Text = "Create RadioButton just by properties"; createText[0].TextColor = Color.White; createText[0].Size = new Size(800, 100); left.Add(createText[0]); leftbody = new View(); leftbody.Layout = new GridLayout() { Columns = 4 }; int num = 4; for (int i = 0; i < num; i++) { group[i] = new RadioButtonGroup(); modeText[i] = new TextLabel(); modeText[i].Text = mode[i]; modeText[i].Size = new Size(200, 48); modeText[i].HorizontalAlignment = HorizontalAlignment.Center; modeText[i].VerticalAlignment = VerticalAlignment.Center; leftbody.Add(modeText[i]); } for (int i = 0; i < num; i++) { int index = i + 1; // create utility radio button. utilityRadioButton[i] = new RadioButton(); utilityRadioButton[i].SelectedChanged += (object sender, SelectedChangedEventArgs args) => { global::System.Console.WriteLine($"Left {index}th Utility RadioButton's IsSelected is changed to {args.IsSelected}."); }; var utilityStyle = utilityRadioButton[i].Style; utilityStyle.Icon.Opacity = new Selector <float?> { Normal = 1.0f, Selected = 1.0f, Disabled = 0.4f, DisabledSelected = 0.4f }; utilityStyle.Icon.BackgroundImage = ""; utilityStyle.Icon.ResourceUrl = new Selector <string> { Normal = path + "/radiobutton/controller_btn_radio_off.png", Selected = path + "/radiobutton/controller_btn_radio_on.png", Disabled = path + "/radiobutton/controller_btn_radio_off.png", DisabledSelected = path + "/radiobutton/controller_btn_radio_on.png", }; utilityRadioButton[i].ApplyStyle(utilityStyle); utilityRadioButton[i].Size = new Size(48, 48); utilityRadioButton[i].Icon.Size = new Size(48, 48); group[0].Add(utilityRadioButton[i]); // create family radio button. familyRadioButton[i] = new RadioButton(); familyRadioButton[i].SelectedChanged += (object sender, SelectedChangedEventArgs args) => { global::System.Console.WriteLine($"Left {index}th Family RadioButton's IsSelected is changed to {args.IsSelected}."); }; var familyStyle = familyRadioButton[i].Style; familyStyle.Icon.Opacity = new Selector <float?> { Normal = 1.0f, Selected = 1.0f, Disabled = 0.4f, DisabledSelected = 0.4f }; familyStyle.Icon.BackgroundImage = ""; familyStyle.Icon.ResourceUrl = new Selector <string> { Normal = path + "/radiobutton/controller_btn_radio_off.png", Selected = path + "/radiobutton/[Controller] App Primary Color/controller_btn_radio_on_24c447.png", Disabled = path + "/radiobutton/controller_btn_radio_off.png", DisabledSelected = path + "/radiobutton/[Controller] App Primary Color/controller_btn_radio_on_24c447.png", }; familyRadioButton[i].ApplyStyle(familyStyle); familyRadioButton[i].Size = new Size(48, 48); familyRadioButton[i].Icon.Size = new Size(48, 48); group[1].Add(familyRadioButton[i]); // create food radio button. foodRadioButton[i] = new RadioButton(); foodRadioButton[i].SelectedChanged += (object sender, SelectedChangedEventArgs args) => { global::System.Console.WriteLine($"Left {index}th Food RadioButton's IsSelected is changed to {args.IsSelected}."); }; var foodStyle = foodRadioButton[i].Style; foodStyle.Icon.Opacity = new Selector <float?> { Normal = 1.0f, Selected = 1.0f, Disabled = 0.4f, DisabledSelected = 0.4f }; foodStyle.Icon.BackgroundImage = ""; foodStyle.Icon.ResourceUrl = new Selector <string> { Normal = path + "/radiobutton/controller_btn_radio_off.png", Selected = path + "/radiobutton/[Controller] App Primary Color/controller_btn_radio_on_ec7510.png", Disabled = path + "/radiobutton/controller_btn_radio_off.png", DisabledSelected = path + "/radiobutton/[Controller] App Primary Color/controller_btn_radio_on_ec7510.png", }; foodRadioButton[i].ApplyStyle(foodStyle); foodRadioButton[i].Size = new Size(150, 48); foodRadioButton[i].Icon.Size = new Size(48, 48); group[2].Add(foodRadioButton[i]); // create kitchen radio button. kitchenRadioButton[i] = new RadioButton(); kitchenRadioButton[i].SelectedChanged += (object sender, SelectedChangedEventArgs args) => { global::System.Console.WriteLine($"Left {index}th Kitchen RadioButton's IsSelected is changed to {args.IsSelected}."); }; var kitchenStyle = kitchenRadioButton[i].Style; kitchenStyle.Icon.Opacity = new Selector <float?> { Normal = 1.0f, Selected = 1.0f, Disabled = 0.4f, DisabledSelected = 0.4f }; kitchenStyle.Icon.BackgroundImage = ""; kitchenStyle.Icon.ResourceUrl = new Selector <string> { Normal = path + "/radiobutton/controller_btn_radio_off.png", Selected = path + "/radiobutton/[Controller] App Primary Color/controller_btn_radio_on_9762d9.png", Disabled = path + "/radiobutton/controller_btn_radio_off.png", DisabledSelected = path + "/radiobutton/[Controller] App Primary Color/controller_btn_radio_on_9762d9.png", }; kitchenRadioButton[i].ApplyStyle(kitchenStyle); kitchenRadioButton[i].Size = new Size(48, 48); kitchenRadioButton[i].Icon.Size = new Size(48, 48); group[3].Add(kitchenRadioButton[i]); leftbody.Add(utilityRadioButton[i]); leftbody.Add(familyRadioButton[i]); leftbody.Add(foodRadioButton[i]); leftbody.Add(kitchenRadioButton[i]); } // Create by Attributes right = new View() { Weight = 0.5f, Layout = new LinearLayout() { LinearOrientation = LinearLayout.Orientation.Vertical, } }; rightbody = new View(); rightbody.Layout = new GridLayout() { Columns = 4 }; createText[1] = new TextLabel(); createText[1].Text = "Create RadioButton just by styles"; createText[1].TextColor = Color.White; createText[1].Size = new Size(800, 100); right.Add(createText[1]); for (int i = 0; i < num; i++) { group2[i] = new RadioButtonGroup(); modeText2[i] = new TextLabel(); modeText2[i].Text = mode[i]; modeText2[i].Size = new Size(200, 48); modeText2[i].HorizontalAlignment = HorizontalAlignment.Center; modeText2[i].VerticalAlignment = VerticalAlignment.Center; rightbody.Add(modeText2[i]); } //Create utility style of radio button. ButtonStyle utilityStyle2 = new ButtonStyle { Icon = new ImageViewStyle { Size = new Size(48, 48), Opacity = new Selector <float?> { Normal = 1.0f, Selected = 1.0f, Disabled = 0.4f, DisabledSelected = 0.4f }, ResourceUrl = new Selector <string> { Normal = path + "/radiobutton/controller_btn_radio_off.png", Selected = path + "/radiobutton/controller_btn_radio_on.png", Disabled = path + "/radiobutton/controller_btn_radio_off.png", DisabledSelected = path + "/radiobutton/controller_btn_radio_on.png", }, }, }; //Create family style of radio button. ButtonStyle familyStyle2 = new ButtonStyle { Icon = new ImageViewStyle { Size = new Size(48, 48), Opacity = new Selector <float?> { Normal = 1.0f, Selected = 1.0f, Disabled = 0.4f, DisabledSelected = 0.4f }, ResourceUrl = new Selector <string> { Normal = path + "/radiobutton/controller_btn_radio_off.png", Selected = path + "/radiobutton/[Controller] App Primary Color/controller_btn_radio_on_24c447.png", Disabled = path + "/radiobutton/controller_btn_radio_off.png", DisabledSelected = path + "/radiobutton/[Controller] App Primary Color/controller_btn_radio_on_24c447.png", }, }, }; //Create food style of radio button. ButtonStyle foodStyle2 = new ButtonStyle { Icon = new ImageViewStyle { Size = new Size(48, 48), Opacity = new Selector <float?> { Normal = 1.0f, Selected = 1.0f, Disabled = 0.4f, DisabledSelected = 0.4f }, ResourceUrl = new Selector <string> { Normal = path + "/radiobutton/controller_btn_radio_off.png", Selected = path + "/radiobutton/[Controller] App Primary Color/controller_btn_radio_on_ec7510.png", Disabled = path + "/radiobutton/controller_btn_radio_off.png", DisabledSelected = path + "/radiobutton/[Controller] App Primary Color/controller_btn_radio_on_ec7510.png", }, }, }; //Create kitchen style of radio button. ButtonStyle kitchenStyle2 = new ButtonStyle { Icon = new ImageViewStyle { Size = new Size(48, 48), Opacity = new Selector <float?> { Normal = 1.0f, Selected = 1.0f, Disabled = 0.4f, DisabledSelected = 0.4f }, ResourceUrl = new Selector <string> { Normal = path + "/radiobutton/controller_btn_radio_off.png", Selected = path + "/radiobutton/[Controller] App Primary Color/controller_btn_radio_on_9762d9.png", Disabled = path + "/radiobutton/controller_btn_radio_off.png", DisabledSelected = path + "/radiobutton/[Controller] App Primary Color/controller_btn_radio_on_9762d9.png", }, }, }; for (int i = 0; i < num; i++) { int index = i + 1; utilityRadioButton2[i] = new RadioButton(utilityStyle2); utilityRadioButton2[i].SelectedChanged += (object sender, SelectedChangedEventArgs args) => { global::System.Console.WriteLine($"Right {index}th Utility RadioButton's IsSelected is changed to {args.IsSelected}."); }; utilityRadioButton2[i].Size = new Size(48, 48); group2[0].Add(utilityRadioButton2[i]); familyRadioButton2[i] = new RadioButton(familyStyle2); familyRadioButton2[i].SelectedChanged += (object sender, SelectedChangedEventArgs args) => { global::System.Console.WriteLine($"Right {index}th Family RadioButton's IsSelected is changed to {args.IsSelected}."); }; familyRadioButton2[i].Size = new Size(48, 48); group2[1].Add(familyRadioButton2[i]); foodRadioButton2[i] = new RadioButton(foodStyle2); foodRadioButton2[i].SelectedChanged += (object sender, SelectedChangedEventArgs args) => { global::System.Console.WriteLine($"Right {index}th Food RadioButton's IsSelected is changed to {args.IsSelected}."); }; foodRadioButton2[i].Size = new Size(48, 48); group2[2].Add(foodRadioButton2[i]); kitchenRadioButton2[i] = new RadioButton(kitchenStyle2); kitchenRadioButton2[i].SelectedChanged += (object sender, SelectedChangedEventArgs args) => { global::System.Console.WriteLine($"Right {index}th Kitchen RadioButton's IsSelected is changed to {args.IsSelected}."); }; kitchenRadioButton2[i].Size = new Size(48, 48); group2[3].Add(kitchenRadioButton2[i]); rightbody.Add(utilityRadioButton2[i]); rightbody.Add(familyRadioButton2[i]); rightbody.Add(foodRadioButton2[i]); rightbody.Add(kitchenRadioButton2[i]); } rootContent.Add(left); rootContent.Add(right); left.Add(leftbody); right.Add(rightbody); utilityRadioButton[2].IsEnabled = false; familyRadioButton[2].IsEnabled = false; foodRadioButton[2].IsEnabled = false; kitchenRadioButton[2].IsEnabled = false; utilityRadioButton2[2].IsEnabled = false; familyRadioButton2[2].IsEnabled = false; foodRadioButton2[2].IsEnabled = false; kitchenRadioButton2[2].IsEnabled = false; utilityRadioButton[3].IsEnabled = false; familyRadioButton[3].IsEnabled = false; foodRadioButton[3].IsEnabled = false; kitchenRadioButton[3].IsEnabled = false; utilityRadioButton[3].IsSelected = true; familyRadioButton[3].IsSelected = true; foodRadioButton[3].IsSelected = true; kitchenRadioButton[3].IsSelected = true; utilityRadioButton2[3].IsEnabled = false; familyRadioButton2[3].IsEnabled = false; foodRadioButton2[3].IsEnabled = false; kitchenRadioButton2[3].IsEnabled = false; utilityRadioButton2[3].IsSelected = true; familyRadioButton2[3].IsSelected = true; foodRadioButton2[3].IsSelected = true; kitchenRadioButton2[3].IsSelected = true; Content = rootContent; }
public void ApplyButtonStyle(ButtonStyle style) { ApplyWidgetStyle(style); PressedBackground = style.PressedBackground; }
public MaterialStyle(ColorPalette colorPalette) { PrimaryColorPalette = colorPalette; SecondaryColorPalette = colorPalette; Button = OutlinedButton = new ButtonStyle { TextColor = colorPalette.P900, Border = new RoundedRectangle(4f).Stroke(Colors.Grey, 1f, true), BackgroundColor = new StyleAwareValue <ControlState, Color> { [ControlState.Default] = colorPalette.PD900, [ControlState.Hovered] = Colors.Grey.WithAlpha(.6f), [ControlState.Pressed] = Colors.Grey.WithAlpha(.4f), }, Padding = new Thickness(16, 0, 16, 0), Shadow = null, }; ContainedButton = new ButtonStyle { TextColor = colorPalette.PD900, Border = new RoundedRectangle(4f).Stroke(Colors.Grey, 1f, true), BackgroundColor = new StyleAwareValue <ControlState, Color> { [ControlState.Default] = colorPalette.P900, [ControlState.Hovered] = colorPalette.P800, [ControlState.Pressed] = colorPalette.P700, }, Shadow = new Graphics.Shadow().WithColor(Colors.Grey).WithRadius(1).WithOffset(new Size(1, 1)), Padding = new Thickness(16, 0, 16, 0), }; TextButton = new ButtonStyle { TextColor = colorPalette.P900, Padding = new Thickness(16, 0, 16, 0), BackgroundColor = new StyleAwareValue <ControlState, Color> { [ControlState.Default] = Colors.Transparent, [ControlState.Hovered] = Colors.Grey.WithAlpha(.6f), [ControlState.Pressed] = Colors.Grey.WithAlpha(.4f), }, Shadow = null, Border = null, }; Navbar = new NavbarStyle { BackgroundColor = colorPalette.P500, TextColor = colorPalette.PD500 }; Slider = new SliderStyle { ThumbColor = colorPalette.P500, ProgressColor = colorPalette.P500, TrackColor = colorPalette.P100, }; ProgressBar = new ProgressBarStyle { ProgressColor = colorPalette.P500, TrackColor = colorPalette.P100, }; }
/// <summary> /// Initialize a new instance of the KryptonButton class. /// </summary> public KryptonButton() { // We generate click events manually, suppress default // production of them by the base Control class SetStyle(ControlStyles.StandardClick | ControlStyles.StandardDoubleClick, false); // Set default button properties _style = ButtonStyle.Standalone; DialogResult = DialogResult.None; _orientation = VisualOrientation.Top; _useMnemonic = true; // Create content storage Values = CreateButtonValues(NeedPaintDelegate); Values.TextChanged += OnButtonTextChanged; // Create the palette storage StateCommon = new PaletteTripleRedirect(Redirector, PaletteBackStyle.ButtonStandalone, PaletteBorderStyle.ButtonStandalone, PaletteContentStyle.ButtonStandalone, NeedPaintDelegate); StateDisabled = new PaletteTriple(StateCommon, NeedPaintDelegate); StateNormal = new PaletteTriple(StateCommon, NeedPaintDelegate); StateTracking = new PaletteTriple(StateCommon, NeedPaintDelegate); StatePressed = new PaletteTriple(StateCommon, NeedPaintDelegate); OverrideDefault = new PaletteTripleRedirect(Redirector, PaletteBackStyle.ButtonStandalone, PaletteBorderStyle.ButtonStandalone, PaletteContentStyle.ButtonStandalone, NeedPaintDelegate); OverrideFocus = new PaletteTripleRedirect(Redirector, PaletteBackStyle.ButtonStandalone, PaletteBorderStyle.ButtonStandalone, PaletteContentStyle.ButtonStandalone, NeedPaintDelegate); // Create the override handling classes _overrideFocus = new PaletteTripleOverride(OverrideFocus, StateNormal, PaletteState.FocusOverride); _overrideNormal = new PaletteTripleOverride(OverrideDefault, _overrideFocus, PaletteState.NormalDefaultOverride); _overrideTracking = new PaletteTripleOverride(OverrideFocus, StateTracking, PaletteState.FocusOverride); _overridePressed = new PaletteTripleOverride(OverrideFocus, StatePressed, PaletteState.FocusOverride); // Create the view button instance _drawButton = new ViewDrawButton(StateDisabled, _overrideNormal, _overrideTracking, _overridePressed, new PaletteMetricRedirect(Redirector), this, Orientation, UseMnemonic) { // Only draw a focus rectangle when focus cues are needed in the top level form TestForFocusCues = true }; // Create a button controller to handle button style behaviour _buttonController = new ButtonController(_drawButton, NeedPaintDelegate); // Assign the controller to the view element to treat as a button _drawButton.MouseController = _buttonController; _drawButton.KeyController = _buttonController; _drawButton.SourceController = _buttonController; // Need to know when user clicks the button view or mouse selects it _buttonController.Click += OnButtonClick; _buttonController.MouseSelect += OnButtonSelect; // Create the view manager instance ViewManager = new ViewManager(this, _drawButton); }
public abstract string GetButtonStyleCssClass(ButtonStyle buttonStyle);
private void ResetCrumbButtonStyle() { CrumbButtonStyle = ButtonStyle.BreadCrumb; }
public DiscordButtonWithCallback(DiscordClient client, ButtonStyle style, string customId, string label, DiscordComponentEmoji emoji, Func <DiscordInteractionResponseBuilder> response) : this(client, new DiscordButtonComponent(style, customId, label, emoji : emoji)) { _response = response; }
public void SetButtonStyle(ButtonStyle style) { Widget.SetButtonStyle(style); }
/// <summary> /// Initialize a new instance of the KryptonDataGridViewCheckBoxCell. /// </summary> public KryptonDataGridViewButtonCell() { _buttonStyle = ButtonStyle.Standalone; }
public static T Style <T>(this T button, ButtonStyle style) where T : IHasButtonStyle { button.ControlBag[ButtonStyle.Key] = style; return(button); }
public override void InitUI() { game.background = StaticSprite.CreateSprite(0, 0, game.ScreenScaleFactor, @"Sprite/GameUI/Background_Black", 1.0f); // title if (game.GameTitle == null) { game.GameTitle = StaticSprite.CreateSprite(303, 39, game.ScreenScaleFactor, @"Sprite/GameUI/Black_Logo", 0.9f); } // panel if (game.Panel == null) { game.Panel = StaticSprite.CreateSprite(255, 356, game.ScreenScaleFactor, @"Sprite/GameUI/Black_Panel", 0.8f); } if (game.TextBoxName == null) { game.TextBoxName = TextBox.CreateTextBox(445, 380, game.ScreenScaleFactor, @"Sprite/GameUI/Black_TextBox", 0.7f); game.TextBoxName.InitTextBox(); game.TextBoxName.SetFont("Black_SegoeWP"); game.TextBoxName.SetColor(Color.WhiteSmoke); TextBoxStyle.Assign(game.TextBoxName); } if (game.TextBoxRoom == null) { game.TextBoxRoom = TextBox.CreateTextBox(445, 433, game.ScreenScaleFactor, @"Sprite/GameUI/Black_TextBox", 0.7f); game.TextBoxRoom.InitTextBox(); game.TextBoxRoom.SetFont("Black_SegoeWP"); game.TextBoxRoom.SetColor(Color.WhiteSmoke); TextBoxStyle.Assign(game.TextBoxRoom); } if (game.TextPlayerName == null) { game.TextPlayerName = StaticSprite.CreateSprite(295, 384, game.ScreenScaleFactor, @"Sprite/GameUI/Black_TextPlayerName", 0.7f); } if (game.TextRoomID == null) { game.TextRoomID = StaticSprite.CreateSprite(295, 437, game.ScreenScaleFactor, @"Sprite/GameUI/Black_TextRoomID", 0.7f); } // btn play if (game.btnPlaySingle == null) { game.btnPlaySingle = StaticSprite.CreateSprite(394, 610, game.ScreenScaleFactor, @"Sprite/GameUI/Black_btnRound", 0.8f); game.btnPlaySingle.AddChildAtMid(StaticSprite.CreateSprite(0, 0, game.ScreenScaleFactor, @"Sprite/GameUI/Black_btnSinglePlay", 0.7f)); game.btnPlaySingle.OnMouseUp += (sender) => { TransitionToGame(StartGameSingle); }; ModernButtonStyle.Assign(game.btnPlaySingle); } if (game.btnPlayMulti == null) { game.btnPlayMulti = StaticSprite.CreateSprite(394, 554, game.ScreenScaleFactor, @"Sprite/GameUI/Black_btnRound", 0.8f); game.btnPlayMulti.AddChildAtMid(StaticSprite.CreateSprite(0, 0, game.ScreenScaleFactor, @"Sprite/GameUI/Black_btnMultiPlay", 0.7f)); game.btnPlayMulti.OnMouseUp += (sender) => { if (String.IsNullOrEmpty(game.TextBoxName.GetText())) { return; } if (String.IsNullOrEmpty(game.TextBoxRoom.GetText())) { return; } TransitionToGame(StartGameMultiplayer); }; ModernButtonStyle.Assign(game.btnPlayMulti); } if (game.btnSetting == null) { game.btnSetting = StaticSprite.CreateSprite(394, 666, game.ScreenScaleFactor, @"Sprite/GameUI/Black_btnRound", 0.8f); game.btnSetting.AddChildAtMid(StaticSprite.CreateSprite(0, 0, game.ScreenScaleFactor, @"Sprite/GameUI/Black_btnSetting", 0.7f)); ModernButtonStyle.Assign(game.btnSetting); } // small top icons if (game.btnShop == null) { game.btnShop = StaticSprite.CreateSprite(882, 24, game.ScreenScaleFactor, @"Sprite/GameUI/Black_btnShop", 0.9f); ButtonStyle.Assign(game.btnShop); } // small top icons if (game.btnSound == null) { game.btnSound = StaticSprite.CreateSprite(934, 24, game.ScreenScaleFactor, @"Sprite/GameUI/Black_audioOn", 0.9f); ButtonStyle.Assign(game.btnSound); } if (game.scoreBoard == null) { var Red = StaticSprite.CreateSprite(0, 30, game.ScreenScaleFactor, @"Sprite/GameUI/Player1", 0.6f); var Blue = StaticSprite.CreateSprite(0, 110, game.ScreenScaleFactor, @"Sprite/GameUI/Player2", 0.6f); game.scoreBoard = new Scoreboard(Red, Blue, game.ScreenScaleFactor); game.scoreBoard.Top = 320 * game.ScreenScaleFactor.Y; game.scoreBoard.Left = 90 * game.ScreenScaleFactor.X; } //if (game.btnHelp == null) //{ // game.btnHelp = StaticSprite.CreateSprite(860, 22, game.ScreenScaleFactor, @"Sprite/GameUI/btnHelp", 0.9f); // ButtonStyle.Assign(game.btnHelp); //} if (game.btnExit == null) { game.btnExit = StaticSprite.CreateSprite(39, 670 + 300, game.ScreenScaleFactor, @"Sprite/GameUI/Black_btnRound", 0.8f); game.btnExit.AddChildAtMid(StaticSprite.CreateSprite(0, 0, game.ScreenScaleFactor, @"Sprite/GameUI/Black_btnExit", 0.7f)); game.btnExit.OnMouseUp += TransitionToMenu; ModernButtonStyle.Assign(game.btnExit); } base.InitUI(); }
private static MvcHtmlString GetSelectUserHtml(HtmlHelper html, string name, string text, DataType DataType, string JSCallBackMethod, ButtonStyle buttonStyle, SelectType selectType, bool Required, string value, int?currentUserID, Type t, object parameter) { JavaScriptSerializer serializer = new JavaScriptSerializer(); StringBuilder builder = new StringBuilder(800); TagBuilder builder2 = GetTagBuilder("div", name, "SelectUserDiv"); TagBuilder builder3 = GetTagBuilder("div", name, "SelectUser"); builder3.MergeAttribute("style", "display:none;"); TagBuilder builder4 = GetTagBuilder("div", name, "SearchSelectDiv"); string str = string.Format("<span class='dep' >部门</span>", new object[0]); builder4.InnerHtml = builder4.InnerHtml + str; TagBuilder builder5 = GetTagBuilder("select", name, "DepSelect"); builder4.InnerHtml = builder4.InnerHtml + builder5; string str2 = string.Format("<span class='user' >用户</span>", new object[0]); builder4.InnerHtml = builder4.InnerHtml + str2; TagBuilder builder6 = GetTagBuilder("input", name, "UserSelect"); builder4.InnerHtml = builder4.InnerHtml + builder6; TagBuilder builder7 = GetTagBuilder("input", name, "查询", "Search", "button"); builder4.InnerHtml = builder4.InnerHtml + builder7; TagBuilder builder8 = GetTagBuilder("input", name, "重置", "Reset", "button"); builder4.InnerHtml = builder4.InnerHtml + builder8; builder3.InnerHtml = builder3.InnerHtml + builder4; builder4 = GetTagBuilder("div", name, "SearchMoreDiv"); TagBuilder builder9 = GetTagBuilder("input", name, "查询", "SearchMore", "button"); builder4.InnerHtml = builder4.InnerHtml + builder9; builder3.InnerHtml = builder3.InnerHtml + builder4; string str3 = string.Format("<div class='WaitDepDiv'><span class='WaitDepSpan' >待选部门</span></div>", new object[0]); builder3.InnerHtml = builder3.InnerHtml + str3; string str4 = string.Format("<div class='WaitUserDiv'><span class='WaitUserSpan' >待选人员</span></div>", new object[0]); builder3.InnerHtml = builder3.InnerHtml + str4; string str5 = string.Format("<div class='SelectedUserDiv'><span class='SelectedUserSpan' >已选人员</span></div>", new object[0]); builder3.InnerHtml = builder3.InnerHtml + str5; builder4 = GetTagBuilder("div", name, "TreeDiv"); TagBuilder builder10 = GetTagBuilder("ul", name, "ztree"); builder4.InnerHtml = builder4.InnerHtml + builder10; builder3.InnerHtml = builder3.InnerHtml + builder4; builder4 = GetTagBuilder("div", name, "UserWaitSelectDiv"); TagBuilder builder11 = GetTagBuilder("select", name, "UserWaitSelect"); builder11.MergeAttribute("multiple", "multiple"); builder4.InnerHtml = builder4.InnerHtml + builder11; builder3.InnerHtml = builder3.InnerHtml + builder4; builder4 = GetTagBuilder("div", name, "SelectButtonDiv"); TagBuilder builder12 = GetTagBuilder("img", name, "SelectSingle"); builder12.MergeAttribute("src", "/Content/metro/images/select_right2.png"); builder4.InnerHtml = builder4.InnerHtml + builder12; if (selectType == SelectType.Multi) { builder12 = GetTagBuilder("img", name, "SelectAll"); builder12.MergeAttribute("src", "/Content/metro/images/select_right.png"); builder4.InnerHtml = builder4.InnerHtml + builder12; } builder12 = GetTagBuilder("img", name, "ReturnSingle"); builder12.MergeAttribute("src", "/Content/metro/images/select_left2.png"); builder4.InnerHtml = builder4.InnerHtml + builder12; if (selectType == SelectType.Multi) { builder12 = GetTagBuilder("img", name, "ReturnAll"); builder12.MergeAttribute("src", "/Content/metro/images/select_left.png"); builder4.InnerHtml = builder4.InnerHtml + builder12; } builder3.InnerHtml = builder3.InnerHtml + builder4; builder4 = GetTagBuilder("div", name, "UserSelectedDiv"); TagBuilder builder13 = GetTagBuilder("select", name, "UserSelected"); builder13.MergeAttribute("multiple", "multiple"); builder4.InnerHtml = builder4.InnerHtml + builder13; builder3.InnerHtml = builder3.InnerHtml + builder4; TagBuilder builder14 = GetTagBuilder("div", name, "dataHF"); builder14.MergeAttribute("style", "display:none;"); List <SelectControlData> list = GetData(DataType, t, parameter, currentUserID.ToInt()); builder14.InnerHtml = builder14.InnerHtml + serializer.Serialize(list); builder3.InnerHtml = builder3.InnerHtml + builder14; TagBuilder builder15 = GetTagBuilder("input", name, ((int)selectType).ToString(), "HidSelectType", "hidden"); builder3.InnerHtml = builder3.InnerHtml + builder15; TagBuilder builder16 = GetTagBuilder("input", name, JSCallBackMethod, "HidCallBack", "hidden"); builder3.InnerHtml = builder3.InnerHtml + builder16; TagBuilder hidUserId = GetTagBuilder("input", name, "HidUserId"); hidUserId.MergeAttribute("type", "hidden"); TagBuilder selectedIDHf = GetTagBuilder("input", name, "selectedIDHf"); selectedIDHf.MergeAttribute("type", "hidden"); TagBuilder userName = GetTagBuilder("input", name, "UserName"); userName.MergeAttribute("type", "text"); if (Required) { userName.MergeAttribute("data-bvalidator", "required"); userName.MergeAttribute("data-bvalidator-msg", "请至少选人一个用户!"); } userName.MergeAttribute("readonly", "true"); SetDefaultValue(userName, hidUserId, selectedIDHf, value); builder3.InnerHtml = builder3.InnerHtml + hidUserId; builder3.InnerHtml = builder3.InnerHtml + selectedIDHf; string str6 = (buttonStyle == ButtonStyle.Normal) ? "" : "style='display:none'"; string str7 = string.Empty; string str8 = string.Empty; if (buttonStyle == ButtonStyle.Normal) { userName.MergeAttribute("style", "float: left;"); str7 = string.Format("<span class='col-9' {1} >{0}</span>", userName, str6); str8 = string.Format("<span class='col-3'><input class='selectButton' id='{0}_selectButton' \r\n treename='{0}' type='button' value='{1}'></span>", name, text ?? "选择"); } else { userName.MergeAttribute("style", "float: left;display:none"); str7 = userName.ToString(); str8 = string.Format("<input class='selectButton' id='{0}_selectButton' \r\n treename='{0}' type='button' value='{1}'>", name, text ?? "选择"); } builder2.InnerHtml = builder2.InnerHtml + str7; builder2.InnerHtml = builder2.InnerHtml + str8; builder2.InnerHtml = builder2.InnerHtml + builder3; builder.AppendLine(builder2.ToString()); return(MvcHtmlString.Create(builder.ToString())); }
public void SetButtonStyle(ButtonStyle style) { switch (style) { case ButtonStyle.Normal: SetMiniMode (false); Widget.Relief = Gtk.ReliefStyle.Normal; break; case ButtonStyle.Flat: SetMiniMode (false); Widget.Relief = Gtk.ReliefStyle.None; break; case ButtonStyle.Borderless: SetMiniMode (true); Widget.Relief = Gtk.ReliefStyle.None; break; } }
/// <summary> /// Update the combo box item style. /// </summary> /// <param name="style">New item style.</param> public void SetStyles(ButtonStyle style) { _itemRedirect.SetStyles(style); }
public void AppBarDispose() { tlog.Debug(tag, $"AppBarDispose START"); var testingTarget = new MyAppBar(); Assert.IsNotNull(testingTarget, "null handle"); Assert.IsInstanceOf <AppBar>(testingTarget, "Should return AppBar instance."); testingTarget.AutoNavigationContent = false; tlog.Debug(tag, "AutoNavigationContent : " + testingTarget.AutoNavigationContent); testingTarget.AutoNavigationContent = false; // if "== value", return testingTarget.AutoNavigationContent = true; tlog.Debug(tag, "AutoNavigationContent : " + testingTarget.AutoNavigationContent); View nc = new View() { Size = new Size(100, 100), BackgroundColor = Color.Cyan }; testingTarget.NavigationContent = nc; testingTarget.NavigationContent = nc; View tc = new View() { Size = new Size(100, 20), Position = new Position(0, 0), BackgroundColor = Color.Green }; testingTarget.TitleContent = tc; testingTarget.TitleContent = tc; List <View> actions = new List <View>(); ViewStyle style1 = new ViewStyle() { BackgroundColor = Color.Red, }; View action1 = new View(style1); ButtonStyle style2 = new ButtonStyle() { BackgroundColor = Color.Yellow, ItemAlignment = LinearLayout.Alignment.Center, ItemSpacing = new Size2D(10, 2) }; tlog.Debug(tag, "ItemAlignment : " + style2.ItemAlignment); tlog.Debug(tag, "ItemSpacing : " + style2.ItemSpacing); View action2 = new Button(style2); actions.Add(action1); actions.Add(action2); testingTarget.Actions = actions; View ac = new View() { Size = new Size(100, 80), Position = new Position(0, 20) }; testingTarget.ActionContent = ac; testingTarget.Actions = actions; try { testingTarget.OnDispose(DisposeTypes.Explicit); } catch (Exception e) { tlog.Error(tag, e.Message.ToString()); Assert.Fail("Caught Exception : Failed!"); } tlog.Debug(tag, $"AppBarDispose END (OK)"); }
private void SetCheckButtonStyle(ButtonStyle style) { _stateCommon.SetStyles(style); _stateFocus.SetStyles(style); }
public RadioButton(ButtonStyle bs) : base(bs) { Toggleable = true; }
/// <summary> /// Update the remap target to match the button style. /// </summary> /// <param name="style">Button style to match.</param> public void SetRemapTarget(ButtonStyle style) { switch (style) { case ButtonStyle.Alternate: RemapTarget = ButtonSpecNavRemap.ButtonSpecRemapTarget.ButtonAlternate; break; case ButtonStyle.BreadCrumb: RemapTarget = ButtonSpecNavRemap.ButtonSpecRemapTarget.ButtonBreadCrumb; break; case ButtonStyle.ButtonSpec: RemapTarget = ButtonSpecNavRemap.ButtonSpecRemapTarget.ButtonButtonSpec; break; case ButtonStyle.CalendarDay: RemapTarget = ButtonSpecNavRemap.ButtonSpecRemapTarget.ButtonCalendarDay; break; case ButtonStyle.Cluster: RemapTarget = ButtonSpecNavRemap.ButtonSpecRemapTarget.ButtonCluster; break; case ButtonStyle.Custom1: RemapTarget = ButtonSpecNavRemap.ButtonSpecRemapTarget.ButtonCustom1; break; case ButtonStyle.Custom2: RemapTarget = ButtonSpecNavRemap.ButtonSpecRemapTarget.ButtonCustom2; break; case ButtonStyle.Custom3: RemapTarget = ButtonSpecNavRemap.ButtonSpecRemapTarget.ButtonCustom3; break; case ButtonStyle.Form: RemapTarget = ButtonSpecNavRemap.ButtonSpecRemapTarget.ButtonForm; break; case ButtonStyle.FormClose: RemapTarget = ButtonSpecNavRemap.ButtonSpecRemapTarget.ButtonFormClose; break; case ButtonStyle.Gallery: RemapTarget = ButtonSpecNavRemap.ButtonSpecRemapTarget.ButtonGallery; break; case ButtonStyle.InputControl: RemapTarget = ButtonSpecNavRemap.ButtonSpecRemapTarget.ButtonInputControl; break; case ButtonStyle.ListItem: RemapTarget = ButtonSpecNavRemap.ButtonSpecRemapTarget.ButtonListItem; break; case ButtonStyle.LowProfile: RemapTarget = ButtonSpecNavRemap.ButtonSpecRemapTarget.ButtonLowProfile; break; case ButtonStyle.NavigatorMini: RemapTarget = ButtonSpecNavRemap.ButtonSpecRemapTarget.ButtonNavigatorMini; break; case ButtonStyle.NavigatorOverflow: RemapTarget = ButtonSpecNavRemap.ButtonSpecRemapTarget.ButtonNavigatorOverflow; break; case ButtonStyle.NavigatorStack: RemapTarget = ButtonSpecNavRemap.ButtonSpecRemapTarget.ButtonNavigatorStack; break; case ButtonStyle.Standalone: RemapTarget = ButtonSpecNavRemap.ButtonSpecRemapTarget.ButtonStandalone; break; case ButtonStyle.Command: RemapTarget = ButtonSpecNavRemap.ButtonSpecRemapTarget.ButtonCommand; break; default: Debug.Assert(false); break; } }
public void Activate() { // tool bar tool_bar = new View(); tool_bar.BackgroundColor = Color.White; tool_bar.Size2D = new Size2D(NUIApplication.GetDefaultWindow().WindowSize.Width, 100); tool_bar.PositionUsesPivotPoint = true; tool_bar.ParentOrigin = ParentOrigin.TopLeft; tool_bar.PivotPoint = PivotPoint.TopLeft; NUIApplication.GetDefaultWindow().GetDefaultLayer().Add(tool_bar); NUIApplication.GetDefaultWindow().GetDefaultLayer().RaiseToTop(); // title of tool bar mTitle = new TextLabel(); mTitle.Text = APPLICATION_TITLE_WAVE; mTitle.FontFamily = "SamsungOne 400"; mTitle.PointSize = 20; mTitle.Position2D = new Position2D(400, 42); mTitle.ParentOrigin = ParentOrigin.TopLeft; mTitle.PositionUsesPivotPoint = true; mTitle.PivotPoint = PivotPoint.TopLeft; tool_bar.Add(mTitle); // push button of tool bar var style = new ButtonStyle(); style.Icon.ResourceUrl = new Selector <string>() { Normal = SLIDE_SHOW_START_ICON, Pressed = SLIDE_SHOW_START_ICON_SELECTED }; style.Position = new Position(800, 32); style.ParentOrigin = ParentOrigin.TopLeft; style.PivotPoint = PivotPoint.TopLeft; style.Size = new Size(58, 58); mSlideshowButton = new Button(style); mSlideshowButton.Clicked += OnPushButtonClicked; mSlideshowButton.RaiseToTop(); tool_bar.Add(mSlideshowButton); // toggle button of tool bar radiosParent = new View(); radiosParent.Size = new Size(200, 40); radiosParent.Position = new Position(900, 42); var layout = new LinearLayout(); layout.LinearOrientation = LinearLayout.Orientation.Horizontal; layout.CellPadding = new Size(30, 30); radiosParent.Layout = layout; tool_bar.Add(radiosParent); toggle = new RadioButtonGroup(); for (int i = 0; i < 3; i++) { radios[i] = new RadioButton(); radios[i].Size = new Size(37, 34); toggle.Add(radios[i]); radiosParent.Add(radios[i]); } var radioStyle = radios[0].Style; radioStyle.Icon.BackgroundImage = new Selector <string>() { Normal = EFFECT_WAVE_IMAGE, Selected = EFFECT_WAVE_IMAGE_SELECTED }; radios[0].ApplyStyle(radioStyle); radioStyle = radios[1].Style; radioStyle.Icon.BackgroundImage = new Selector <string>() { Normal = EFFECT_CROSS_IMAGE, Selected = EFFECT_CROSS_IMAGE_SELECTED }; radios[1].ApplyStyle(radioStyle); radioStyle = radios[2].Style; radioStyle.Icon.BackgroundImage = new Selector <string>() { Normal = EFFECT_FOLD_IMAGE, Selected = EFFECT_FOLD_IMAGE_SELECTED }; radios[2].ApplyStyle(radioStyle); radios[0].SelectedChanged += OnWaveClicked; radios[1].SelectedChanged += OnCrossClicked; radios[2].SelectedChanged += OnFoldClicked; radios[0].IsSelected = true; // load image mCurrentTexture = LoadStageFillingTexture(IMAGES[mIndex]); // content layer is 3D. content_layer = new Layer(); content_layer.Behavior = Layer.LayerBehavior.Layer3D; NUIApplication.GetDefaultWindow().AddLayer(content_layer); //use small cubes mCubeWaveEffect = new CubeTransitionWaveEffect(NUM_ROWS_WAVE, NUM_COLUMNS_WAVE); mCubeWaveEffect.SetTransitionDuration(ANIMATION_DURATION_WAVE); mCubeWaveEffect.SetCubeDisplacement(CUBE_DISPLACEMENT_WAVE); mCubeWaveEffect.TransitionCompleted += OnCubeEffectCompleted; mCubeWaveEffect.Position2D = new Position2D(0, tool_bar.Size2D.Height); mCubeWaveEffect.Size2D = new Size2D(NUIApplication.GetDefaultWindow().WindowSize.Width, NUIApplication.GetDefaultWindow().WindowSize.Height - tool_bar.Size2D.Height); mCubeWaveEffect.PivotPoint = PivotPoint.TopLeft; mCubeWaveEffect.ParentOrigin = ParentOrigin.TopLeft; mCubeWaveEffect.SetCurrentTexture(mCurrentTexture); // use big cubes mCubeCrossEffect = new CubeTransitionCrossEffect(NUM_ROWS_CROSS, NUM_COLUMNS_CROSS); mCubeCrossEffect.SetTransitionDuration(ANIMATION_DURATION_CROSS); mCubeCrossEffect.SetCubeDisplacement(CUBE_DISPLACEMENT_CROSS); mCubeCrossEffect.TransitionCompleted += OnCubeEffectCompleted; mCubeCrossEffect.Position2D = new Position2D(0, tool_bar.Size2D.Height); mCubeCrossEffect.Size2D = new Size2D(NUIApplication.GetDefaultWindow().WindowSize.Width, NUIApplication.GetDefaultWindow().WindowSize.Height - tool_bar.Size2D.Height); mCubeCrossEffect.PivotPoint = PivotPoint.TopLeft; mCubeCrossEffect.ParentOrigin = ParentOrigin.TopLeft; mCubeCrossEffect.SetCurrentTexture(mCurrentTexture); mCubeFoldEffect = new CubeTransitionFoldEffect(NUM_ROWS_FOLD, NUM_COLUMNS_FOLD); mCubeFoldEffect.SetTransitionDuration(ANIMATION_DURATION_FOLD); mCubeFoldEffect.TransitionCompleted += OnCubeEffectCompleted; mCubeFoldEffect.Position2D = new Position2D(0, tool_bar.Size2D.Height); mCubeFoldEffect.Size2D = new Size2D(NUIApplication.GetDefaultWindow().WindowSize.Width, NUIApplication.GetDefaultWindow().WindowSize.Height - tool_bar.Size2D.Height); mCubeFoldEffect.PivotPoint = PivotPoint.TopLeft; mCubeFoldEffect.ParentOrigin = ParentOrigin.TopLeft; mCubeFoldEffect.SetCurrentTexture(mCurrentTexture); mViewTimer = new Timer(VIEWINGTIME); mViewTimer.Tick += OnTimerTick; // content mCurrentEffect = mCubeWaveEffect; mContent = new View(); mContent.Size2D = new Size2D(NUIApplication.GetDefaultWindow().WindowSize.Width, NUIApplication.GetDefaultWindow().WindowSize.Height - tool_bar.Size2D.Height); mContent.ParentOrigin = ParentOrigin.TopLeft; mContent.PositionUsesPivotPoint = true; mContent.PivotPoint = PivotPoint.TopLeft; mContent.Add(mCurrentEffect); content_layer.Add(mContent); mPanGestureDetector = new PanGestureDetector(); mPanGestureDetector.Detected += OnPanGesture; mPanGestureDetector.Attach(mContent); }
public Box(Size2D boxSize, string boxTitle, string imageUrl) { this.Size2D = boxSize; this.Margin = new Extents(0, 0, 20, 20); this.BackgroundColor = Color.Magenta; title = new TextLabel(boxTitle); title.Size2D = new Size2D(boxSize.Width, GetRatio(20, boxSize.Height)); title.Position2D = new Position2D(0, 0); title.MultiLine = true; title.BackgroundColor = Color.Blue; title.TextColor = Color.Yellow; this.Add(title); image = new AnimatedImageView(); image.Size2D = new Size2D(boxSize.Width, GetRatio(50, boxSize.Height)); image.Position2D = new Position2D(0, title.Size2D.Height); image.ResourceUrl = imageUrl; image.Play(); this.Add(image); status = new TextLabel("Initialized"); status.Size2D = new Size2D(boxSize.Width, GetRatio(20, boxSize.Height)); status.Position2D = new Position2D(0, image.Position2D.Y + image.Size2D.Height); status.MultiLine = true; status.BackgroundColor = Color.White; status.PointSize = 20; this.Add(status); ButtonStyle aStyle = new ButtonStyle { IsSelectable = true, BackgroundImage = new Selector <string> { Normal = CommonResource.GetFHResourcePath() + "3. Button/[Button] App Primary Color/rectangle_toggle_btn_normal_24c447.png", Selected = CommonResource.GetFHResourcePath() + "3. Button/[Button] App Primary Color/rectangle_point_btn_normal_24c447.png", }, BackgroundImageBorder = new Selector <Rectangle> { All = new Rectangle(5, 5, 5, 5) }, ImageShadow = new ImageShadow { Url = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_shadow.png", Border = new Rectangle(5, 5, 5, 5) }, Overlay = new ImageViewStyle { ResourceUrl = new Selector <string> { Pressed = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_press_overlay.png", Other = "" }, Border = new Selector <Rectangle> { All = new Rectangle(5, 5, 5, 5) }, }, Text = new TextLabelStyle { PointSize = new Selector <float?> { All = 20 }, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, WidthResizePolicy = ResizePolicyType.FillToParent, HeightResizePolicy = ResizePolicyType.FillToParent, TextColor = new Selector <Color> { Normal = new Color(0.141f, 0.769f, 0.278f, 1), Selected = new Color(1, 1, 1, 1), }, } }; but1 = new Button(aStyle); but1.Size2D = new Size2D(GetRatio(32, boxSize.Width), GetRatio(10, boxSize.Height)); but1.PositionUsesPivotPoint = true; but1.ParentOrigin = Tizen.NUI.ParentOrigin.BottomLeft; but1.PivotPoint = Tizen.NUI.ParentOrigin.BottomLeft; but1.Style.Text.Text = new Selector <string> { Normal = "Button1 Normal", Selected = "Button1 Selected", Disabled = "Button2 Disabled", }; this.Add(but1); but2 = new Button(aStyle); but2.Size2D = new Size2D(GetRatio(32, boxSize.Width), GetRatio(10, boxSize.Height)); but2.PositionUsesPivotPoint = true; but2.ParentOrigin = Tizen.NUI.ParentOrigin.BottomCenter; but2.PivotPoint = Tizen.NUI.ParentOrigin.BottomCenter; but2.Style.Text.Text = new Selector <string> { Normal = "Button2 Normal", Selected = "Button2 Selected", Disabled = "Button2 Disabled", }; this.Add(but2); but3 = new Button(aStyle); but3.Size2D = new Size2D(GetRatio(32, boxSize.Width), GetRatio(10, boxSize.Height)); but3.PositionUsesPivotPoint = true; but3.ParentOrigin = Tizen.NUI.ParentOrigin.BottomRight; but3.PivotPoint = Tizen.NUI.ParentOrigin.BottomRight; but3.Style.Text.Text = new Selector <string> { Normal = "Button3 Normal", Selected = "Button3 Selected", Disabled = "Button2 Disabled", }; this.Add(but3); }
public static void SetButtonStyle(DependencyObject obj, ButtonStyle value) { obj.SetValue(ButtonStyleProperty, value); }
public override void OnCreate(View root) { var buttonStyle1 = new ButtonStyle() { Size = new Size(160, 100), BackgroundColor = Color.Blue, Text = new TextLabelStyle { TextColor = Color.Black, PixelSize = 16, }, Icon = new ImageViewStyle { ResourceUrl = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "image.jpg", Size = new Size(30, 30) }, ThemeChangeSensitive = true, }; var buttonStyle2 = new ButtonStyle() { Size = new Size(120, 120), BackgroundColor = Color.Red, Text = new TextLabelStyle { TextColor = Color.White, PixelSize = 18, }, Icon = new ImageViewStyle { ResourceUrl = "", Size = new Size(0, 0) }, ThemeChangeSensitive = true, }; theme1 = new Theme(); theme1.AddStyle("Button1", buttonStyle1); theme1.AddStyle("Button2", buttonStyle2); theme2 = new Theme(); theme2.AddStyle("Button1", buttonStyle2); theme2.AddStyle("Button2", buttonStyle1); theme3 = new Theme(); buttonStyle2.BackgroundColor = Color.Yellow; buttonStyle2.Text.TextColor = Color.Black; theme3.AddStyle("Button1", buttonStyle2); ThemeManager.ApplyTheme(theme1); var button = new Button("Button1") { Text = "A" }; root.Add(button); var button1 = new Button("Button2") { Position = new Position(170, 0), Text = "B" }; root.Add(button1); var button2 = new Button("Button1") { Position = new Position(0, 130), Text = "C" }; root.Add(button2); var button3 = new Button("Button2") { Position = new Position(170, 130), Text = "D" }; root.Add(button3); var button4 = new Button("Button1") { Position = new Position(0, 260), ThemeChangeSensitive = false, Text = "E" }; root.Add(button4); button.Clicked += OnClicked; }
public MvcHtmlString Button(string text, ButtonStyle style = ButtonStyle.Default) { return Button(text, "", style, ButtonType.Button); }
/// <summary> /// Update the state objects to reflect the new color button style. /// </summary> /// <param name="buttonStyle">New color button style.</param> protected virtual void SetStyles(ButtonStyle buttonStyle) { _stateCommon.SetStyles(buttonStyle); _stateDefault.SetStyles(buttonStyle); _stateFocus.SetStyles(buttonStyle); }
public MvcHtmlString SearchButton(string text, ButtonStyle style = ButtonStyle.Default, ButtonType type = ButtonType.Button) { return Button(text, GlyphIcons.SearchGlyphicon, style, type); }
/// <summary> /// Update the palette styles using a button style. /// </summary> /// <param name="buttonStyle">New button style.</param> public void SetStyles(ButtonStyle buttonStyle) { switch (buttonStyle) { case ButtonStyle.Standalone: SetStyles(PaletteBackStyle.ButtonStandalone, PaletteBorderStyle.ButtonStandalone, PaletteContentStyle.ButtonStandalone); break; case ButtonStyle.Alternate: SetStyles(PaletteBackStyle.ButtonAlternate, PaletteBorderStyle.ButtonAlternate, PaletteContentStyle.ButtonAlternate); break; case ButtonStyle.LowProfile: SetStyles(PaletteBackStyle.ButtonLowProfile, PaletteBorderStyle.ButtonLowProfile, PaletteContentStyle.ButtonLowProfile); break; case ButtonStyle.ButtonSpec: SetStyles(PaletteBackStyle.ButtonButtonSpec, PaletteBorderStyle.ButtonButtonSpec, PaletteContentStyle.ButtonButtonSpec); break; case ButtonStyle.BreadCrumb: SetStyles(PaletteBackStyle.ButtonBreadCrumb, PaletteBorderStyle.ButtonBreadCrumb, PaletteContentStyle.ButtonBreadCrumb); break; case ButtonStyle.CalendarDay: SetStyles(PaletteBackStyle.ButtonCalendarDay, PaletteBorderStyle.ButtonCalendarDay, PaletteContentStyle.ButtonCalendarDay); break; case ButtonStyle.Cluster: SetStyles(PaletteBackStyle.ButtonCluster, PaletteBorderStyle.ButtonCluster, PaletteContentStyle.ButtonCluster); break; case ButtonStyle.Gallery: SetStyles(PaletteBackStyle.ButtonGallery, PaletteBorderStyle.ButtonGallery, PaletteContentStyle.ButtonGallery); break; case ButtonStyle.NavigatorStack: SetStyles(PaletteBackStyle.ButtonNavigatorStack, PaletteBorderStyle.ButtonNavigatorStack, PaletteContentStyle.ButtonNavigatorStack); break; case ButtonStyle.NavigatorOverflow: SetStyles(PaletteBackStyle.ButtonNavigatorOverflow, PaletteBorderStyle.ButtonNavigatorOverflow, PaletteContentStyle.ButtonNavigatorOverflow); break; case ButtonStyle.NavigatorMini: SetStyles(PaletteBackStyle.ButtonNavigatorMini, PaletteBorderStyle.ButtonNavigatorMini, PaletteContentStyle.ButtonNavigatorMini); break; case ButtonStyle.InputControl: SetStyles(PaletteBackStyle.ButtonInputControl, PaletteBorderStyle.ButtonInputControl, PaletteContentStyle.ButtonInputControl); break; case ButtonStyle.ListItem: SetStyles(PaletteBackStyle.ButtonListItem, PaletteBorderStyle.ButtonListItem, PaletteContentStyle.ButtonListItem); break; case ButtonStyle.Form: SetStyles(PaletteBackStyle.ButtonForm, PaletteBorderStyle.ButtonForm, PaletteContentStyle.ButtonForm); break; case ButtonStyle.FormClose: SetStyles(PaletteBackStyle.ButtonFormClose, PaletteBorderStyle.ButtonFormClose, PaletteContentStyle.ButtonFormClose); break; case ButtonStyle.Command: SetStyles(PaletteBackStyle.ButtonCommand, PaletteBorderStyle.ButtonCommand, PaletteContentStyle.ButtonCommand); break; case ButtonStyle.Custom1: SetStyles(PaletteBackStyle.ButtonCustom1, PaletteBorderStyle.ButtonCustom1, PaletteContentStyle.ButtonCustom1); break; case ButtonStyle.Custom2: SetStyles(PaletteBackStyle.ButtonCustom2, PaletteBorderStyle.ButtonCustom2, PaletteContentStyle.ButtonCustom2); break; case ButtonStyle.Custom3: SetStyles(PaletteBackStyle.ButtonCustom3, PaletteBorderStyle.ButtonCustom3, PaletteContentStyle.ButtonCustom3); break; default: // Should never happen! Debug.Assert(false); break; } }
private void ResetButtonStyle() { ButtonStyle = ButtonStyle.Standalone; }
public ImageTextButtonStyle(ButtonStyle buttonStyle) : base(buttonStyle) { }
/// <summary> /// Initialize a new instance of the KryptonColorButton class. /// </summary> public KryptonColorButton() { // We generate click events manually, suppress default // production of them by the base Control class SetStyle(ControlStyles.StandardClick | ControlStyles.StandardDoubleClick, false); // Set default color button properties _style = ButtonStyle.Standalone; _visibleThemes = true; _visibleStandard = true; _visibleRecent = true; _visibleNoColor = true; _visibleMoreColors = true; _autoRecentColors = true; _schemeThemes = ColorScheme.OfficeThemes; _schemeStandard = ColorScheme.OfficeStandard; _selectedRect = new Rectangle(0, 12, 16, 4); _selectedColor = Color.Red; _emptyBorderColor = Color.DarkGray; _dialogResult = DialogResult.None; _useMnemonic = true; _maxRecentColors = 10; _recentColors = new List<Color>(); // Create the context menu items _kryptonContextMenu = new KryptonContextMenu(); _separatorTheme = new KryptonContextMenuSeparator(); _headingTheme = new KryptonContextMenuHeading("Theme Colors"); _colorsTheme = new KryptonContextMenuColorColumns(ColorScheme.OfficeThemes); _separatorStandard = new KryptonContextMenuSeparator(); _headingStandard = new KryptonContextMenuHeading("Standard Colors"); _colorsStandard = new KryptonContextMenuColorColumns(ColorScheme.OfficeStandard); _separatorRecent = new KryptonContextMenuSeparator(); _headingRecent = new KryptonContextMenuHeading("Recent Colors"); _colorsRecent = new KryptonContextMenuColorColumns(ColorScheme.None); _separatorNoColor = new KryptonContextMenuSeparator(); _itemNoColor = new KryptonContextMenuItem("&No Color", Properties.Resources.ButtonNoColor, new EventHandler(OnClickNoColor)); _itemsNoColor = new KryptonContextMenuItems(); _itemsNoColor.Items.Add(_itemNoColor); _separatorMoreColors = new KryptonContextMenuSeparator(); _itemMoreColors = new KryptonContextMenuItem("&More Colors...", new EventHandler(OnClickMoreColors)); _itemsMoreColors = new KryptonContextMenuItems(); _itemsMoreColors.Items.Add(_itemMoreColors); _kryptonContextMenu.Items.AddRange(new KryptonContextMenuItemBase[] { _separatorTheme, _headingTheme, _colorsTheme, _separatorStandard, _headingStandard, _colorsStandard, _separatorRecent, _headingRecent, _colorsRecent, _separatorNoColor, _itemsNoColor, _separatorMoreColors, _itemsMoreColors}); // Create content storage _buttonValues = CreateButtonValues(NeedPaintDelegate); _buttonValues.TextChanged += new EventHandler(OnButtonTextChanged); _images = new DropDownButtonImages(NeedPaintDelegate); // Image need an extra redirector to check the local images first _paletteDropDownButtonImages = new PaletteRedirectDropDownButton(Redirector, _images); // Create the palette storage _strings = new PaletteColorButtonStrings(); _stateCommon = new PaletteTripleRedirect(Redirector, PaletteBackStyle.ButtonStandalone, PaletteBorderStyle.ButtonStandalone, PaletteContentStyle.ButtonStandalone, NeedPaintDelegate); _stateDisabled = new PaletteTriple(_stateCommon, NeedPaintDelegate); _stateNormal = new PaletteTriple(_stateCommon, NeedPaintDelegate); _stateTracking = new PaletteTriple(_stateCommon, NeedPaintDelegate); _statePressed = new PaletteTriple(_stateCommon, NeedPaintDelegate); _stateDefault = new PaletteTripleRedirect(Redirector, PaletteBackStyle.ButtonStandalone, PaletteBorderStyle.ButtonStandalone, PaletteContentStyle.ButtonStandalone, NeedPaintDelegate); _stateFocus = new PaletteTripleRedirect(Redirector, PaletteBackStyle.ButtonStandalone, PaletteBorderStyle.ButtonStandalone, PaletteContentStyle.ButtonStandalone, NeedPaintDelegate); // Create the override handling classes _overrideFocus = new PaletteTripleOverride(_stateFocus, _stateNormal, PaletteState.FocusOverride); _overrideNormal = new PaletteTripleOverride(_stateDefault, _overrideFocus, PaletteState.NormalDefaultOverride); _overrideTracking = new PaletteTripleOverride(_stateFocus, _stateTracking, PaletteState.FocusOverride); _overridePressed = new PaletteTripleOverride(_stateFocus, _statePressed, PaletteState.FocusOverride); // Create the view color button instance _drawButton = new ViewDrawButton(_stateDisabled, _overrideNormal, _overrideTracking, _overridePressed, new PaletteMetricRedirect(Redirector), this, VisualOrientation.Top, UseMnemonic); // Set default color button state _drawButton.DropDown = true; _drawButton.Splitter = true; _drawButton.TestForFocusCues = true; _drawButton.DropDownPalette = _paletteDropDownButtonImages; // Create a color button controller to handle button style behaviour _buttonController = new ButtonController(_drawButton, NeedPaintDelegate); _buttonController.BecomesFixed = true; // Assign the controller to the view element to treat as a button _drawButton.MouseController = _buttonController; _drawButton.KeyController = _buttonController; _drawButton.SourceController = _buttonController; // Need to know when user clicks the button view or mouse selects it _buttonController.Click += new MouseEventHandler(OnButtonClick); _buttonController.MouseSelect += new MouseEventHandler(OnButtonSelect); // Create the view manager instance ViewManager = new ViewManager(this, _drawButton); }
/// <summary> /// Initialize a new instance of the KryptonDropButton class. /// </summary> public KryptonDropButton() { // We generate click events manually, suppress default // production of them by the base Control class SetStyle(ControlStyles.StandardClick | ControlStyles.StandardDoubleClick, false); // Set default button properties _style = ButtonStyle.Standalone; _dialogResult = DialogResult.None; _useMnemonic = true; // Create content storage _buttonValues = CreateButtonValues(NeedPaintDelegate); _buttonValues.TextChanged += new EventHandler(OnButtonTextChanged); _images = new DropDownButtonImages(NeedPaintDelegate); // Image need an extra redirector to check the local images first _paletteDropDownButtonImages = new PaletteRedirectDropDownButton(Redirector, _images); // Create the palette storage _stateCommon = new PaletteTripleRedirect(Redirector, PaletteBackStyle.ButtonStandalone, PaletteBorderStyle.ButtonStandalone, PaletteContentStyle.ButtonStandalone, NeedPaintDelegate); _stateDisabled = new PaletteTriple(_stateCommon, NeedPaintDelegate); _stateNormal = new PaletteTriple(_stateCommon, NeedPaintDelegate); _stateTracking = new PaletteTriple(_stateCommon, NeedPaintDelegate); _statePressed = new PaletteTriple(_stateCommon, NeedPaintDelegate); _stateDefault = new PaletteTripleRedirect(Redirector, PaletteBackStyle.ButtonStandalone, PaletteBorderStyle.ButtonStandalone, PaletteContentStyle.ButtonStandalone, NeedPaintDelegate); _stateFocus = new PaletteTripleRedirect(Redirector, PaletteBackStyle.ButtonStandalone, PaletteBorderStyle.ButtonStandalone, PaletteContentStyle.ButtonStandalone, NeedPaintDelegate); // Create the override handling classes _overrideFocus = new PaletteTripleOverride(_stateFocus, _stateNormal, PaletteState.FocusOverride); _overrideNormal = new PaletteTripleOverride(_stateDefault, _overrideFocus, PaletteState.NormalDefaultOverride); _overrideTracking = new PaletteTripleOverride(_stateFocus, _stateTracking, PaletteState.FocusOverride); _overridePressed = new PaletteTripleOverride(_stateFocus, _statePressed, PaletteState.FocusOverride); // Create the view button instance _drawButton = new ViewDrawButton(_stateDisabled, _overrideNormal, _overrideTracking, _overridePressed, new PaletteMetricRedirect(Redirector), this, VisualOrientation.Top, UseMnemonic); // Set default button state _drawButton.DropDown = true; _drawButton.Splitter = true; _drawButton.TestForFocusCues = true; _drawButton.DropDownPalette = _paletteDropDownButtonImages; // Create a button controller to handle button style behaviour _buttonController = new ButtonController(_drawButton, NeedPaintDelegate); _buttonController.BecomesFixed = true; // Assign the controller to the view element to treat as a button _drawButton.MouseController = _buttonController; _drawButton.KeyController = _buttonController; _drawButton.SourceController = _buttonController; // Need to know when user clicks the button view or mouse selects it _buttonController.Click += new MouseEventHandler(OnButtonClick); _buttonController.MouseSelect += new MouseEventHandler(OnButtonSelect); // Create the view manager instance ViewManager = new ViewManager(this, _drawButton); }
/// <summary> /// Update the state objects to reflect the new button style. /// </summary> /// <param name="buttonStyle">New button style.</param> protected virtual void SetStyles(ButtonStyle buttonStyle) { _stateCommon.SetStyles(buttonStyle); _stateDefault.SetStyles(buttonStyle); _stateFocus.SetStyles(buttonStyle); }
/// <summary> /// Convert from ButtonStyle to PaletteButtonStyle. /// </summary> /// <param name="style">ButtonStyle to convert.</param> /// <returns>PaletteButtonStyle enumeration value.</returns> public static PaletteButtonStyle ButtonStyleToPalette(ButtonStyle style) { switch (style) { case ButtonStyle.Standalone: return PaletteButtonStyle.Standalone; case ButtonStyle.Alternate: return PaletteButtonStyle.Alternate; case ButtonStyle.LowProfile: return PaletteButtonStyle.LowProfile; case ButtonStyle.ButtonSpec: return PaletteButtonStyle.ButtonSpec; case ButtonStyle.BreadCrumb: return PaletteButtonStyle.BreadCrumb; case ButtonStyle.Cluster: return PaletteButtonStyle.Cluster; case ButtonStyle.NavigatorStack: return PaletteButtonStyle.NavigatorStack; case ButtonStyle.NavigatorOverflow: return PaletteButtonStyle.NavigatorOverflow; case ButtonStyle.NavigatorMini: return PaletteButtonStyle.NavigatorMini; case ButtonStyle.InputControl: return PaletteButtonStyle.InputControl; case ButtonStyle.ListItem: return PaletteButtonStyle.ListItem; case ButtonStyle.Form: return PaletteButtonStyle.Form; case ButtonStyle.FormClose: return PaletteButtonStyle.FormClose; case ButtonStyle.Command: return PaletteButtonStyle.Command; case ButtonStyle.Custom1: return PaletteButtonStyle.Custom1; case ButtonStyle.Custom2: return PaletteButtonStyle.Custom2; case ButtonStyle.Custom3: return PaletteButtonStyle.Custom3; default: // Should never happen! Debug.Assert(false); return PaletteButtonStyle.Standalone; } }
/// <summary> /// Update the combo box item style. /// </summary> /// <param name="style">New item style.</param> public void SetStyles(ButtonStyle style) { Item.SetStyles(style); }
public static MvcHtmlString KingSelectUsers(this HtmlHelper helper, string name, string text = null, DataType DataType = DataType.All, string JSCallBackMethod = null, ButtonStyle buttonStyle = 0, SelectType selectType = SelectType.Single, bool Required = false, string value = null, int?currentUserID = new int?(), Type t = null, object parameter = null) { SelectUsersModel model = new SelectUsersModel { Name = name }; helper.RenderPartial("~/Views/ControlScripts/_SelectUsersScripts.cshtml", model); return(GetSelectUserHtml(helper, name, text, DataType, JSCallBackMethod, buttonStyle, selectType, Required, value, currentUserID, t, parameter)); }
public DiscordButtonWithCallback(DiscordClient client, ButtonStyle style, string customId, string label, DiscordComponentEmoji emoji, Func <DiscordFollowupMessageBuilder> followup) : this(client, new DiscordButtonComponent(style, customId, label, emoji : emoji)) { _followup = followup; }