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


C# Font.GetFontBitmap方法代码示例

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


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

示例1: UIColorPaletteRenderer

        /// <summary>
        /// </summary>
        /// <param name="anchor"></param>
        /// <param name="margin"></param>
        /// <param name="size"></param>
        /// <param name="zNear"></param>
        /// <param name="zFar"></param>
        public UIColorPaletteRenderer(int maxMarkerCount,
            CodedColor[] codedColors,
            System.Windows.Forms.AnchorStyles anchor, System.Windows.Forms.Padding margin,
            System.Drawing.Size size, int zNear, int zFar)
            : base(anchor, margin, size, zNear, zFar)
        {
            this.maxMarkerCount = maxMarkerCount;
            this.currentMarkersCount = maxMarkerCount;

            //// display this UI control's area.
            //this.StateList.Add(new ClearColorState());

            // color bar using texture.
            {
                var bar = new UIColorPaletteBarRenderer(
                    codedColors,
                System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right,
                new System.Windows.Forms.Padding(marginLeft, 1, marginRight, 0),
                new System.Drawing.Size(size.Width - marginLeft - marginRight, size.Height / 3),
                zNear, zFar);
                //this.StateList.Add(new ClearColorState(Color.Blue));
                this.Children.Add(bar);
                this.colorPaletteBar = bar;
            }
            // color bar using vec3 color(hidden as default state)
            // just to compare with color bar using texture.
            {
                var bar = new UIColorPaletteColoredBarRenderer(
                        maxMarkerCount, codedColors,
                    System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right,
                    new System.Windows.Forms.Padding(marginLeft, 1 + size.Height / 3, marginRight, 0),
                    new System.Drawing.Size(size.Width - marginLeft - marginRight, size.Height / 3),
                    zNear, zFar);
                //this.StateList.Add(new ClearColorState(Color.Blue));
                this.Children.Add(bar);
                this.colorPaletteBar2 = bar;
                bar.Enabled = false;
            }
            // white vertical lines.
            {
                var markers = new UIColorPaletteMarkersRenderer(maxMarkerCount,
                System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right,
                new System.Windows.Forms.Padding(marginLeft, 1, marginRight, 0),
                new System.Drawing.Size(size.Width - marginLeft - marginRight, size.Height / 2),
                zNear, zFar);
                //markers.StateList.Add(new ClearColorState(Color.Red));
                this.Children.Add(markers);
                this.markers = markers;
            }
            // labels that display values(float values)
            {
                int length = maxMarkerCount;
                var font = new Font("Arial", 32);
                for (int i = 0; i < length; i++)
                {
                    const int width = 100;
                    float distance = marginLeft;
                    distance += 2.0f * (float)i / (float)length * (float)(this.Size.Width - marginLeft - marginRight);
                    distance -= width / 2;
                    var label = new UIText(
                        System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Bottom,
                        new System.Windows.Forms.Padding((int)distance, 0, 0, 0),
                        new System.Drawing.Size(width, size.Height / 2), zNear, zFar,
                        font.GetFontBitmap("0123456789.eE+-").GetFontTexture(), 100);
                    label.Initialize();
                    //label.StateList.Add(new ClearColorState(Color.Green));
                    label.Text = ((float)i).ToShortString();
                    label.BeforeLayout += label_beforeLayout;
                    this.Children.Add(label);
                    this.labelList.Add(label);
                }
                this.currentMarkersCount = 2;
            }
        }
开发者ID:bitzhuwei,项目名称:CSharpGL,代码行数:81,代码来源:UIColorPaletteRenderer.cs

