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


C# Style类代码示例

本文整理汇总了C#中Style的典型用法代码示例。如果您正苦于以下问题:C# Style类的具体用法?C# Style怎么用?C# Style使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: ContainsStyle

        public static bool ContainsStyle(Style style, System.Collections.ArrayList styles) {
            foreach (Style s in styles)
                if (s == style)
                    return true;

            return false;
        }
开发者ID:danielskowronski,项目名称:network-max-flow-demo,代码行数:7,代码来源:DrawingEnums.cs

示例2: HeaderPrint

        public static string HeaderPrint(string s, Style style)
        {
            if (s.Length > Stars.Length - 2)
                throw new Exception("Update HeaderPrinter");

            switch (style)
            {
                case Style.Left:
                    return string.Format(
                        "*{0}{1}*",
                        s, Pad(Stars.Length - s.Length - 2));
                case Style.CenterCaps:
                {
                    var totalPad = Stars.Length - 2 - s.Length;

                    var leftPad = totalPad/2;
                    var rightPad = totalPad - leftPad;

                    return string.Format(
                        "*{0}{1}{2}*",
                        Pad(leftPad), s.ToUpper(), Pad(rightPad));
                }

                default:
                    throw new NotImplementedException("Update HeaderPrinter");
            }
        }
开发者ID:ppittle,项目名称:AppInternalsDotNetSampler,代码行数:27,代码来源:HeaderPrinter.cs

示例3: SetRandomWallpaperFromPath

        public static void SetRandomWallpaperFromPath(FileInfo file, Style style)
        {
            if (file == null) return;

            SystemParametersInfo(SetDesktopWallpaper, 0, file.ToString(), UpdateIniFile | SendWinIniChange);
            var key = Registry.CurrentUser.OpenSubKey("Control Panel\\Desktop", true);

            if (key == null) return;

            switch (style)
            {
                case Style.Stretch:
                    key.SetValue(@"WallpaperStyle", "2");
                    key.SetValue(@"TileWallpaper", "0");
                    break;
                case Style.Center:
                    key.SetValue(@"WallpaperStyle", "1");
                    key.SetValue(@"TileWallpaper", "0");
                    break;
                case Style.Tile:
                    key.SetValue(@"WallpaperStyle", "1");
                    key.SetValue(@"TileWallpaper", "1");
                    break;
                case Style.NoChange:
                    break;
            }

            key.Close();
        }
开发者ID:andersosthus,项目名称:WallpaperChanger,代码行数:29,代码来源:Wallpaper.cs

示例4: Set

        /// <summary>
        /// Set desktop wallpaper
        /// </summary>
        /// <param name="img">Image data</param>
        /// <param name="style">Style of wallpaper</param>
        public static void Set(System.Drawing.Image img, Style style)
        {
            try
            {
                string tempPath = Path.Combine(Path.GetTempPath(), "imageglass.jpg");
                img.Save(tempPath, System.Drawing.Imaging.ImageFormat.Jpeg);

                RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Control Panel\Desktop", true);
                if (key == null)
                    return;

                if (style == Style.Stretched)
                {
                    key.SetValue(@"WallpaperStyle", "2");
                    key.SetValue(@"TileWallpaper", "0");
                }

                if (style == Style.Centered)
                {
                    key.SetValue(@"WallpaperStyle", "1");
                    key.SetValue(@"TileWallpaper", "0");
                }

                if (style == Style.Tiled)
                {
                    key.SetValue(@"WallpaperStyle", "1");
                    key.SetValue(@"TileWallpaper", "1");
                }

                SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, tempPath, SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE);
            }
            catch (Exception) { }
        }
开发者ID:RazvanSt,项目名称:ImageGlass,代码行数:38,代码来源:DesktopWallapaper.cs

示例5: SetStyle

 public void SetStyle(Style style)
 {
     _officeColorTable = StyleBuilderFactory.GetOffice2007ColorTable(style);
     this.BorderColor=_officeColorTable.TextBoxBorderColor;
     //_startPaint = true;
     this.Refresh();
 }
开发者ID:GarnettLuo,项目名称:XiaoCai.WinformUI,代码行数:7,代码来源:TextBoxW.cs

