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


C# IGraphics.HintTextBackgroundColor方法代码示例

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


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

示例1: Draw


//.........这里部分代码省略.........

            g.DrawRectangle(Pens.Black, rect);

            g.DrawString(text, font2, Brushes.Red, rect, sf);

            sf.Alignment = StringAlignment.Center;

            g.FillRectangle(Brushes.Black, new Rectangle(230, 50, 140, 40));
            g.DrawString(text, font1, Brushes.Yellow, rect, sf);

            sf.Alignment = StringAlignment.Far;

            g.DrawString(text, font2, Brushes.Green, rect, sf);

            sf.Alignment = StringAlignment.Near;
            sf.LineAlignment = StringAlignment.Center;

            g.DrawString(text, font1, Brushes.Blue, rect, sf);

            sf = new StringFormat();
            sf.Alignment = StringAlignment.Far;
            sf.LineAlignment = StringAlignment.Far;

            g.DrawString("Far, Far, PointF", font2, Brushes.Green, new PointF(100.0f, 150.0f), sf);

            sf = new StringFormat();
            sf.LineAlignment = StringAlignment.Far;

            g.DrawString(text, font1, Brushes.DarkCyan, rect, sf);

            List<PointF> points = new List<PointF>();

            for (float x = 0.0f; x < (float)Math.PI * 6.0f; x += 0.01f)
            {
                points.Add(new PointF(x * (float)Math.Cos(x), x * (float)Math.Sin(x)));
            }

            Matrix m = new Matrix();

            for (int y = 0; y < 5; y++)
            {
                for (int x = 0; x < 5; x++)
                {
                    m.Reset();
                    m.Translate(x * 50.0f + 200.0f, y * 50.0f + 300.0f);
                    g.Transform = m;
                    g.DrawLines(new Pen(Color.Blue, 0.0f), points.ToArray());
                }
            }

            g.ResetTransform();

            g.DrawRectangle(new Pen(Color.Red, 0), new Rectangle(50, 150, 24, 24));
            g.DrawImage(Images.NavigateDown_48px, new Rectangle(50, 150, 24, 24));

            if (transparentBitmap == null)
            {
                ColorMatrix matrix = new ColorMatrix();
                matrix.Matrix33 = 0.4f; //opacity 0 = completely transparent, 1 = completely opaque
                transparentBitmap = GraphicsHelpers.BitmapFromImageAndColorMatrix(Images.NavigateDown_48px, matrix);
            }

            g.DrawRectangle(new Pen(Color.Red, 0), new Rectangle(100, 150, 24, 24));
            g.DrawImage(transparentBitmap, new Rectangle(100, 150, 24, 24));

            using (HatchBrush hatchBrush = new HatchBrush(HatchStyle.LightUpwardDiagonal, Color.Black, Color.Transparent))
            {
                g.FillRectangle(hatchBrush, new Rectangle(10, 10, 100, 20));
            }

            using (HatchBrush hatchBrush = new HatchBrush(HatchStyle.LightDownwardDiagonal, Color.Black, Color.Transparent))
            {
                g.FillRectangle(hatchBrush, new Rectangle(110, 10, 200, 20));
            }

            g.SmoothingMode = SmoothingMode.None;

            g.FillRectangle(Brushes.White, new Rectangle(0, 210, 510, 50));

            Rectangle rc = new Rectangle(520, 250, 300, 200);
            g.FillRectangle(Brushes.White, rc);

            g.HintTextBackgroundColor(Color.White);
            g.DrawString("OpenGL 3D Stuff", font1, Brushes.Black, 600.0f, 250.0f);

            if (g is GLGraphics)
                Draw3dStuff(g as GLGraphics, rc);

            Pen pen = new Pen(Color.Black, 0);
            pen.DashStyle = DashStyle.Dot;
            g.DrawLine(pen, new Point(10, 220), new Point(500, 220));
            pen.DashStyle = DashStyle.Dash;
            g.DrawLine(pen, new Point(10, 230), new Point(500, 230));
            pen.DashStyle = DashStyle.DashDot;
            g.DrawLine(pen, new Point(10, 240), new Point(500, 240));
            pen.DashStyle = DashStyle.DashDotDot;
            g.DrawLine(pen, new Point(10, 250), new Point(500, 250));

            //g.ResetClip();
        }
开发者ID:filipkunc,项目名称:GLGraphics,代码行数:101,代码来源:Form1.cs


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