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


C# Color.ToUColor方法代码示例

本文整理汇总了C#中System.Drawing.Color.ToUColor方法的典型用法代码示例。如果您正苦于以下问题:C# Color.ToUColor方法的具体用法?C# Color.ToUColor怎么用?C# Color.ToUColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Drawing.Color的用法示例。


在下文中一共展示了Color.ToUColor方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ClearColor

 public void ClearColor(Color c, bool apply = true)
 {
     var colors = new UnityEngine.Color32[Width * Height];
     for (int i = 0; i < colors.Length; i++)
         colors[i] = c.ToUColor();
     uTexture.SetPixels32(colors);
     if (apply) Apply();
 }
开发者ID:Meragon,项目名称:Unity-WinForms,代码行数:8,代码来源:Bitmap.cs

示例2: SetPixel

 public void SetPixel(int x, int y, Color color)
 {
     uTexture.SetPixel(x, uTexture.height - y - 1, color.ToUColor());
 }
开发者ID:Meragon,项目名称:Unity-WinForms,代码行数:4,代码来源:Bitmap.cs

示例3: FillQuad

        public void FillQuad(Color color, PointF p1, PointF p2, PointF p3, PointF p4)
        {
            GL.Begin(GL.QUADS);

            GL.Color(color.ToUColor());

            GL.Vertex3(p1.X, p1.Y, 0);
            GL.Vertex3(p2.X, p2.Y, 0);
            GL.Vertex3(p3.X, p3.Y, 0);
            GL.Vertex3(p4.X, p4.Y, 0);

            GL.End();
        }
开发者ID:Meragon,项目名称:Unity-WinForms,代码行数:13,代码来源:Graphics.cs

示例4: DrawTexture

        public void DrawTexture(Texture texture, float x, float y, float width, float height, Color color, float angle, PointF pivot)
        {
            if (texture == null) return;

            if (Control != null)
                Control.Batches++;

            FillRate += width * height;

            GUI.color = color.ToUColor();
            if (!_group)
            {
                if (Control != null)
                {
                    var c_position = Control.PointToScreen(Point.Zero);

                    x += c_position.X;
                    y += c_position.Y;
                }

                if (angle != 0)
                {
                    Matrix4x4 matrixBackup = GUI.matrix;
                    GUIUtility.RotateAroundPivot(angle, new Vector2(x + pivot.X, y + pivot.Y));
                    GUI.DrawTexture(new Rect(x, y, width, height), texture);
                    GUI.matrix = matrixBackup;
                }
                else
                    GUI.DrawTexture(new Rect(x, y, width, height), texture);
            }
            else
            {
                if (Control != null)
                {
                    var c_position = Control.PointToScreen(Point.Zero);
                    var g_position = _groupControlLast.PointToScreen(Point.Zero);

                    x += c_position.X - g_position.X;
                    y += c_position.Y - g_position.Y;
                }

                if (angle != 0)
                {
                    Matrix4x4 matrixBackup = GUI.matrix;
                    GUIUtility.RotateAroundPivot(angle, new Vector2(x + pivot.X, y + pivot.Y));
                    GUI.DrawTexture(new Rect(x, y, width, height), texture);
                    GUI.matrix = matrixBackup;
                }
                else
                    GUI.DrawTexture(new Rect(x, y, width, height), texture);
            }
        }
开发者ID:Meragon,项目名称:Unity-WinForms,代码行数:52,代码来源:Graphics.cs

示例5: DrawString

        public void DrawString(string s, Font font, Color color, float x, float y, float width, float height, ContentAlignment alignment)
        {
            if (NoStrings) return;
            if (color.A <= 0) return;
            if (string.IsNullOrEmpty(s)) return;

            if (Control != null)
                Control.Batches += 1;
            FillRate += width * height;

            GUI.skin.label.alignment = TextAnchor.UpperLeft;
            switch (alignment)
            {
                case ContentAlignment.BottomCenter:
                    GUI.skin.label.alignment = TextAnchor.LowerCenter;
                    break;
                case ContentAlignment.BottomLeft:
                    GUI.skin.label.alignment = TextAnchor.LowerLeft;
                    break;
                case ContentAlignment.BottomRight:
                    GUI.skin.label.alignment = TextAnchor.LowerRight;
                    break;
                case ContentAlignment.MiddleCenter:
                    GUI.skin.label.alignment = TextAnchor.MiddleCenter;
                    break;
                case ContentAlignment.MiddleLeft:
                    GUI.skin.label.alignment = TextAnchor.MiddleLeft;
                    break;
                case ContentAlignment.MiddleRight:
                    GUI.skin.label.alignment = TextAnchor.MiddleRight;
                    break;
                case ContentAlignment.TopCenter:
                    GUI.skin.label.alignment = TextAnchor.UpperCenter;
                    break;
                case ContentAlignment.TopLeft:
                    GUI.skin.label.alignment = TextAnchor.UpperLeft;
                    break;
                case ContentAlignment.TopRight:
                    GUI.skin.label.alignment = TextAnchor.UpperRight;
                    break;
            }

            int guiSkinFontSizeBuffer = GUI_SetLabelFont(font);
            GUI.color = color.ToUColor();

            if (!_group)
            {
                Point c_position = Point.Empty;
                if (Control != null)
                    c_position = Control.PointToScreen(Point.Zero);
                GUI.Label(new Rect(c_position.X + x, c_position.Y + y, width, height), s);
            }
            else
            {
                //Point c_position = Point.Empty;
                //if (Control != null)
                //  c_position = Control.PointToScreen(Point.Zero);
                //var g_position = _groupControlLast.PointToScreen(Point.Zero);
                //var position = c_position - g_position + new PointF(x, y);

                GUI.Label(new Rect(x, y, width, height), s);
            }

            GUI.skin.label.fontSize = guiSkinFontSizeBuffer;
        }
开发者ID:Meragon,项目名称:Unity-WinForms,代码行数:65,代码来源:Graphics.cs

示例6: FillRectangle

        public void FillRectangle(Color color, float x, float y, float width, float height)
        {
            if (NoFill) return;
            if (color.A <= 0) return;

            if (Control != null)
                Control.Batches += 1;

            FillRate += width * height;

            GUI.color = color.ToUColor();
            if (!_group)
            {
                Point c_position = Point.Empty;
                if (Control != null)
                    c_position = Control.PointToScreen(Point.Zero);

                GUI.DrawTexture(new Rect(c_position.X + x, c_position.Y + y, width, height), System.Windows.Forms.ApplicationBehaviour.DefaultSprite);
            }
            else
            {
                Point c_position = Point.Empty;
                if (Control != null)
                    c_position = Control.PointToScreen(Point.Zero);
                var g_position = _groupControlLast.PointToScreen(Point.Zero);

                x += c_position.X - g_position.X;
                y += c_position.Y - g_position.Y;

                GUI.DrawTexture(new Rect(x, y, width, height), System.Windows.Forms.ApplicationBehaviour.DefaultSprite);
                //UnityEngine.Graphics.DrawTexture(new Rect(c_position.X - g_position.X + x, c_position.Y - g_position.Y + y, width, height), System.Windows.Forms.Application.DefaultSprite, new Rect(), 0, 0, 0, 0, brush.Color.ToUColor(), DefaultMaterial);
            }
        }
开发者ID:Meragon,项目名称:Unity-WinForms,代码行数:33,代码来源:Graphics.cs


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