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


C# Microsoft.DrawString方法代码示例

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


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

示例1: Draw

        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch Sb, Graphics.PrimitiveRenderer Pr)
        {
            StringBuilder str = new StringBuilder();

            if (Left.Damage == Right.Damage)
                str.AppendLine("Draw!");
            else {
                str.Append("Winrar: ");
                if (Left.Damage < Right.Damage)
                    str.AppendLine("Player 1!");
                else
                    str.AppendLine("Player 2!");
            }
            str.AppendLine("Press Enter to return to track select...");
            Sb.Begin();
            Sb.DrawString(sysFont, str, resultsTextPosition, Color.White);

            str.Clear();
            str.AppendLine("Player 1\n");
            str.AppendFormat("Result score: {0}\n", Left.Score);
            str.AppendFormat("Final health: {0}\n", Left.Health);
            str.AppendFormat("Damage dealt: {0}\n", Left.Damage);
            Sb.DrawString(sysFont, str, LeftResultPosition, Color.White);

            str.Clear();
            str.AppendLine("Player 2\n");
            str.AppendFormat("Result score: {0}\n", Right.Score);
            str.AppendFormat("Final health: {0}\n", Right.Health);
            str.AppendFormat("Damage dealt: {0}\n", Right.Damage);
            Sb.DrawString(sysFont, str, RightResultPosition, Color.White);

            Sb.End();
        }
开发者ID:NamiKuro,项目名称:College-Projects,代码行数:33,代码来源:ResultsState.cs

示例2: Draw

        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, PrimitiveDrawer primitiveDrawer, FontHandler fontHandler, Microsoft.Xna.Framework.Graphics.GraphicsDevice graphicsDevice)
        {
            String text = mode ? "True" : "False";
            Color color = !GetSelected() ? colorA : colorB;

            Rectangle numRect = this.ToRectangle();
            numRect.Width = boolWidth;

            Rectangle rect = this.ToRectangle();

            this.width = (rect.Width = (int)fontHandler.GetVerdana().MeasureString(" " + text + " ").X + 3) + boolWidth;

            rect.X += boolWidth;
            primitiveDrawer.DrawRoundedRectangle(graphicsDevice, rect, color);
            primitiveDrawer.DrawRoundedRectangle(graphicsDevice, numRect, new Color(0x3D, 0x70, 0xBC));
            Vector2 vector = this.GetVector();

            vector.X += 3;
            vector.Y += 3;

            spriteBatch.DrawString(fontHandler.GetVerdana(), " Bool ", vector + TetrisGameRunner.GetOffsetVector(), Color.White);

            vector.X += boolWidth - 3;

            spriteBatch.DrawString(fontHandler.GetVerdana(), " " + text + " ", vector + TetrisGameRunner.GetOffsetVector(), Color.White);
            spriteBatch.End();
            spriteBatch.Begin();
        }
开发者ID:TheCreatorJames,项目名称:TajTetrisGame,代码行数:28,代码来源:BooleanDragDrop.cs

示例3: Draw

        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, PrimitiveDrawer primitiveDrawer, FontHandler fontHandler, Microsoft.Xna.Framework.Graphics.GraphicsDevice graphicsDevice)
        {
            Rectangle numRect = this.ToRectangle();
            numRect.Width = strWidth;

            Rectangle rect = this.ToRectangle();
            this.width = (rect.Width = (int)fontHandler.GetVerdana().MeasureString(" " + formatText(fontHandler) + " ").X + 3) + strWidth;
            rect.X += strWidth;

            if (this.text.Length > 0 || GetSelected())
                if (selected)
                {
                    primitiveDrawer.DrawRoundedRectangle(graphicsDevice, rect, colorB);
                }
                else
                {
                    primitiveDrawer.DrawRoundedRectangle(graphicsDevice, rect, colorA);
                }

            primitiveDrawer.DrawRoundedRectangle(graphicsDevice, numRect, storedColor);

            Vector2 vector = this.GetVector();

            vector.X += 3;

            vector.Y += 3;

            spriteBatch.DrawString(fontHandler.GetVerdana(), " Code ", vector + TetrisGameRunner.GetOffsetVector(), Color.White);

            vector.X += strWidth;

            spriteBatch.DrawString(fontHandler.GetVerdana(), " " + formatText(fontHandler) + " ", vector + TetrisGameRunner.GetOffsetVector(), Color.White);
            spriteBatch.End();
            spriteBatch.Begin();
        }
开发者ID:TheCreatorJames,项目名称:TajTetrisGame,代码行数:35,代码来源:CodeTextbox.cs