示例6: TreeControl

        /// <summary>
        /// Constructor of a tree control with a particular style and renderer</summary>
        /// <param name="style">Tree style</param>
        /// <param name="itemRenderer">Renderer of a node in the tree. If null, then a new
        /// TreeItemRenderer is created and used</param>
        public TreeControl(Style style, TreeItemRenderer itemRenderer)
        {
            m_style = style;
            if (m_style == Style.CategorizedPalette)
                m_showRoot = false;

            m_root = new Node(this, null, null);

            m_dragHoverExpandTimer = new Timer();
            m_dragHoverExpandTimer.Interval = 1000; // 1 second delay for drag hover expand
            m_dragHoverExpandTimer.Tick += DragHoverTimerTick;

            m_autoScrollTimer = new Timer();
            m_autoScrollTimer.Interval = 200; // 5 Hz auto scroll rate
            m_autoScrollTimer.Tick += AutoScrollTimerTick;

            m_editLabelTimer = new Timer();
            m_editLabelTimer.Tick += EditLabelTimerTick;

            m_averageRowHeight = FontHeight + Margin.Top;

            SuspendLayout();

            m_textBox = new TextBox();
            m_textBox.Visible = false;
            m_textBox.BorderStyle = BorderStyle.None;

            m_textBox.KeyDown += TextBoxKeyDown;
            m_textBox.KeyPress += TextBoxKeyPress;
            m_textBox.LostFocus += TextBoxLostFocus;

            m_vScrollBar = new VScrollBar();
            m_vScrollBar.Dock = DockStyle.Right;
            m_vScrollBar.SmallChange = m_averageRowHeight;
            m_vScrollBar.ValueChanged += VerticalScrollBarValueChanged;

            m_hScrollBar = new HScrollBar();
            m_hScrollBar.Dock = DockStyle.Bottom;
            m_vScrollBar.SmallChange = 8;
            m_hScrollBar.ValueChanged += HorizontalScrollBarValueChanged;

            Controls.Add(m_vScrollBar);
            Controls.Add(m_hScrollBar);
            Controls.Add(m_textBox);

            ResumeLayout();

            BackColor = SystemColors.Window;

            base.DoubleBuffered = true;

            SetStyle(ControlStyles.ResizeRedraw, true);

            if (itemRenderer == null)
                itemRenderer = new TreeItemRenderer();
            ItemRenderer = itemRenderer;

            m_filterImage = ResourceUtil.GetImage16(Resources.FilterImage) as Bitmap;
            m_toolTip = new ToolTip();
        }
开发者ID:GeertVL,项目名称:ATF,代码行数:65,代码来源:TreeControl.cs

示例7: DrawContent

        protected override void DrawContent(int left, int top, int width, int height, Style cStyle)
        {
            if (_image == null) return;

            int imgWidth = _image.Width, imgHeight = _image.Height;
            _desktopOwner._screenBuffer.DrawImage(left + (width - imgWidth) / 2, top + (height - imgHeight) / 2, _image, 0, 0, imgWidth, imgHeight, _enabled ? (ushort)256 : (ushort)100);
        }
开发者ID:andrei-tatar,项目名称:MediaPlayer.NETMF,代码行数:7,代码来源:ImageButton.cs

示例8: Chart

       public Chart() : base ()
       {
         //SetStyle(ControlStyles.OptimizedDoubleBuffer, true); //the PlotPane is already dbl buffered
         SetStyle(ControlStyles.UserPaint, true);
         SetStyle(ControlStyles.AllPaintingInWmPaint, true); //no ERASE BACKGROUND
         
         SetStyle(ControlStyles.UserMouse, true);

         
         UpdateStyles();
         
         m_Style = new Style(this, null);
         m_RulerStyle = new Style(this, null);
         m_PlotStyle = new Style(this, null);
         
         BuildDefaultStyle(m_Style);
         BuildDefaultRulerStyle(m_RulerStyle);
         BuildDefaultPlotStyle(m_PlotStyle);
         
         
         m_ControllerNotificationTimer = new Timer();
         m_ControllerNotificationTimer.Interval = REBUILD_TIMEOUT_MS;
         m_ControllerNotificationTimer.Enabled = false;
         m_ControllerNotificationTimer.Tick += new EventHandler((o, e) =>
                                                       {
                          //todo ETO NUJNO DLYA DRAG/DROP   if (m_RepositioningColumn!=null || m_ResizingColumn!=null ) return;//while grid is being manipulated dont flush timer just yet
                                                       
                                                        m_ControllerNotificationTimer.Stop(); 
                                                        notifyAndRebuildChart();
                                                       });
       }
