本文整理汇总了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.)
}
}
示例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;
}
}
示例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();
}
}