示例4: DrawAntrieb

        private void DrawAntrieb(Microsoft.Xna.Framework.Graphics.SpriteBatch sb, Antrieb antrieb)
        {
            int x = (int)(GetPosition().X);
            int y = (int)(GetPosition().Y);

            sb.DrawString(UIButton.FONT_DEFAULT, antrieb.Name, new Vector2(padding + x, padding + y), Color.Black);
            sb.DrawString(UIButton.FONT_DEFAULT, "Schaden: " + antrieb.Damage + " Feuerrate: " + antrieb.RateOfFire, new Vector2(padding + x, padding + y + lineHeight), Color.Black);
            sb.DrawString(UIButton.FONT_DEFAULT, "Gewicht: " + antrieb.Weight, new Vector2(padding + x, padding + y + lineHeight * 2), Color.Black);
        }
开发者ID:StWol,项目名称:Last-Man,代码行数:9,代码来源:UIInfoPanel.cs

示例5: Draw

        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch batch)
        {
            batch.DrawString(ResourceManager.bauhaus, "Username", new Vector2(5, 10), Color.Orange);
            batch.DrawString(ResourceManager.bauhaus, "Score", new Vector2(ACWGame.WIDTH - 100 - scoreWidth, 10), Color.Orange);

            for (int i = 0; i < 10; i++)
            {
                batch.DrawString(ResourceManager.bauhaus, (i + 1) + ". " + names[i], new Vector2(5, 40 + 40 * i), Color.Orange);
                batch.DrawString(ResourceManager.bauhaus, scores[i] + "", new Vector2(ACWGame.WIDTH - 100 - scoreWidths[i], 40 + 40 * i), Color.Orange);
            }

            batch.DrawString(ResourceManager.bauhaus, "Press select to continue...", textPos, Color.Orange);
        }
开发者ID:Numprt,项目名称:Alien_Banjos,代码行数:13,代码来源:HighscoreState.cs

示例6: Draw

        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
        {
            this.FrameCount++;
            spriteBatch.Begin();
            #if WINDOWS_PHONE

            long mem = Microsoft.Phone.Info.DeviceStatus.ApplicationCurrentMemoryUsage / 1024;

            spriteBatch.DrawString(Font, fps.ToString() + " Fps\n" + mem + " kb", Vector2.Zero, Color.White);
            #else
            spriteBatch.DrawString(Font, fps.ToString() + " Fps\n", Vector2.Zero, Color.White);
            #endif
            spriteBatch.End();
        }
开发者ID:patrickzip,项目名称:fries-and-furious,代码行数:14,代码来源:FPSDisplay.cs

示例7: Draw

 public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch sb)
 {
     sb.Draw(texture, area, color);
     if (state)
         sb.Draw(checkTexture, area, color);
     sb.DrawString(Fonts.Arial, name, labelPos, color);
 }
开发者ID:idaohang,项目名称:Helicopter-Autopilot-Simulator,代码行数:7,代码来源:Checkbox.cs

示例8: Draw

        public void Draw(Microsoft.Xna.Framework.Content.ContentManager content, Microsoft.Xna.Framework.Graphics.SpriteBatch batch)
        {
            if (font == null)
            {
                //Load the font
                font = content.Load<SpriteFont>(@"Fonts/LightText");
            }

            batch.Draw(content, SpriteManager.GetSprite(ColourSpriteName.WHITE), borderRect, Color.DarkGray);
            batch.Draw(content, SpriteManager.GetSprite(InterfaceSpriteName.PAPER_TEXTURE), rect, Color.White);

            batch.Draw(content, SpriteManager.GetSprite(InterfaceSpriteName.WOOD_TEXTURE), objectNameRect, Color.WhiteSmoke);
            batch.DrawString(font, treasureChest.Name, objectNameRect, Alignment.Center, Color.Black);

            batch.Draw(content, SpriteManager.GetSprite(InterfaceSpriteName.CLOSE), crossRect, Color.White);

            for (int i = 0; i < itemRectangles.Count; i++)
            {
                Rectangle r = itemRectangles[i];

                MapItem mi = null;

                if (treasureChest.Contents.Count > i)
                {
                    mi = treasureChest.Contents[i];
                    batch.Draw(content, mi.Graphics[0], r, Color.White);
                }

            }

            batch.DrawString(font, descriptionShown, descriptionRect, Alignment.Left, Color.Black);
            batch.Draw(content, SpriteManager.GetSprite(InterfaceSpriteName.WOOD_TEXTURE), takeAllRect, Color.White);
            batch.DrawString(font, "TAKE ALL", takeAllRect, Alignment.Center, Color.Black);
        }
