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


C# VisualStyleRenderer.DrawEdge方法代码示例

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


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

示例1: SimpleStyleRenderer_Paint

		private void SimpleStyleRenderer_Paint(object sender, PaintEventArgs e)
		{
			VisualStyleElement element = VisualStyleElement.Button.CheckBox.CheckedNormal;
			
			if (Application.RenderWithVisualStyles &&
				VisualStyleRenderer.IsElementDefined(element))
			{
				VisualStyleRenderer renderer = new VisualStyleRenderer(element);
				Rectangle rectCheck = new Rectangle(10, 10, 50, 50);
				Rectangle rectBox = new Rectangle(10, 10, 200, 50);
				Rectangle rectText = new Rectangle(50, 25, 150, 25);
				renderer.DrawBackground(e.Graphics, rectCheck);
				renderer.DrawEdge(e.Graphics, rectBox, 
					Edges.Bottom | Edges.Top | Edges.Left | Edges.Right,
					EdgeStyle.Etched, EdgeEffects.Flat);
				renderer.DrawText(e.Graphics, rectText, "Styled checkbox", false, TextFormatFlags.Top);
			}
			else
			{
				// (Perform ControlPaint drawing here.)
			}

		}
开发者ID:ehershey,项目名称:development,代码行数:23,代码来源:SimpleStyleRenderer.cs

示例2: DrawHorizontalTicks

		public static void DrawHorizontalTicks(Graphics g, Rectangle bounds, int numTicks, EdgeStyle edgeStyle)
		{
			if (!IsSupported)
				throw new InvalidOperationException ();

			if (bounds.Height <= 0 || bounds.Width <= 0 || numTicks <= 0)
				return;
				
			VisualStyleRenderer vsr = new VisualStyleRenderer (VisualStyleElement.TrackBar.Ticks.Normal);
			
			double x = bounds.Left;
			double delta = (double)(bounds.Width - 2) / (double)(numTicks-1);
			
			for(int i = 0; i < numTicks; i++)
			{
				vsr.DrawEdge(g, new Rectangle((int)Math.Round(x), bounds.Top, 5, bounds.Height), Edges.Left, edgeStyle, EdgeEffects.None);
				x += delta;
			}
		}
开发者ID:nagyist,项目名称:MonoMac.Windows.Form,代码行数:19,代码来源:TrackBarRenderer.cs

示例3: Form1_Load

        private void Form1_Load(object sender, EventArgs e)
        {
            // Form Settings

            this.Icon = Properties.Resources.WhyNs_Stream_Watcher_Icon_32x32;

            // Top Bar Settings

            VisualStyleRenderer renderer = new VisualStyleRenderer(VisualStyleElement.TextBox.TextEdit.Normal);
            panelTopbarMainForm.Paint += new PaintEventHandler(delegate (Object o, PaintEventArgs a) {

                renderer.DrawEdge(a.Graphics, panelTopbarMainForm.ClientRectangle,
                    Edges.Bottom, EdgeStyle.Raised, EdgeEffects.Flat);

            });

            panelTopbarMainForm.MouseDown   += new MouseEventHandler(delegate(Object o, MouseEventArgs a) { this.OnMouseDown(a); });
            panelTopbarMainForm.MouseUp     += new MouseEventHandler(delegate(Object o, MouseEventArgs a) { this.OnMouseUp(a); });
            panelTopbarMainForm.MouseMove   += new MouseEventHandler(delegate(Object o, MouseEventArgs a) { this.OnMouseMove (a); });

            tsmiMain.Text += " " + ApplicationInfo.Version;

            // Tray Icon ContextMenuStrip Settings

            ContextMenuStrip cmsTrayIcon = new ContextMenuStrip();

            cmsTrayIcon.Name = "cmsTrayIcon";

            cmsTrayIcon.Items.Add("Restore", null, new EventHandler(restoreForm));
            cmsTrayIcon.Items.Add("Exit", null, new EventHandler(delegate (Object o, EventArgs a) {

                appExit();

            }));

            // Tray Icon Settings

            notifyIconMain.Icon = Properties.Resources.WhyNs_Stream_Watcher_Icon_16x16;
            notifyIconMain.ContextMenuStrip = cmsTrayIcon;
            notifyIconMain.Text = this.Text;
            notifyIconMain.MouseDoubleClick += new MouseEventHandler(restoreForm);

            // View Settings
            tsmiShowOfflineStreams.Checked = Properties.Settings.Default.ShowOfflineStreams;

            // Creating Pages

            pageStreams = new Streams(ui);
            pageSettings = new Settings(ui);
            pageAbout = new About(ui);

            // Adding Pages to Form (Should be hidden)

            this.Controls.Add(pageStreams.GetPageControl());
            this.Controls.Add(pageSettings.GetPageControl());
            this.Controls.Add(pageAbout.GetPageControl());

            // Setting Main Default Page

            ui.SetMainPage(pageStreams);

            // Load Default Page
            ui.ShowPage(this.pageStreams);

            // Hide Application to tray at launch if settings is true
            if (Properties.Settings.Default.TrayOnLaunch)
            {

                formToTray();

            }
        }
开发者ID:WhyN92,项目名称:WhyNsStreamWatcher,代码行数:72,代码来源:formMain.cs


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