当前位置: 首页>>代码示例>>C#>>正文


C# Xwt.GetType方法代码示例

本文整理汇总了C#中Xwt.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# Xwt.GetType方法的具体用法?C# Xwt.GetType怎么用?C# Xwt.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Xwt的用法示例。


在下文中一共展示了Xwt.GetType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ApplyStyle

        /// <summary>Apply the specified selector (style) to the specified widget</summary>
        /// <param name="Widget">The widget that should "got" the style</param>
        /// <param name="Style">The specified selector with the desired style</param>
        public void ApplyStyle(Xwt.Widget Widget, string Pattern)
        {
            if (Widget.GetType() == typeof(Xwt.Label)) { ApplyStyle((Xwt.Label)Widget, Pattern); return; }
            if (Widget.GetType() == typeof(Xwt.Box)) { ApplyStyle((Xwt.Box)Widget, Pattern); return; }

            Selector Selector = CSS[Pattern];

            if (Selector.Declarations["background-color"].Value != "inherit")
            Widget.BackgroundColor =
            Utilities.GetXwtColor(
                Selector.Declarations["background-color"].Value
            );

            if (Selector.Declarations["font-family"].Value != "inherit")
            Widget.Font = Xwt.Drawing.Font.FromName(
                Selector.Declarations["font-family"].Value
            );

            Widget.Visible = Selector.Declarations["display"].Value == "none" ? false : true;
        }
开发者ID:kekekeks,项目名称:fcmd,代码行数:23,代码来源:Stylist.cs

示例2: Stylize

        /// <summary>Enable theming of the widget</summary>
        /// <param name="Widget">The widget that needs to be themized</param>
        /// <param name="Selector">The selector pattern</param>
        public void Stylize(Xwt.Widget Widget, string Selector = "Widget")
        {
            if (!semaphore) {
                semaphore = true;
                Stylize(Widget, "Widget"); //apply default style for all widgets
                try {
                    Stylize(Widget, Widget.GetType().ToString().Substring(Widget.GetType().ToString().IndexOf('.') + 1)); //apply default style for the widget type
                }
                catch { Console.WriteLine("NOTICE: No style is set for widgets of type " + Widget.GetType().ToString().Substring(Widget.GetType().ToString().IndexOf('.') + 1)); }
                semaphore = false;
            }

            ApplyStyle(Widget, Selector);

            Widget.MouseEntered+=(o,ea)=>
            { ApplyStyle(Widget, Selector + ":hover"); };

            Widget.MouseExited+=(o,ea)=>
            {
                ApplyStyle(Widget, Selector);
                if (Widget.HasFocus)
                    ApplyStyle(Widget, Selector + ":focus");
            };

            Widget.ButtonPressed+=(o,ea)=>
            { ApplyStyle(Widget, Selector + ":active"); };

            Widget.GotFocus+=(o,ea)=>
            { ApplyStyle(Widget, Selector + ":focus"); };

            Widget.LostFocus += (o, ea) =>
            { ApplyStyle(Widget, Selector); };

            Widget.ButtonReleased+=(o,ea)=>
            {
                ApplyStyle(Widget, Selector);
                if (Widget.HasFocus)
                    ApplyStyle(Widget, Selector + ":focus");
            };
        }
开发者ID:kekekeks,项目名称:fcmd,代码行数:43,代码来源:Stylist.cs


注:本文中的Xwt.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。