开发者ID:Haedrian,项目名称:Divine-Right,代码行数:34,代码来源:LootComponent.cs

示例9: Draw

        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, PrimitiveDrawer primitiveDrawer, FontHandler fontHandler, Microsoft.Xna.Framework.Graphics.GraphicsDevice graphicsDevice)
        {
            if(varLink != null)
            {
                Vector2 vec = this.GetVector();
                this.varLink.SetVector(ref vec);
                this.SetWidth(varLink.GetWidth());
                this.SetHeight(varLink.GetHeight());

                varLink.Draw(spriteBatch, primitiveDrawer, fontHandler, graphicsDevice);
            }
            else
            {
                primitiveDrawer.DrawRoundedRectangle(graphicsDevice, this, colorA);
                Vector2 ve = fontHandler.GetVerdana().MeasureString(this.typeOfVariable);

                this.width = (int)ve.X + 3;
                this.height = 30;

                Vector2 vec = this.GetVector();
                vec.Y += 3;
                vec.X += 3;

                spriteBatch.DrawString(fontHandler.GetVerdana(), this.typeOfVariable, vec + TetrisGameRunner.GetOffsetVector(), Color.White);
                spriteBatch.End();
                spriteBatch.Begin();
            }
        }
开发者ID:TheCreatorJames,项目名称:TajTetrisGame,代码行数:28,代码来源:DragDropVariablePlaceholder.cs

示例10: Draw

 public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch pSpriteBatch)
 {
     pSpriteBatch.Begin();
     pSpriteBatch.DrawString(m_pFont, "LOADING", new Microsoft.Xna.Framework.Vector2(100, 100), Color.White);
     pSpriteBatch.End();
     base.Draw(pSpriteBatch);
 }
开发者ID:zoral,项目名称:dangerzone,代码行数:7,代码来源:LoadingScreen.cs

示例11: DrawAbovePlayers

        protected override void DrawAbovePlayers(Microsoft.Xna.Framework.Graphics.SpriteBatch sb)
        {
            sb.Begin(SpriteSortMode.Immediate, BlendState.NonPremultiplied, null, null, null, null, World.CamTransform);

            sb.DrawString(ArtAssets.WorldFont, "Blah", Vector2.Zero, Color.White, 0.0f, Vector2.Zero, WorldData.ZoomScaleAmount[World.CurrentZoom], SpriteEffects.None, 1.0f);

            sb.End();
        }
开发者ID:heyx3,项目名称:GGJ2014,代码行数:8,代码来源:Minigame4.cs

示例12: Draw

        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch batch, GameTime gameTime)
        {
            base.Draw(batch, gameTime);

            if (player != null)
                batch.DrawString(ProjectData.smallFont, dialogue, new Vector2(pos.X - (Position.X / 2), pos.Y -
                    ProjectData.smallFont.MeasureString(dialogue).Y - 2), Color.White);
        }
开发者ID:abenavente406,项目名称:Unnamed-RPG,代码行数:8,代码来源:NPC.cs

示例13: DrawTextCentered

        public static void DrawTextCentered(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, Vector2 position, Color color, string text)
        {
            if (_spriteFont == null) _spriteFont = GameObject.Content.Load<SpriteFont>("Fotograaf/Fonts/defaultfont");

            Vector2 boundingBox = _spriteFont.MeasureString(text);

            spriteBatch.DrawString(_spriteFont, text, new Vector2((float)Math.Ceiling(position.X - boundingBox.X / 2), position.Y), color);
        }
开发者ID:Gerjo,项目名称:Serious-game,代码行数:8,代码来源:Tools.cs

示例14: Draw

        public override void Draw(Microsoft.Xna.Framework.GameTime gameTime, Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
        {
            base.Draw(gameTime, spriteBatch);

            spriteBatch.DrawString(scoreFont, score.ToString(), scorePos, Color.White);
            spriteBatch.Draw(homeTex, new Vector2(70.0f, 650.0f), Color.White);
            spriteBatch.Draw(replayTex, new Vector2(820.0f, 650.0f), Color.White);
        }
开发者ID:davecheesefish,项目名称:DiscoBounce,代码行数:8,代码来源:EndGameScreen.cs

示例15: Draw

 public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch canvas, int x, int y, bool selected)
 {
     if (selected)
     {
         canvas.Draw(AssetLoader.diamond, new Rectangle(x - 50, y + 6, 40, 15), Color.White);
     }
     canvas.DrawString(AssetLoader.fnt_assetloadscreen, label, new Vector2(x, y), (selected)?Color.White:Color.Gray);
 }
开发者ID:justshiv,项目名称:LightSavers,代码行数:8,代码来源:DummyItem.cs


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