示例2: Form_Load

        private void Form_Load(object sender, EventArgs e)
        {
            foreach (var item in Enum.GetValues(typeof(PickingGeometryType)))
            {
                this.cmbPickingGeometryType.Items.Add(item);
            }
            this.cmbPickingGeometryType.SelectedIndex = 1;

            {
                var frmBulletinBoard = new FormBulletinBoard();
                //frmBulletinBoard.Dump = true;
                frmBulletinBoard.Show();
                this.bulletinBoard = frmBulletinBoard;
            }
            {
                //this.glCanvas1.ShowSystemCursor = false;
            }
            {
                // default(perspective)
                var camera = new Camera(
                    new vec3(15, 5, 0), new vec3(0, 0, 0), new vec3(0, 1, 0),
                    CameraType.Perspecitive, this.glCanvas1.Width, this.glCanvas1.Height);
                var rotator = new FirstPerspectiveManipulater();
                rotator.StepLength = 0.5f;
                rotator.Bind(camera, this.glCanvas1);
                var scene = new Scene(camera, this.glCanvas1);
                //scene.Cursor.Enabled = false;
                this.scene = scene;
                ViewPort rootViewPort = scene.RootViewPort;
                rootViewPort.ClearColor = Color.White;
                ViewPort viewPort = rootViewPort.Children[0];
                viewPort.ClearColor = Color.Gray;
                viewPort.BeforeLayout += viewPort_BeforeLayout;
                viewPort.AfterLayout += perspectiveViewPort_AfterLayout;
                this.glCanvas1.Resize += scene.Resize;
            }
            {
                // top
                var camera = new Camera(
                new vec3(0, 0, 25), new vec3(0, 0, 0), new vec3(0, 1, 0),
                CameraType.Perspecitive, this.glCanvas1.Width, this.glCanvas1.Height);
                ViewPort viewPort = new ViewPort(camera, AnchorStyles.None, new Padding(), new Size());
                viewPort.ClearColor = Color.Gray;
                viewPort.BeforeLayout += viewPort_BeforeLayout;
                viewPort.AfterLayout += topViewPort_AfterLayout;
                this.scene.RootViewPort.Children.Add(viewPort);
            }
            {
                // front
                var camera = new Camera(
                new vec3(0, 25, 0), new vec3(0, 0, 0), new vec3(0, 0, -1),
                CameraType.Perspecitive, this.glCanvas1.Width, this.glCanvas1.Height);
                ViewPort viewPort = new ViewPort(camera, AnchorStyles.None, new Padding(), new Size());
                viewPort.ClearColor = Color.Gray;
                viewPort.BeforeLayout += viewPort_BeforeLayout;
                viewPort.AfterLayout += frontViewPort_AfterLayout;
                this.scene.RootViewPort.Children.Add(viewPort);
            }
            {
                // left
                var camera = new Camera(
                new vec3(-25, 0, 0), new vec3(0, 0, 0), new vec3(0, 0, -1),
                CameraType.Perspecitive, this.glCanvas1.Width, this.glCanvas1.Height);
                ViewPort viewPort = new ViewPort(camera, AnchorStyles.None, new Padding(), new Size());
                viewPort.ClearColor = Color.Gray;
                viewPort.BeforeLayout += viewPort_BeforeLayout;
                viewPort.AfterLayout += leftViewPort_AfterLayout;
                this.scene.RootViewPort.Children.Add(viewPort);
            }
            {
                var uiAxis = new UIAxis(AnchorStyles.Left | AnchorStyles.Bottom,
              new Padding(3, 3, 3, 3), new Size(128, 128));
                uiAxis.Initialize();
                this.scene.RootUI.Children.Add(uiAxis);
            }
            {
                var font = new Font("Courier New", 32);
                var uiText = new UIText(AnchorStyles.Left | AnchorStyles.Bottom,
                    new Padding(0, 0, 0, 0), new Size(250, 20), -100, 100,
                   font.GetFontBitmap("[index: 0123456789]").GetFontTexture());
                uiText.Text = "";
                this.uiText = uiText;
                this.scene.RootUI.Children.Add(uiText);
            }
            {
                GroundRenderer ground = GroundRenderer.Create(new GroundModel(20));
                ground.Initialize();
                ground.Scale = new vec3(20, 20, 20);
                ground.WorldPosition = new vec3(0, 0, 0);
                SceneObject obj = ground.WrapToSceneObject(name: "Ground", generateBoundingBox: true);
                this.scene.RootObject.Children.Add(obj);
            }
            {
                bool useHighlightedPickingEffect = false;
                if (MessageBox.Show("Use highlighted picking effect?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                {
                    useHighlightedPickingEffect = true;
                }
                List<PickableRenderer> list = GetPickableRenderers();
                const float distance = 10;
//.........这里部分代码省略.........
开发者ID:bitzhuwei,项目名称:CSharpGL,代码行数:101,代码来源:Form18PickingInScene.Load.cs


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