本文整理汇总了C#中System.Windows.Forms.ToolStripItemImageRenderEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# ToolStripItemImageRenderEventArgs类的具体用法?C# ToolStripItemImageRenderEventArgs怎么用?C# ToolStripItemImageRenderEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ToolStripItemImageRenderEventArgs类属于System.Windows.Forms命名空间,在下文中一共展示了ToolStripItemImageRenderEventArgs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: OnRenderItemImage
/// <summary>
/// 将图标居中绘制
/// </summary>
/// <param name="e"></param>
protected override void OnRenderItemImage(ToolStripItemImageRenderEventArgs e)
{
//base.OnRenderItemImage(e);
int offset = 28;
Image icon = e.Image;
Rectangle iconRect = e.ImageRectangle;
Graphics g = e.Graphics;
if (e.ToolStrip is ContextMenuStrip)
{
ContextMenuStrip contextMenuStrip = e.ToolStrip as ContextMenuStrip;
iconRect.X = (offset - icon.Width) / 2;
if (icon.Width < contextMenuStrip.ImageScalingSize.Width ||
icon.Height < contextMenuStrip.ImageScalingSize.Height)
{
g.DrawImage(icon, iconRect);
}
else
{
Rectangle iconPoint = new Rectangle(
iconRect.X,
2,
contextMenuStrip.ImageScalingSize.Width + 3,
contextMenuStrip.ImageScalingSize.Height + 2);
Rectangle imgRect = new Rectangle(0, 0, icon.Width, icon.Height);
g.DrawImage(icon, iconPoint, imgRect, GraphicsUnit.Pixel);
}
}
}
开发者ID:JimmyFung,项目名称:DesktopHelper,代码行数:35,代码来源:QQToolStripRenderer.cs
示例2: OnRenderItemImage
protected override void OnRenderItemImage(ToolStripItemImageRenderEventArgs e)
{
Rectangle destRect = e.ImageRectangle;
destRect.X++;
destRect.Width -= 2;
destRect.Y++;
destRect.Height -= 2;
Image normalImage = e.Image;
if ((destRect != Rectangle.Empty) && (normalImage != null))
{
if (e.Item.Enabled)
{
e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
e.Graphics.DrawImage(normalImage, destRect);
}
else
{
Image disabledImage = new Bitmap(destRect.Width, destRect.Height);
Graphics g = Graphics.FromImage(disabledImage);
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.DrawImage(e.Image, 0, 0, destRect.Width, destRect.Height);
g.Dispose();
ControlPaint.DrawImageDisabled(e.Graphics, disabledImage, destRect.X, destRect.Y, Color.Transparent);
}
}
}
开发者ID:schultzisaiah,项目名称:just-gestures,代码行数:26,代码来源:MyToolStripRenderer.cs
示例3: OnRenderItemCheck
protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e)
{
base.OnRenderItemCheck(e);
/*
if (e.Item is ToolStripMenuItem )
{
if (((ToolStripMenuItem) e.Item).Checked)
{
Rectangle rect = new Rectangle(3, 3, 12, 12);
e.Graphics.DrawRectangle(Pens.Black, rect);
e.Graphics.DrawLine(Pens.Black, new Point(5,12), new Point( 8,12 ) );
e.Graphics.DrawLine(Pens.Black, new Point(8, 12), new Point(11, 4));
}
else
{
Rectangle rect = new Rectangle(3, 3, 12, 12);
e.Graphics.DrawRectangle(Pens.Black, rect);
}
}
else
{
base.OnRenderItemCheck(e);
}
* */
}
开发者ID:UtrsSoftware,项目名称:ATMLWorkBench,代码行数:25,代码来源:ATMLMenuRenderer.cs
示例4: OnRenderItemImage
protected override void OnRenderItemImage(ToolStripItemImageRenderEventArgs e)
{
Rectangle imageRectangle = e.ImageRectangle;
Image normalImage = e.Image;
if (!imageRectangle.IsEmpty && (normalImage != null))
{
bool flag = false;
if (!e.Item.Enabled)
{
normalImage = ToolStripRenderer.CreateDisabledImage(normalImage);
flag = true;
}
if (e.Item.ImageScaling == ToolStripItemImageScaling.None)
{
e.Graphics.DrawImage(normalImage, imageRectangle.Location);
}
else
{
e.Graphics.DrawImage(normalImage, imageRectangle);
}
if (flag)
{
normalImage.Dispose();
}
}
}
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:26,代码来源:ToolStripButtonRenderer.cs
示例5: OnRenderItemCheck
protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e)
{
Rectangle rect = Rectangle.Inflate(e.ImageRectangle, 3, 2);
e.Graphics.FillRectangle(new LinearGradientBrush(
new Point(0, 0),
new Point(0, e.Item.ContentRectangle.Height),
backFillColorTop,
backFillColorBottom), rect);
e.Graphics.DrawLines(new Pen(outlineColor), GraphicsHelper.getRoundedLines(rect));
rect = Rectangle.Inflate(rect, -1, -1);
e.Graphics.DrawLines(new Pen(insetOutlineColor), GraphicsHelper.getRoundedLines(rect));
rect = Rectangle.Inflate(rect, -2, -1);
try
{
if (e.Item.Image == null)
e.Graphics.DrawImageUnscaled(Properties.Resources.bullet_black, rect);
}
catch
{
base.OnRenderItemCheck(e);
}
}
开发者ID:jsutton29,项目名称:Paint-Bucket,代码行数:28,代码来源:GlassToolstripRenderer.cs
示例6: OnRenderItemImage
protected override void OnRenderItemImage(ToolStripItemImageRenderEventArgs e)
{
Rectangle rect = new Rectangle(25,1,16,16);
if (e.Item is ToolStripMenuItem && ((ToolStripMenuItem)e.Item).Checked)
e.Graphics.DrawImage(e.Image, rect);
else
base.OnRenderItemImage(e);
}
开发者ID:UtrsSoftware,项目名称:ATMLWorkBench,代码行数:8,代码来源:ATMLMenuRenderer.cs
示例7: OnRenderItemImage
protected override void OnRenderItemImage(ToolStripItemImageRenderEventArgs e)
{
Rectangle rect = e.ImageRectangle;
rect.X += 4;
ToolStripItemImageRenderEventArgs ne = new ToolStripItemImageRenderEventArgs(e.Graphics, e.Item, e.Image, rect);
base.OnRenderItemImage(ne);
}
开发者ID:yienit,项目名称:KST,代码行数:8,代码来源:NuiContextMenuStripRender.cs
示例8: OnRenderItemImage
protected override void OnRenderItemImage(ToolStripItemImageRenderEventArgs e)
{
if (e.Item is ToolStripMenuItem)
{
Rectangle imageRectangle = new Rectangle(e.ImageRectangle.Left + 2, e.ImageRectangle.Top, e.ImageRectangle.Width, e.ImageRectangle.Height);
e = new ToolStripItemImageRenderEventArgs(e.Graphics, e.Item, e.Image, imageRectangle);
}
base.OnRenderItemImage(e);
}
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:9,代码来源:ToolStripVistaRenderer.cs
示例9: OnRenderItemCheck
protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e)
{
Rectangle backRect = new Rectangle(5, 4, 13, 13);
LinearGradientBrush bgBrush = new LinearGradientBrush(backRect, Color.FromArgb(255, 220, 120), Color.FromArgb(240, 160, 40), LinearGradientMode.Vertical);
e.Graphics.DrawRectangle(new Pen(new SolidBrush(Color.FromArgb(150, 50, 0)), 1), new Rectangle(4, 3, 14, 14));
e.Graphics.FillRectangle(bgBrush, backRect);
e.Graphics.DrawImage(e.Image, new Point(3, 3));
}
开发者ID:hanveg12,项目名称:XNA_Innlevering2,代码行数:9,代码来源:Sandbox3Renderer.cs
示例10: OnRenderItemImage
protected override void OnRenderItemImage(ToolStripItemImageRenderEventArgs e)
{
e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
if (e.Image != null)
{
imageheight = e.Item.Height - offsety * 2;
imagewidth = (int)((Convert.ToDouble(imageheight) / e.Image.Height) * e.Image.Width);
}
e.Graphics.DrawImage(e.Image, new Rectangle(offsetx, offsety, imagewidth, imageheight));
}
开发者ID:calvinkwong,项目名称:pol-the-game,代码行数:10,代码来源:RibbonMenuRenderer.cs
示例11: OnRenderItemCheck
protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e)
{
base.OnRenderItemCheck(e);
Rectangle bounds = new Rectangle(e.ImageRectangle.Left - 2, 1, e.ImageRectangle.Width + 4, e.Item.Height - 2);
Graphics g = e.Graphics;
using (Pen p = new Pen(ThemeColorTable.HighlightColor, 1))
{
g.DrawRectangle(p, bounds.X, bounds.Y, bounds.Width - 1, bounds.Height - 1);
}
}
开发者ID:naztrain,项目名称:vixen,代码行数:10,代码来源:ThemeToolStripRenderer.cs
示例12: OnRenderItemImage
protected override void OnRenderItemImage(ToolStripItemImageRenderEventArgs e)
{
ToolStripSplitButton item = e.Item as ToolStripSplitButton;
if (!((e.Item is ToolStripMenuItem) || !((item != null) ? item.ButtonPressed : e.Item.Pressed)))
{
Rectangle imageRectangle = e.ImageRectangle;
imageRectangle.Offset(1, 1);
e = new ToolStripItemImageRenderEventArgs(e.Graphics, e.Item, e.Image, imageRectangle);
}
base.OnRenderItemImage(e);
}
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:11,代码来源:ToolStripFlatRenderer.cs
示例13: OnRenderItemCheck
protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e) {
if (scaledCheckbox == null || scaledCheckbox.Size != coreConfiguration.IconSize) {
if (scaledCheckbox != null) {
scaledCheckbox.Dispose();
}
scaledCheckbox = ImageHelper.ResizeImage(e.Image, true, coreConfiguration.IconSize.Width, coreConfiguration.IconSize.Height, null);
}
Rectangle old = e.ImageRectangle;
ToolStripItemImageRenderEventArgs clone = new ToolStripItemImageRenderEventArgs(e.Graphics, e.Item, scaledCheckbox, new Rectangle(old.X, 0, old.Width, old.Height));
base.OnRenderItemCheck(clone);
}
开发者ID:logtcn,项目名称:greenshot,代码行数:11,代码来源:ContextMenuToolStripProfessionalRenderer.cs
示例14: OnRenderItemImage
/// <summary>
/// Render an item
/// </summary>
/// <param name="e"></param>
protected override void OnRenderItemImage(ToolStripItemImageRenderEventArgs e)
{
// automatic adjust the color of attached images...
if (e.Item.Selected && e.Item.Pressed == false)
e.Graphics.DrawImageUnscaled(e.Item.Image.AdjustRGBGamma(1f, 1f, 1f, 0.01f), e.ImageRectangle);
else
{
if (MetroUI.Style.DarkStyle)
e.Graphics.DrawImageUnscaled(e.Item.Image.AdjustRGBGamma(1f, 1f, 1f, 0.01f), e.ImageRectangle);
else
base.OnRenderItemImage(e);
}
}
开发者ID:ajmd17,项目名称:apexengine-sharp,代码行数:17,代码来源:metroToolStripRenderer.cs
示例15: OnRenderItemImage
protected override void OnRenderItemImage(ToolStripItemImageRenderEventArgs e) {
QMenuItem item = e.Item as QMenuItem;
if(((item != null) && item.IsCut) && ((e.ImageRectangle != Rectangle.Empty) && (e.Image != null))) {
ColorMatrix newColorMatrix = new ColorMatrix();
using(ImageAttributes attributes = new ImageAttributes()) {
newColorMatrix.Matrix33 = 0.5f;
attributes.SetColorMatrix(newColorMatrix);
Size size = e.Image.Size;
e.Graphics.DrawImage(e.Image, e.ImageRectangle, 0, 0, size.Width, size.Height, GraphicsUnit.Pixel, attributes);
return;
}
}
base.OnRenderItemImage(e);
}
开发者ID:KnowNo,项目名称:test-code-backup,代码行数:14,代码来源:DefaultMenuRenderer.cs
示例16: OnRenderItemCheck
protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e)
{
base.OnRenderItemCheck(e);
if (e.Item is ToolStripMenuItem)
{
Rectangle r = e.ImageRectangle;
r.Inflate(2, 2);
if ((e.Item as ToolStripMenuItem).Checked)
{
PaintItem(e.Graphics, r, ColorTable.ButtonSelectedMiddleBegin, ColorTable.ButtonSelectedMiddleBegin);
}
else
ControlPaint.DrawImageDisabled(e.Graphics, e.Image, e.ImageRectangle.X, e.ImageRectangle.Y, Color.Transparent);
}
}
开发者ID:jorik041,项目名称:water-utility-mobile-map,代码行数:15,代码来源:NavigateBarRenderer.cs
示例17: OnRenderItemCheck
protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e)
{
using (GraphicsPath path = RoundRect(Rectangle.FromLTRB(e.ImageRectangle.Left, e.ImageRectangle.Top - 1, e.ImageRectangle.Right + 2, e.ImageRectangle.Bottom), 2f, 2f, 2f, 2f))
{
Color color = e.Item.Selected ? base.ColorTable.CheckSelectedBackground : base.ColorTable.CheckBackground;
using (Brush brush = new SolidBrush(color))
{
e.Graphics.FillPath(brush, path);
}
using (Pen pen = new Pen(base.ColorTable.ButtonCheckedHighlightBorder))
{
e.Graphics.DrawPath(pen, path);
}
}
}
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:15,代码来源:ToolStripVistaRenderer.cs
示例18: OnRenderItemCheck
protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e) {
ToolStripDropDownMenu toolStrip = e.ToolStrip as ToolStripDropDownMenu;
if(toolStrip != null) {
if(!toolStrip.ShowImageMargin) {
e.Graphics.DrawImage(bmpCheck, new Rectangle(3, 0, 0x16, Math.Min(0x16, e.Item.Size.Height)));
}
else {
Rectangle rect = new Rectangle(7, 2, 0x12, 0x12);
using(SolidBrush brush = new SolidBrush(Color.FromArgb(0x80, SystemColors.Highlight))) {
e.Graphics.FillRectangle(brush, rect);
e.Graphics.DrawRectangle(SystemPens.Highlight, rect);
}
}
}
}
开发者ID:KnowNo,项目名称:test-code-backup,代码行数:15,代码来源:VistaMenuRenderer.cs
示例19: OnRenderItemCheck
protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e)
{
int h = e.Item.Height;
int size = h / 2 - 2; // Box size
Rectangle rect = new Rectangle(10, (h - size) / 2, size - 2, size);
var mode = e.Graphics.SmoothingMode;
using (Pen pen = new Pen(Color.White, 1.6f))
{
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
e.Graphics.DrawLine(pen, rect.Left, rect.Bottom - size / 2, rect.Left + size / 2.5f, rect.Bottom - 2);
e.Graphics.DrawLine(pen, rect.Left + size / 2.6f, rect.Bottom - 2, rect.Right, rect.Top);
}
e.Graphics.SmoothingMode = mode;
}
开发者ID:filipkunc,项目名称:GLGraphics,代码行数:17,代码来源:DarkToolStripRenderer.cs
示例20: OnRenderItemCheck
/// <summary>Renders an item checkbox.</summary>
/// <param name="e">A <see cref="T:ToolStripItemImageRenderEventArgs"/> that contains the event data.</param>
protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e)
{
if (e.Image != null)
{
if (e.Item.Enabled)
{
Rectangle bounds = e.ImageRectangle;
bounds.Inflate(1, 1);
e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
FillAndStrokeButtonBackground(
e.Graphics,
bounds,
ColorTable.ButtonCheckedHighlight,
ColorTable.ButtonCheckedHighlightBorder,
e.Item.Pressed);
}
OnRenderItemImage(e);
}
}
开发者ID:tommy-carlier,项目名称:tc-libs,代码行数:24,代码来源:TToolStripRenderer.cs
注:本文中的System.Windows.Forms.ToolStripItemImageRenderEventArgs类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论