Commit 1e44aa56 kwwwvagaa

重绘右键菜单

1 个父辈 c2dc238a
...@@ -132,6 +132,7 @@ namespace HZH_Controls.Controls ...@@ -132,6 +132,7 @@ namespace HZH_Controls.Controls
/// </summary> /// </summary>
/// <value>The current time.</value> /// <value>The current time.</value>
[Description("时间"), Category("自定义")] [Description("时间"), Category("自定义")]
[Localizable(true)]
public DateTime CurrentTime public DateTime CurrentTime
{ {
get { return currentTime; } get { return currentTime; }
...@@ -147,11 +148,16 @@ namespace HZH_Controls.Controls ...@@ -147,11 +148,16 @@ namespace HZH_Controls.Controls
/// </summary> /// </summary>
private void SetTimeToControl() private void SetTimeToControl()
{ {
this.txtYear.Text = currentTime.Year.ToString(); var y = CurrentTime.Year;
this.txtMonth.Text = currentTime.Month.ToString().PadLeft(2, '0'); var M = CurrentTime.Month;
this.txtDay.Text = currentTime.Day.ToString().PadLeft(2, '0'); var d = CurrentTime.Day;
this.txtHour.Text = currentTime.Hour.ToString().PadLeft(2, '0'); var h = CurrentTime.Hour;
this.txtMinute.Text = currentTime.Minute.ToString().PadLeft(2, '0'); var m = CurrentTime.Minute;
this.txtYear.Text = y.ToString();
this.txtMonth.Text = M.ToString().PadLeft(2, '0');
this.txtDay.Text = d.ToString().PadLeft(2, '0');
this.txtHour.Text = h.ToString().PadLeft(2, '0');
this.txtMinute.Text = m.ToString().PadLeft(2, '0');
} }
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="UCDatePickerExt" /> class. /// Initializes a new instance of the <see cref="UCDatePickerExt" /> class.
......
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
namespace HZH_Controls.Controls
{
public sealed class ControlPaintEx
{
public static void DrawCheckedFlag(Graphics graphics, Rectangle rect, Color color)
{
PointF[] points = new PointF[3];
points[0] = new PointF(
rect.X + rect.Width / 4.5f,
rect.Y + rect.Height / 2.5f);
points[1] = new PointF(
rect.X + rect.Width / 2.5f,
rect.Bottom - rect.Height / 3f);
points[2] = new PointF(
rect.Right - rect.Width / 4.0f,
rect.Y + rect.Height / 4.5f);
using (Pen pen = new Pen(color, 2F))
{
graphics.DrawLines(pen, points);
}
}
public static void DrawGlass(
Graphics g, RectangleF glassRect, int alphaCenter, int alphaSurround)
{
DrawGlass(g, glassRect, Color.White, alphaCenter, alphaSurround);
}
public static void DrawGlass(
Graphics g,
RectangleF glassRect,
Color glassColor,
int alphaCenter,
int alphaSurround)
{
using (GraphicsPath path = new GraphicsPath())
{
path.AddEllipse(glassRect);
using (PathGradientBrush brush = new PathGradientBrush(path))
{
brush.CenterColor = Color.FromArgb(alphaCenter, glassColor);
brush.SurroundColors = new Color[] {
Color.FromArgb(alphaSurround, glassColor) };
brush.CenterPoint = new PointF(
glassRect.X + glassRect.Width / 2,
glassRect.Y + glassRect.Height / 2);
g.FillPath(brush, path);
}
}
}
public static void DrawBackgroundImage(
Graphics g,
Image backgroundImage,
Color backColor,
ImageLayout backgroundImageLayout,
Rectangle bounds,
Rectangle clipRect)
{
DrawBackgroundImage(
g,
backgroundImage,
backColor,
backgroundImageLayout,
bounds,
clipRect,
Point.Empty,
RightToLeft.No);
}
public static void DrawBackgroundImage(
Graphics g,
Image backgroundImage,
Color backColor,
ImageLayout backgroundImageLayout,
Rectangle bounds,
Rectangle clipRect,
Point scrollOffset)
{
DrawBackgroundImage(
g,
backgroundImage,
backColor,
backgroundImageLayout,
bounds,
clipRect,
scrollOffset,
RightToLeft.No);
}
public static void DrawBackgroundImage(
Graphics g,
Image backgroundImage,
Color backColor,
ImageLayout backgroundImageLayout,
Rectangle bounds,
Rectangle clipRect,
Point scrollOffset,
RightToLeft rightToLeft)
{
if (g == null)
{
throw new ArgumentNullException("g");
}
if (backgroundImageLayout == ImageLayout.Tile)
{
using (TextureBrush brush = new TextureBrush(backgroundImage, WrapMode.Tile))
{
if (scrollOffset != Point.Empty)
{
Matrix transform = brush.Transform;
transform.Translate((float)scrollOffset.X, (float)scrollOffset.Y);
brush.Transform = transform;
}
g.FillRectangle(brush, clipRect);
return;
}
}
Rectangle rect = CalculateBackgroundImageRectangle(
bounds,
backgroundImage,
backgroundImageLayout);
if ((rightToLeft == RightToLeft.Yes) &&
(backgroundImageLayout == ImageLayout.None))
{
rect.X += clipRect.Width - rect.Width;
}
using (SolidBrush brush2 = new SolidBrush(backColor))
{
g.FillRectangle(brush2, clipRect);
}
if (!clipRect.Contains(rect))
{
if ((backgroundImageLayout == ImageLayout.Stretch) ||
(backgroundImageLayout == ImageLayout.Zoom))
{
rect.Intersect(clipRect);
g.DrawImage(backgroundImage, rect);
}
else if (backgroundImageLayout == ImageLayout.None)
{
rect.Offset(clipRect.Location);
Rectangle destRect = rect;
destRect.Intersect(clipRect);
Rectangle rectangle3 = new Rectangle(Point.Empty, destRect.Size);
g.DrawImage(
backgroundImage,
destRect,
rectangle3.X,
rectangle3.Y,
rectangle3.Width,
rectangle3.Height,
GraphicsUnit.Pixel);
}
else
{
Rectangle rectangle4 = rect;
rectangle4.Intersect(clipRect);
Rectangle rectangle5 = new Rectangle(
new Point(rectangle4.X - rect.X, rectangle4.Y - rect.Y),
rectangle4.Size);
g.DrawImage(
backgroundImage,
rectangle4,
rectangle5.X,
rectangle5.Y,
rectangle5.Width,
rectangle5.Height,
GraphicsUnit.Pixel);
}
}
else
{
ImageAttributes imageAttr = new ImageAttributes();
imageAttr.SetWrapMode(WrapMode.TileFlipXY);
g.DrawImage(
backgroundImage,
rect,
0,
0,
backgroundImage.Width,
backgroundImage.Height,
GraphicsUnit.Pixel,
imageAttr);
imageAttr.Dispose();
}
}
internal static Rectangle CalculateBackgroundImageRectangle(
Rectangle bounds,
Image backgroundImage,
ImageLayout imageLayout)
{
Rectangle rectangle = bounds;
if (backgroundImage != null)
{
switch (imageLayout)
{
case ImageLayout.None:
rectangle.Size = backgroundImage.Size;
return rectangle;
case ImageLayout.Tile:
return rectangle;
case ImageLayout.Center:
{
rectangle.Size = backgroundImage.Size;
Size size = bounds.Size;
if (size.Width > rectangle.Width)
{
rectangle.X = (size.Width - rectangle.Width) / 2;
}
if (size.Height > rectangle.Height)
{
rectangle.Y = (size.Height - rectangle.Height) / 2;
}
return rectangle;
}
case ImageLayout.Stretch:
rectangle.Size = bounds.Size;
return rectangle;
case ImageLayout.Zoom:
{
Size size2 = backgroundImage.Size;
float num = ((float)bounds.Width) / ((float)size2.Width);
float num2 = ((float)bounds.Height) / ((float)size2.Height);
if (num >= num2)
{
rectangle.Height = bounds.Height;
rectangle.Width = (int)((size2.Width * num2) + 0.5);
if (bounds.X >= 0)
{
rectangle.X = (bounds.Width - rectangle.Width) / 2;
}
return rectangle;
}
rectangle.Width = bounds.Width;
rectangle.Height = (int)((size2.Height * num) + 0.5);
if (bounds.Y >= 0)
{
rectangle.Y = (bounds.Height - rectangle.Height) / 2;
}
return rectangle;
}
}
}
return rectangle;
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Drawing.Drawing2D;
namespace HZH_Controls.Controls
{
public static class GraphicsPathHelper
{
/// <summary>
/// 建立带有圆角样式的路径。
/// </summary>
/// <param name="rect">用来建立路径的矩形。</param>
/// <param name="_radius">圆角的大小。</param>
/// <param name="style">圆角的样式。</param>
/// <param name="correction">是否把矩形长宽减 1,以便画出边框。</param>
/// <returns>建立的路径。</returns>
public static GraphicsPath CreatePath(
Rectangle rect, int radius, RoundStyle style, bool correction)
{
GraphicsPath path = new GraphicsPath();
int radiusCorrection = correction ? 1 : 0;
switch (style)
{
case RoundStyle.None:
path.AddRectangle(rect);
break;
case RoundStyle.All:
path.AddArc(rect.X, rect.Y, radius, radius, 180, 90);
path.AddArc(
rect.Right - radius - radiusCorrection,
rect.Y,
radius,
radius,
270,
90);
path.AddArc(
rect.Right - radius - radiusCorrection,
rect.Bottom - radius - radiusCorrection,
radius,
radius, 0, 90);
path.AddArc(
rect.X,
rect.Bottom - radius - radiusCorrection,
radius,
radius,
90,
90);
break;
case RoundStyle.Left:
path.AddArc(rect.X, rect.Y, radius, radius, 180, 90);
path.AddLine(
rect.Right - radiusCorrection, rect.Y,
rect.Right - radiusCorrection, rect.Bottom - radiusCorrection);
path.AddArc(
rect.X,
rect.Bottom - radius - radiusCorrection,
radius,
radius,
90,
90);
break;
case RoundStyle.Right:
path.AddArc(
rect.Right - radius - radiusCorrection,
rect.Y,
radius,
radius,
270,
90);
path.AddArc(
rect.Right - radius - radiusCorrection,
rect.Bottom - radius - radiusCorrection,
radius,
radius,
0,
90);
path.AddLine(rect.X, rect.Bottom - radiusCorrection, rect.X, rect.Y);
break;
case RoundStyle.Top:
path.AddArc(rect.X, rect.Y, radius, radius, 180, 90);
path.AddArc(
rect.Right - radius - radiusCorrection,
rect.Y,
radius,
radius,
270,
90);
path.AddLine(
rect.Right - radiusCorrection, rect.Bottom - radiusCorrection,
rect.X, rect.Bottom - radiusCorrection);
break;
case RoundStyle.Bottom:
path.AddArc(
rect.Right - radius - radiusCorrection,
rect.Bottom - radius - radiusCorrection,
radius,
radius,
0,
90);
path.AddArc(
rect.X,
rect.Bottom - radius - radiusCorrection,
radius,
radius,
90,
90);
path.AddLine(rect.X, rect.Y, rect.Right - radiusCorrection, rect.Y);
break;
case RoundStyle.BottomLeft:
path.AddArc(
rect.X,
rect.Bottom - radius - radiusCorrection,
radius,
radius,
90,
90);
path.AddLine(rect.X, rect.Y, rect.Right - radiusCorrection, rect.Y);
path.AddLine(
rect.Right - radiusCorrection,
rect.Y,
rect.Right - radiusCorrection,
rect.Bottom - radiusCorrection);
break;
case RoundStyle.BottomRight:
path.AddArc(
rect.Right - radius - radiusCorrection,
rect.Bottom - radius - radiusCorrection,
radius,
radius,
0,
90);
path.AddLine(rect.X, rect.Bottom - radiusCorrection, rect.X, rect.Y);
path.AddLine(rect.X, rect.Y, rect.Right - radiusCorrection, rect.Y);
break;
}
path.CloseFigure();
return path;
}
}
}
\ No newline at end of file \ No newline at end of file
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing.Drawing2D;
using System.Drawing;
namespace HZH_Controls.Controls
{
public class InterpolationModeGraphics : IDisposable
{
private InterpolationMode _oldMode;
private Graphics _graphics;
public InterpolationModeGraphics(Graphics graphics)
: this(graphics, InterpolationMode.HighQualityBicubic)
{
}
public InterpolationModeGraphics(
Graphics graphics, InterpolationMode newMode)
{
_graphics = graphics;
_oldMode = graphics.InterpolationMode;
graphics.InterpolationMode = newMode;
}
#region IDisposable 成员
public void Dispose()
{
_graphics.InterpolationMode = _oldMode;
}
#endregion
}
}
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing.Drawing2D;
using System.Drawing;
using System.Windows.Forms;
namespace HZH_Controls.Controls
{
public static class RegionHelper
{
public static void CreateRegion(
Control control,
Rectangle bounds,
int radius,
RoundStyle roundStyle)
{
using (GraphicsPath path =
GraphicsPathHelper.CreatePath(
bounds, radius, roundStyle, true))
{
Region region = new Region(path);
path.Widen(Pens.White);
region.Union(path);
if (control.Region != null)
{
control.Region.Dispose();
}
control.Region = region;
}
}
public static void CreateRegion(
Control control,
Rectangle bounds,
int radius)
{
CreateRegion(control, bounds, radius, RoundStyle.All);
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Drawing.Drawing2D;
namespace HZH_Controls.Controls
{
internal class RenderHelper
{
internal static void RenderBackgroundInternal(
Graphics g,
Rectangle rect,
Color baseColor,
Color borderColor,
RoundStyle style,
bool drawBorder,
bool drawGlass)
{
RenderBackgroundInternal(
g,
rect,
baseColor,
borderColor,
style,
8,
drawBorder,
drawGlass);
}
internal static void RenderBackgroundInternal(
Graphics g,
Rectangle rect,
Color baseColor,
Color borderColor,
RoundStyle style,
int roundWidth,
bool drawBorder,
bool drawGlass)
{
RenderBackgroundInternal(
g,
rect,
baseColor,
borderColor,
style,
roundWidth,
0.45f,
drawBorder,
drawGlass);
}
internal static void RenderBackgroundInternal(
Graphics g,
Rectangle rect,
Color baseColor,
Color borderColor,
RoundStyle style,
int roundWidth,
float basePosition,
bool drawBorder,
bool drawGlass)
{
if (drawBorder)
{
rect.Width--;
rect.Height--;
}
if (style != RoundStyle.None)
{
using (GraphicsPath path =
GraphicsPathHelper.CreatePath(rect, roundWidth, style, false))
{
g.FillPath(new SolidBrush(baseColor), path);
}
//if (baseColor.A > 80)
//{
// Rectangle rectTop = rect;
//
// using (GraphicsPath pathTop = GraphicsPathHelper.CreatePath(
// rectTop, roundWidth, RoundStyle.Top, false))
// {
// using (SolidBrush brushAlpha =
// new SolidBrush(Color.FromArgb(128, 255, 255, 255)))
// {
// g.FillPath(brushAlpha, pathTop);
// }
// }
//}
//if (drawGlass)
//{
// RectangleF glassRect = rect;
// if (mode == LinearGradientMode.Vertical)
// {
// glassRect.Y = rect.Y + rect.Height * basePosition;
// glassRect.Height = (rect.Height - rect.Height * basePosition) * 2;
// }
// else
// {
// glassRect.X = rect.X + rect.Width * basePosition;
// glassRect.Width = (rect.Width - rect.Width * basePosition) * 2;
// }
// ControlPaintEx.DrawGlass(g, glassRect, 170, 0);
//}
if (drawBorder)
{
using (GraphicsPath path =
GraphicsPathHelper.CreatePath(rect, roundWidth, style, false))
{
using (Pen pen = new Pen(borderColor))
{
g.DrawPath(pen, path);
}
}
rect.Inflate(-1, -1);
//using (GraphicsPath path =
// GraphicsPathHelper.CreatePath(rect, roundWidth, style, false))
//{
// using (Pen pen = new Pen(innerBorderColor))
// {
// g.DrawPath(pen, path);
// }
//}
}
}
else
{
g.FillRectangle(new SolidBrush(baseColor), rect);
//if (baseColor.A > 80)
//{
// Rectangle rectTop = rect;
// if (mode == LinearGradientMode.Vertical)
// {
// rectTop.Height = (int)(rectTop.Height * basePosition);
// }
// else
// {
// rectTop.Width = (int)(rect.Width * basePosition);
// }
// using (SolidBrush brushAlpha =
// new SolidBrush(Color.FromArgb(128, 255, 255, 255)))
// {
// g.FillRectangle(brushAlpha, rectTop);
// }
//}
//if (drawGlass)
//{
// RectangleF glassRect = rect;
// if (mode == LinearGradientMode.Vertical)
// {
// glassRect.Y = rect.Y + rect.Height * basePosition;
// glassRect.Height = (rect.Height - rect.Height * basePosition) * 2;
// }
// else
// {
// glassRect.X = rect.X + rect.Width * basePosition;
// glassRect.Width = (rect.Width - rect.Width * basePosition) * 2;
// }
// ControlPaintEx.DrawGlass(g, glassRect, 200, 0);
//}
if (drawBorder)
{
using (Pen pen = new Pen(borderColor))
{
g.DrawRectangle(pen, rect);
}
rect.Inflate(-1, -1);
//using (Pen pen = new Pen(innerBorderColor))
//{
// g.DrawRectangle(pen, rect);
//}
}
}
}
internal static Color GetColor(Color colorBase, int a, int r, int g, int b)
{
int a0 = colorBase.A;
int r0 = colorBase.R;
int g0 = colorBase.G;
int b0 = colorBase.B;
if (a + a0 > 255) { a = 255; } else { a = Math.Max(0, a + a0); }
if (r + r0 > 255) { r = 255; } else { r = Math.Max(0, r + r0); }
if (g + g0 > 255) { g = 255; } else { g = Math.Max(0, g + g0); }
if (b + b0 > 255) { b = 255; } else { b = Math.Max(0, b + b0); }
return Color.FromArgb(a, r, g, b);
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace HZH_Controls.Controls
{
/// <summary>
/// 建立圆角路径的样式。
/// </summary>
public enum RoundStyle
{
/// <summary>
/// 四个角都不是圆角。
/// </summary>
None = 0,
/// <summary>
/// 四个角都为圆角。
/// </summary>
All = 1,
/// <summary>
/// 左边两个角为圆角。
/// </summary>
Left = 2,
/// <summary>
/// 右边两个角为圆角。
/// </summary>
Right = 3,
/// <summary>
/// 上边两个角为圆角。
/// </summary>
Top = 4,
/// <summary>
/// 下边两个角为圆角。
/// </summary>
Bottom = 5,
/// <summary>
/// 左下角为圆角。
/// </summary>
BottomLeft = 6,
/// <summary>
/// 右下角为圆角。
/// </summary>
BottomRight = 7,
}
}
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Drawing.Drawing2D;
namespace HZH_Controls.Controls
{
public class SmoothingModeGraphics : IDisposable
{
private SmoothingMode _oldMode;
private Graphics _graphics;
public SmoothingModeGraphics(Graphics graphics)
: this(graphics, SmoothingMode.AntiAlias)
{
}
public SmoothingModeGraphics(Graphics graphics, SmoothingMode newMode)
{
_graphics = graphics;
_oldMode = graphics.SmoothingMode;
graphics.SmoothingMode = newMode;
}
#region IDisposable 成员
public void Dispose()
{
_graphics.SmoothingMode = _oldMode;
}
#endregion
}
}
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Drawing.Text;
namespace HZH_Controls.Controls
{
internal class TextRenderingHintGraphics : IDisposable
{
private Graphics _graphics;
private TextRenderingHint _oldTextRenderingHint;
public TextRenderingHintGraphics(Graphics graphics)
: this(graphics, TextRenderingHint.AntiAlias)
{
}
public TextRenderingHintGraphics(
Graphics graphics,
TextRenderingHint newTextRenderingHint)
{
_graphics = graphics;
_oldTextRenderingHint = graphics.TextRenderingHint;
_graphics.TextRenderingHint = newTextRenderingHint;
}
#region IDisposable 成员
public void Dispose()
{
_graphics.TextRenderingHint = _oldTextRenderingHint;
}
#endregion
}
}
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
namespace HZH_Controls.Controls
{
public class ToolStripColorTable
{
private static readonly Color _base = Color.FromArgb(49, 56, 82);
private static readonly Color _border = Color.FromArgb(49, 56, 82);
private static readonly Color _backNormal = Color.FromArgb(49, 56, 82);
private static readonly Color _backHover = Color.FromArgb(29, 33, 49);
private static readonly Color _backPressed = Color.FromArgb(29, 33, 49);
private static readonly Color _fore = Color.FromArgb(175, 193, 225);
private static readonly Color _dropDownImageBack = Color.FromArgb(49, 56, 82);
private static readonly Color _dropDownImageSeparator = Color.FromArgb(49, 56, 82);
public ToolStripColorTable() { }
public virtual Color Base
{
get { return _base; }
}
public virtual Color Border
{
get { return _border; }
}
public virtual Color BackNormal
{
get { return _backNormal; }
}
public virtual Color BackHover
{
get { return _backHover; }
}
public virtual Color BackPressed
{
get { return _backPressed; }
}
public virtual Color Fore
{
get { return _fore; }
}
public virtual Color DropDownImageBack
{
get { return _dropDownImageBack; }
}
public virtual Color DropDownImageSeparator
{
get { return _dropDownImageSeparator; }
}
}
}
...@@ -141,6 +141,16 @@ ...@@ -141,6 +141,16 @@
<Compile Include="Controls\TimeLine\UCTimeLine.Designer.cs"> <Compile Include="Controls\TimeLine\UCTimeLine.Designer.cs">
<DependentUpon>UCTimeLine.cs</DependentUpon> <DependentUpon>UCTimeLine.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Controls\ToolStripRendererEx\ControlPaintEx.cs" />
<Compile Include="Controls\ToolStripRendererEx\GraphicsPathHelper.cs" />
<Compile Include="Controls\ToolStripRendererEx\InterpolationModeGraphics.cs" />
<Compile Include="Controls\ToolStripRendererEx\ProfessionalToolStripRendererEx.cs" />
<Compile Include="Controls\ToolStripRendererEx\RegionHelper.cs" />
<Compile Include="Controls\ToolStripRendererEx\RenderHelper.cs" />
<Compile Include="Controls\ToolStripRendererEx\RoundStyle.cs" />
<Compile Include="Controls\ToolStripRendererEx\SmoothingModeGraphics.cs" />
<Compile Include="Controls\ToolStripRendererEx\TextRenderingHintGraphics.cs" />
<Compile Include="Controls\ToolStripRendererEx\ToolStripColorTable.cs" />
<Compile Include="Controls\Transfer\TransferEventArgs.cs" /> <Compile Include="Controls\Transfer\TransferEventArgs.cs" />
<Compile Include="Controls\Transfer\UCTransfer.cs"> <Compile Include="Controls\Transfer\UCTransfer.cs">
<SubType>UserControl</SubType> <SubType>UserControl</SubType>
......
...@@ -72,6 +72,7 @@ namespace Test ...@@ -72,6 +72,7 @@ namespace Test
tnControl.Nodes.Add("时间轴"); tnControl.Nodes.Add("时间轴");
tnControl.Nodes.Add("穿梭框"); tnControl.Nodes.Add("穿梭框");
tnControl.Nodes.Add("引用区块"); tnControl.Nodes.Add("引用区块");
tnControl.Nodes.Add("右键菜单");
this.tvMenu.Nodes.Add(tnControl); this.tvMenu.Nodes.Add(tnControl);
TreeNode tnCharts = new TreeNode(" 图表"); TreeNode tnCharts = new TreeNode(" 图表");
...@@ -296,6 +297,9 @@ namespace Test ...@@ -296,6 +297,9 @@ namespace Test
case "引用区块": case "引用区块":
AddControl(new UC.UCTestPanelQuote()); AddControl(new UC.UCTestPanelQuote());
break; break;
case "右键菜单":
AddControl(new UC.UCTestContextMenu());
break;
#endregion #endregion
#region 图表 English:Chart #region 图表 English:Chart
......
...@@ -127,6 +127,12 @@ ...@@ -127,6 +127,12 @@
<Compile Include="UC\UCTestConduit.Designer.cs"> <Compile Include="UC\UCTestConduit.Designer.cs">
<DependentUpon>UCTestConduit.cs</DependentUpon> <DependentUpon>UCTestConduit.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="UC\UCTestContextMenu.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="UC\UCTestContextMenu.Designer.cs">
<DependentUpon>UCTestContextMenu.cs</DependentUpon>
</Compile>
<Compile Include="UC\UCTestConveyor.cs"> <Compile Include="UC\UCTestConveyor.cs">
<SubType>UserControl</SubType> <SubType>UserControl</SubType>
</Compile> </Compile>
...@@ -695,6 +701,9 @@ ...@@ -695,6 +701,9 @@
<EmbeddedResource Include="UC\UCTestConduit.resx"> <EmbeddedResource Include="UC\UCTestConduit.resx">
<DependentUpon>UCTestConduit.cs</DependentUpon> <DependentUpon>UCTestConduit.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="UC\UCTestContextMenu.resx">
<DependentUpon>UCTestContextMenu.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UC\UCTestConveyor.resx"> <EmbeddedResource Include="UC\UCTestConveyor.resx">
<DependentUpon>UCTestConveyor.cs</DependentUpon> <DependentUpon>UCTestConveyor.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
......
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Test.UC
{
public partial class UCTestContextMenu : UserControl
{
public UCTestContextMenu()
{
InitializeComponent();
//HZH_Controls.Controls.ToolStripColorTable这里面有好多颜色 自己可以改
ToolStripManager.Renderer = new HZH_Controls.Controls.ProfessionalToolStripRendererEx();
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>182, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="菜单1ToolStripMenuItem13.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAGQSURBVEhLzZS7SgQxGIXHQrSw8A209Al8Hx/AShZBEMUboqWgLigiWCkzGRC3WyaJqCAWVloo
bhLBBUEWOxFlPOP+ymySvcGCfvAXM+f8Z3KbBH9CWH4YYdIsMKHPULVY6lcmzGXE9dpx8jRGts5J07Qv
FGoRYW+o1FvSfOIjG3tJZZDa2hMJFXrDvKXOi8WrfmptTsjVrD+gRUmzSe1+WFIZZVx/2I2xMBeRVAUm
9SSey7b+XfJxnGJcYJi3G2JsFMm/YPpTjk/oLZJd0MDz5oirW5IcoMu8FzO9J8kFu2zy5kjobZIcIlGZ
znuxTC8kuUBUDWahdkhygD6X92IQLYKFOmkwc1Utle4GSG4A+o3lvSbJBWIhb6436KPD5HmILEH2IYxu
y/ZhjVfI4oLjNgxTzW7Kpok6QO1j96uurt6zo0oxfuJTM2E3tiv8VDPU3hqMbNUX4C+zS22dgemt+4Py
1WXoDwhf8gdm62qanvGOYFxl97EV2vzH6Qq67OvBXBfpdW/A7bbcs5H+Q4LgCy0wfhlJZv3aAAAAAElF
TkSuQmCC
</value>
</data>
</root>
\ No newline at end of file \ No newline at end of file
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!