当前位置: 首页>>代码示例>>C#>>正文


C# System.Drawing.Color.ToArgb方法代码示例

本文整理汇总了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;
 }
开发者ID:VivianGit,项目名称:LeagueSharp,代码行数:15,代码来源:TextExtensions.cs

示例2: PenPlus

 public PenPlus(Color color,
     float width)
 {
     Unit unit = Unit. UnitWorld;
     nativePen = null;
     lastResult = NativeMethods.GdipCreatePen1(color.ToArgb(),
                                 width, unit, out nativePen);
 }
开发者ID:misiek,项目名称:foo,代码行数:8,代码来源:PenPlus.cs

示例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);
 }
开发者ID:north0808,项目名称:haina,代码行数:8,代码来源:PenPlus.cs

示例4: SetColorKey

 public GpStatus SetColorKey(
      Color colorLow,
      Color colorHigh,
     ColorAdjustType type
     )
 {
     return SetStatus(NativeMethods.GdipSetImageAttributesColorKeys(
                                         nativeImageAttr,
                                         type,
                                         true,
                                         colorLow.ToArgb(),
                                         colorHigh.ToArgb()));
 }
开发者ID:misiek,项目名称:foo,代码行数:13,代码来源:ImageAttributesPlus.cs

示例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);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:15,代码来源:Pen.cs

示例6: SetPixel

public GpStatus SetPixel(
    int x, 
    int y, 
    Color color) 
{
    return SetStatus(NativeMethods.GdipBitmapSetPixel(
                                    (GpBitmap)(IntPtr)nativeImage,
        x, y,
        color.ToArgb()));
}
开发者ID:intille,项目名称:mitessoftware,代码行数:10,代码来源:BitmapPlus.cs

示例7: GetHBITMAP

public GpStatus GetHBITMAP(
    Color colorBackground,
    out HBITMAP hbmReturn
    )
{
    return SetStatus(NativeMethods.GdipCreateHBITMAPFromBitmap(
                                    (GpBitmap)(IntPtr)nativeImage,
                                        out hbmReturn,
                                        colorBackground.ToArgb()));
}
开发者ID:intille,项目名称:mitessoftware,代码行数:10,代码来源:BitmapPlus.cs

示例8: SolidBrushPlus

        public SolidBrushPlus(Color color)
        {
            GpSolidFill brush;

            lastResult = NativeMethods.GdipCreateSolidFill(color.ToArgb(), out brush);

            SetNativeBrush(brush);
        }
开发者ID:intille,项目名称:mitessoftware,代码行数:8,代码来源:BrushPlus.cs

示例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;
            }
        }
开发者ID:rad1oactive,项目名称:BetterExplorer,代码行数:46,代码来源:DragDropLib.cs

示例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);
        }
开发者ID:intille,项目名称:mitessoftware,代码行数:13,代码来源:BrushPlus.cs

示例11: SetLinearColors

 GpStatus SetLinearColors(Color color1,
                        Color color2)
 {
     return SetStatus(NativeMethods.GdipSetLineColors((GpLineGradient)nativeBrush,
                                                    color1.ToArgb(),
                                                    color2.ToArgb()));
 }
开发者ID:intille,项目名称:mitessoftware,代码行数:7,代码来源:BrushPlus.cs

示例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);
        }
开发者ID:intille,项目名称:mitessoftware,代码行数:18,代码来源:BrushPlus.cs

示例13: SetColor

 GpStatus SetColor(Color color)
 {
     return SetStatus(NativeMethods.GdipSetSolidFillColor((GpSolidFill)nativeBrush,
                                                        color.ToArgb()));
 }
开发者ID:intille,项目名称:mitessoftware,代码行数:5,代码来源:BrushPlus.cs

示例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()));
 }
开发者ID:misiek,项目名称:foo,代码行数:11,代码来源:PenPlus.cs

示例15: SetCenterColor

        public GpStatus SetCenterColor(Color color)
        {
            SetStatus(NativeMethods.GdipSetPathGradientCenterColor(
                           (GpPathGradient)nativeBrush,
                           color.ToArgb()));

            return lastResult;
        }
开发者ID:intille,项目名称:mitessoftware,代码行数:8,代码来源:BrushPlus.cs


注:本文中的System.Drawing.Color.ToArgb方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。