开发者ID:vlapchenko,项目名称:nfx,代码行数:31,代码来源:Chart.cs

示例9: Set

        public static void Set(string fileName, Style style)
        {
            string filePath = Path.Combine("Images", fileName);
            Image image = Image.FromFile(filePath, true);
            string tempPath = Path.Combine(Path.GetTempPath(), fileName);
            image.Save(tempPath, System.Drawing.Imaging.ImageFormat.Bmp);

            RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Control Panel\Desktop", true);
            if (style == Style.Stretched)
            {
                key.SetValue(@"WallpaperStyle", 2.ToString());
                key.SetValue(@"TileWallpaper", 0.ToString());
            }

            if (style == Style.Centered)
            {
                key.SetValue(@"WallpaperStyle", 1.ToString());
                key.SetValue(@"TileWallpaper", 0.ToString());
            }

            if (style == Style.Tiled)
            {
                key.SetValue(@"WallpaperStyle", 1.ToString());
                key.SetValue(@"TileWallpaper", 1.ToString());
            }

            SystemParametersInfo(SPI_SETDESKWALLPAPER,
                0,
                tempPath,
                SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE);
        }
开发者ID:Oberheim,项目名称:WallpaperChanger,代码行数:31,代码来源:WallpaperChanger.cs

示例10: StyleListBox

		public StyleListBox(IStyleSet styleSet, Style style, bool showDefaultStyleItem, bool showOpenDesignerItem) :
			this()
		{
			if (styleSet == null) throw new ArgumentNullException("design");
			if (style == null) throw new ArgumentNullException("style");
			Initialize(styleSet, showDefaultStyleItem, showOpenDesignerItem, style.GetType(), style);
		}
开发者ID:stewmc,项目名称:vixen,代码行数:7,代码来源:StyleListBox.cs

示例11: HandleStartElement

        protected override void HandleStartElement(XmlNodeInformation nodeInfo)
        {
            if (nodeInfo.Is(NamespaceId.w, NormalizedVersion("style")))
            {
                Style newStyle = new Style(nodeInfo);
                newStyle.StyleType = nodeInfo.GetAttributeValue(NormalizedVersion("type"));
                m_styles.Add(newStyle.Id, newStyle);
                m_activeStyle = newStyle;
                m_bSendAllToActiveStyle = false;
            }
            else if (nodeInfo.Is(NamespaceId.w, NormalizedVersion("basedOn")))
            {
                m_activeStyle.BasedOn = nodeInfo.GetAttributeValue(NormalizedVersion("val"));
            }
            else if (nodeInfo.Is(NamespaceId.w, NormalizedVersion("name")))
            {
                m_activeStyle.Name = nodeInfo.GetAttributeValue(NormalizedVersion("val"));
            }
            else if (nodeInfo.Is(NamespaceId.w, NormalizedVersion("rPr")))
            {
                m_bSendAllToActiveStyle = true;
            }
            else if (m_bSendAllToActiveStyle)
            {
                if (m_activeStyle != null)
                {
                    nodeInfo.GetAttributes(); // force them to be loaded
                    m_activeStyle.AddProperty(nodeInfo);
                }

            }

        }
开发者ID:killbug2004,项目名称:WSProf,代码行数:33,代码来源:StyleSheet.cs

示例12: Set

        public static void Set(string uri, Style style)
        {
            System.IO.Stream s = new System.Net.WebClient().OpenRead(uri);

            System.Drawing.Image img = System.Drawing.Image.FromStream(s);
            string tempPath = Path.Combine(Path.GetTempPath(), "wallpaper.bmp");
            img.Save(tempPath, System.Drawing.Imaging.ImageFormat.Bmp);

            RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Control Panel\Desktop", true);
            if (style == Style.Stretched)
            {
                key.SetValue(@"WallpaperStyle", 2.ToString());
                key.SetValue(@"TileWallpaper", 0.ToString());
            }

            if (style == Style.Centered)
            {
                key.SetValue(@"WallpaperStyle", 1.ToString());
                key.SetValue(@"TileWallpaper", 0.ToString());
            }

            if (style == Style.Tiled)
            {
                key.SetValue(@"WallpaperStyle", 1.ToString());
                key.SetValue(@"TileWallpaper", 1.ToString());
            }

            SystemParametersInfo(SPI_SETDESKWALLPAPER,
                0,
                tempPath,
                SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE);
        }
