本文整理汇总了C#中DashStyle.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# DashStyle.ToString方法的具体用法?C# DashStyle.ToString怎么用?C# DashStyle.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DashStyle
的用法示例。
在下文中一共展示了DashStyle.ToString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetDashStyleImage
private Image GetDashStyleImage(DashStyle dashStyle)
{
string nameFormat = "Images.DashStyleButton.{0}.png";
string name = string.Format(nameFormat, dashStyle.ToString());
ImageResource imageResource = PdnResources.GetImageResource(name);
Image returnImage;
if (UI.GetXScaleFactor() == 1.0f && UI.GetYScaleFactor() == 1.0f)
{
returnImage = imageResource.Reference;
}
else
{
returnImage = new Bitmap(imageResource.Reference, UI.ScaleSize(imageResource.Reference.Size));
}
return returnImage;
}
示例2: PaintLine
/// <summary>
/// Paints one color button
/// </summary>
/// <param name="graphics"></param>
/// <param name="color"></param>
/// <param name="hotTrack"></param>
/// <param name="selected"></param>
/// <param name="x"></param>
/// <param name="y"></param>
/// <returns></returns>
private Rectangle PaintLine(Graphics graphics, DashStyle style, bool hotTrack, bool selected, int x, int y)
{
// Button inside rectangle
RectangleF mainRec = new RectangleF(x + 3, y + 3, 100, 1.5F);
// Button border rectangle
Rectangle borderRec = new Rectangle(x, y, 102, 10);
// Check if the button is selected and HotTrack ( no the same color)
bool selectedAndHotTrack = selected && hotTrack;
// Paints the button using the brushes needed
using (Brush hotTrackBrush = new SolidBrush(ArtPalette.ButtonHoverLight))
using (Brush selectedBrush = new SolidBrush(ArtPalette.ButtonHoverDark))
using (Brush selectedHotTrackBrush = new SolidBrush(ArtPalette.SelectedAndHover))
using (Pen selectedPen = new Pen(ArtPalette.SelectedBorder))
using (Pen linePen = new Pen(Color.DimGray, 2F))
using (Pen borderPen = new Pen(ArtPalette.ButtonBorder))
{
linePen.DashStyle = style;
// Paints the rectangle with the Track/Selected color
// if this color is selected/hottrack
if (selectedAndHotTrack)
{
graphics.FillRectangle(selectedHotTrackBrush, borderRec);
graphics.DrawRectangle(selectedPen, borderRec);
}
else if (hotTrack)
{
graphics.FillRectangle(hotTrackBrush, borderRec);
graphics.DrawRectangle(selectedPen, borderRec);
}
else if (selected)
{
graphics.FillRectangle(selectedBrush, borderRec);
graphics.DrawRectangle(selectedPen, borderRec);
}
// Fills the rectangle with the current color, paints
// the background.
graphics.DrawLine(linePen, x+2, y+4, x+100, y+4);
graphics.DrawString(style.ToString(), this.Font, Brushes.DimGray, x + 104, y - 1);
//graphics.FillRectangle(Brushes.DimGray, mainRec);
//graphics.DrawRectangle(borderPen, Rectangle.Round( mainRec));
}
return borderRec;
}