本文整理汇总了C#中System.Drawing.Color.ToArgb方法的典型用法代码示例。如果您正苦于以下问题:C# System.Drawing.Color.ToArgb方法的具体用法?C# System.Drawing.Color.ToArgb怎么用?C# System.Drawing.Color.ToArgb使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Drawing.Color
的用法示例。
在下文中一共展示了System.Drawing.Color.ToArgb方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToHtml
/// <summary>
/// 将文字转换为Html输出格式
/// </summary>
/// <param name="form">要输出的内容</param>
/// <param name="FontName">字体名</param>
/// <param name="FontSize">字体大小</param>
/// <param name="FontColor">字体颜色</param>
/// <returns>格式化后的内容</returns>
public static string ToHtml(this string form, string FontName, int FontSize, Color FontColor)
{
string colorhx = "#" + FontColor.ToArgb().ToString("X6");
form = form.ToUTF8();
form = $"<font face=\"{FontName}\" size=\"{FontSize}\" color=\"{colorhx}\">{form}</font>";
return form;
}
示例2: PenPlus
public PenPlus(Color color,
float width)
{
Unit unit = Unit. UnitWorld;
nativePen = null;
lastResult = NativeMethods.GdipCreatePen1(color.ToArgb(),
width, unit, out nativePen);
}
示例3: PenPlus
public PenPlus(Color color, float width, bool opaque)
{
int c = color.ToArgb();
if (opaque) c |= (0xff << 24);
Unit unit = Unit.UnitWorld;
nativePen = null;
lastResult = GdiPlus.GdipCreatePen1(c, width, unit, out nativePen);
}
示例4: SetColorKey
public GpStatus SetColorKey(
Color colorLow,
Color colorHigh,
ColorAdjustType type
)
{
return SetStatus(NativeMethods.GdipSetImageAttributesColorKeys(
nativeImageAttr,
type,
true,
colorLow.ToArgb(),
colorHigh.ToArgb()));
}
示例5: Pen
public Pen(System.Drawing.Color color, float width)
{
this.color = color;
IntPtr zero = IntPtr.Zero;
int status = SafeNativeMethods.Gdip.GdipCreatePen1(color.ToArgb(), width, 0, out zero);
if (status != 0)
{
throw SafeNativeMethods.Gdip.StatusException(status);
}
this.SetNativePen(zero);
if (this.color.IsSystemColor)
{
SystemColorTracker.Add(this);
}
}
示例6: SetPixel
public GpStatus SetPixel(
int x,
int y,
Color color)
{
return SetStatus(NativeMethods.GdipBitmapSetPixel(
(GpBitmap)(IntPtr)nativeImage,
x, y,
color.ToArgb()));
}
示例7: GetHBITMAP
public GpStatus GetHBITMAP(
Color colorBackground,
out HBITMAP hbmReturn
)
{
return SetStatus(NativeMethods.GdipCreateHBITMAPFromBitmap(
(GpBitmap)(IntPtr)nativeImage,
out hbmReturn,
colorBackground.ToArgb()));
}
示例8: SolidBrushPlus
public SolidBrushPlus(Color color)
{
GpSolidFill brush;
lastResult = NativeMethods.GdipCreateSolidFill(color.ToArgb(), out brush);
SetNativeBrush(brush);
}
示例9: ReplaceTransparentPixelsWithTransparentKey
/// <summary>
/// Replaces any pixel with a zero alpha value with the specified transparency key.
/// </summary>
/// <param name="bmpData">The bitmap data in which to perform the operation.</param>
/// <param name="transKey">The transparency color. This color is rendered transparent
/// by the DragDropHelper.</param>
/// <remarks>
/// This function only supports 32-bit pixel formats for now.
/// </remarks>
private static void ReplaceTransparentPixelsWithTransparentKey(BitmapData bmpData, DrawingColor transKey)
{
DrawingPixelFormat pxFormat = bmpData.PixelFormat;
if (DrawingPixelFormat.Format32bppArgb == pxFormat
|| DrawingPixelFormat.Format32bppPArgb == pxFormat)
{
int transKeyArgb = transKey.ToArgb();
// We will just iterate over the data... we don't care about pixel location,
// just that every pixel is checked.
unsafe
{
byte* pscan = (byte*)bmpData.Scan0.ToPointer();
{
for (int y = 0; y < bmpData.Height; ++y, pscan += bmpData.Stride)
{
int* prgb = (int*)pscan;
for (int x = 0; x < bmpData.Width; ++x, ++prgb)
{
// If the alpha value is zero, replace this pixel's color
// with the transparency key.
if ((*prgb & 0xFF000000L) == 0L)
*prgb = transKeyArgb;
}
}
}
}
}
else
{
// If it is anything else, we aren't supporting it, but we
// won't throw, cause it isn't an error
System.Diagnostics.Trace.TraceWarning("Not converting transparent colors to transparency key.");
return;
}
}
示例10: HatchBrush
public HatchBrush(HatchStyle hatchStyle,
Color foreColor,
Color backColor)
{
GpHatch brush = new GpHatch();
lastResult = NativeMethods.GdipCreateHatchBrush(hatchStyle,
foreColor.ToArgb(),
backColor.ToArgb(),
out brush);
SetNativeBrush(brush);
}
示例11: SetLinearColors
GpStatus SetLinearColors(Color color1,
Color color2)
{
return SetStatus(NativeMethods.GdipSetLineColors((GpLineGradient)nativeBrush,
color1.ToArgb(),
color2.ToArgb()));
}
示例12: LinearGradientBrush
LinearGradientBrush(GpRect rect,
Color color1,
Color color2,
float angle,
bool isAngleScalable)
{
GpLineGradient brush = new GpLineGradient();
lastResult = NativeMethods.GdipCreateLineBrushFromRectWithAngleI(ref rect,
color1.ToArgb(),
color2.ToArgb(),
angle,
isAngleScalable,
WrapMode.WrapModeTile,
out brush);
SetNativeBrush(brush);
}
示例13: SetColor
GpStatus SetColor(Color color)
{
return SetStatus(NativeMethods.GdipSetSolidFillColor((GpSolidFill)nativeBrush,
color.ToArgb()));
}
示例14: SetColor
//PenType GetPenType()
//{
// PenType type;
// SetStatus(NativeMethods.GdipGetPenFillType(nativePen, out type));
// return type;
//}
public GpStatus SetColor(Color color)
{
return SetStatus(NativeMethods.GdipSetPenColor(nativePen,
color.ToArgb()));
}
示例15: SetCenterColor
public GpStatus SetCenterColor(Color color)
{
SetStatus(NativeMethods.GdipSetPathGradientCenterColor(
(GpPathGradient)nativeBrush,
color.ToArgb()));
return lastResult;
}