當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。