开发者ID:schulzetenberg,项目名称:LastFM-Album-Wallpaper,代码行数:32,代码来源:Wallpaper.cs

示例13: Set

        public static void Set(String uri, Style style)
        {
            System.Drawing.Image img = Image.FromStream(new System.Net.WebClient().OpenRead(uri.ToString()));

            // 将图片保存到本地目录
            img.Save(Environment.GetEnvironmentVariable("Temp") + "\\" + ImageName, System.Drawing.Imaging.ImageFormat.Bmp);

            RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Control Panel\Desktop", true);
            if (style == Style.Stretched)
            {
                key.SetValue(@"WallpaperStyle", 2.ToString());
                key.SetValue(@"TileWallpaper", 0.ToString());
            }
            else if (style == Style.Centered)
            {
                key.SetValue(@"WallpaperStyle", 1.ToString());
                key.SetValue(@"TileWallpaper", 0.ToString());
            }
            else if (style == Style.Tiled)
            {
                key.SetValue(@"WallpaperStyle", 1.ToString());
                key.SetValue(@"TileWallpaper", 1.ToString());
            }

            // 设置桌面壁纸的API
            SystemParametersInfo(SPI_SETDESKWALLPAPER
                                , 0
                                , Environment.GetEnvironmentVariable("Temp") + "\\" + ImageName
                                , SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE);
        }
开发者ID:zhanghuihn,项目名称:BingWallpaper,代码行数:30,代码来源:Wallpaper.cs

示例14: SetWallPaper

        /// <summary>
        /// Sets wallpaper and style
        /// WinowsAPI Call
        /// </summary>
        /// <param name="image"></param>
        /// <param name="style"></param>
        public static void SetWallPaper(BitmapImage image, Style style)
        {
            if (image != null)
            {
                string tempPath = Path.Combine(Path.GetTempPath(), "wallpaper");

                //image.Save(tempPath, System.Drawing.Imaging.ImageFormat.Jpeg)
                JpegBitmapEncoder encoder = new JpegBitmapEncoder();

                try
                {
                    encoder.Frames.Add(BitmapFrame.Create(image));
                }
                catch { }

                using(Stream fs = new FileStream(tempPath, FileMode.Create))
                {
                    encoder.Save(fs);
                }

                SetWallPaperStyle(style);

                //Win API Call
                SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, tempPath, SPIF_UPDATEINIFILE | SPIF_SENDWINIINICHANGE);
            }
        }
开发者ID:jabaker88,项目名称:WebPaper,代码行数:32,代码来源:WinConfigWrapper.cs

示例15: Set

 public static void Set(Uri uri, Style style)
 {
     System.IO.Stream s = new WebClient().OpenRead(uri.ToString());
     //获取壁纸文件,传入到流
     System.Drawing.Image img = System.Drawing.Image.FromStream(s);
     //传入到image中
     string tempPath = Path.Combine(Path.GetTempPath(), "wallpaper.bmp");
     //将壁纸的存储地址设置为Temp目录,并且命名为wallpaper.bmp
     img.Save(tempPath, System.Drawing.Imaging.ImageFormat.Bmp);
     //保存为bmp文件
     RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Control Panel\Desktop", true);
     //打开注册表
     //判断壁纸设置的类型,并且将键值写入注册表
     if (style == Style.Stretched)
     {
         key.SetValue(@"WallpaperStyle", 2.ToString());
         key.SetValue(@"TileWallpaper", 0.ToString());
     }
     if (style == Style.Centered)
     {
         key.SetValue(@"WallpaperStyle", 1.ToString());
         key.SetValue(@"TileWallpaper", 0.ToString());
     }
     if (style == Style.Tiled)
     {
         key.SetValue(@"WallpaperStyle", 1.ToString());
         key.SetValue(@"TileWallpaper", 1.ToString());
     }
     //调用方法设置壁纸
     SystemParametersInfo(SPI_SETDESKWALLPAPER,
         0,
         tempPath,
         SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE);
 }
开发者ID:Hsiny,项目名称:BingWallpaper,代码行数:34,代码来源:Wallpaper.cs


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