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


C# Button.Draw方法代码示例

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


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

示例1: Main

    static void Main()
    {
        Button BtnStart = new Button();
        BtnStart.Draw();
        BtnStart.Click += GameStart;
        Console.WriteLine("S:게임 시작 , E:끝");
        for (; ; )
        {
            if (Console.KeyAvailable)
            {
                ConsoleKeyInfo cki;
                cki = Console.ReadKey();
                if (cki.Key == ConsoleKey.S)
                {
                    BtnStart.OnClick();
                }
                if (cki.Key == ConsoleKey.E)
                {
                    break;
                }

            }
            System.Threading.Thread.Sleep(100);
        }
    }
开发者ID:gawallsibya,项目名称:BIT_MFC-CShap-DotNet,代码行数:25,代码来源:Program.cs

示例2: DrawItems

 public static void DrawItems(SpriteBatch batch, Character player)
 {
     ClearLists();
     var buttonPos = 0;
     Rectangle rec = new Rectangle(buttonPos - ContentLoader.Button.Width, ContentLoader.GrassyBackground.Height, ContentLoader.Button.Width, ContentLoader.Button.Height);
     if (DrawMedicine) {
         foreach (var item in player.Inventory.Medicine.Where(x => x.Value.Amount > 0)) {
             var b = new Button(new Rectangle(rec.X += ContentLoader.Button.Width, rec.Y + (ContentLoader.Button.Height * 2), rec.Width, rec.Height),
                     ContentLoader.Button);
             b.Draw(batch);
             MedicineButtons.Add(new ContainerButton(b, item.Value));
             batch.Draw(item.Value.Sprite, new Vector2(b.Position.X + (item.Value.Sprite.Width / 2), b.Position.Y), Color.White);
             batch.DrawString(ContentLoader.Arial, $"{item.Value.Amount}x",
                 new Vector2(b.Position.X, b.Position.Y + ContentLoader.Button.Height), Color.White);
         }
     }
     if (DrawCapture) {
         foreach (var item in player.Inventory.Captures.Where(x => x.Value.Amount > 0)) {
             var b = new Button(new Rectangle(rec.X += ContentLoader.Button.Width, rec.Y + (ContentLoader.Button.Height * 2), rec.Width, rec.Height),
                 ContentLoader.Button) { Text = item.Value.Name };
             b.Draw(batch);
             CaptureButtons.Add(new ContainerButton(b, item.Value));
             batch.Draw(item.Value.Sprite, new Vector2(b.Position.X + (item.Value.Sprite.Width / 2), b.Position.Y), Color.White);
             batch.DrawString(ContentLoader.Arial, $"{item.Value.Amount}x",
                 new Vector2(b.Position.X, b.Position.Y + ContentLoader.Button.Height), Color.White);
         }
     }
 }
开发者ID:DuckDefense,项目名称:duck,代码行数:28,代码来源:Drawer.cs

示例3: DrawInventory

        public static void DrawInventory(SpriteBatch batch, Character player)
        {
            ClearLists();
            var buttonPos = 0;
            Rectangle rec = new Rectangle(buttonPos - ContentLoader.Button.Width, ContentLoader.GrassyBackground.Height, ContentLoader.Button.Width, ContentLoader.Button.Height);
            bMedicine = new Button(new Rectangle(rec.X += ContentLoader.Button.Width, rec.Y + ContentLoader.Button.Height, rec.Width, rec.Height),
                ContentLoader.Button, "Medicine", ContentLoader.Arial);
            bCapture = new Button(new Rectangle(rec.X += ContentLoader.Button.Width, rec.Y + ContentLoader.Button.Height, rec.Width, rec.Height),
                ContentLoader.Button, "Capture", ContentLoader.Arial);

            bMedicine.Draw(batch);
            bCapture.Draw(batch);
            InventoryButtons.AddMany(bMedicine, bCapture);
            DrawItems(batch, player);
        }
开发者ID:DuckDefense,项目名称:duck,代码行数:15,代码来源:Drawer.cs

示例4: DrawParty

        public static void DrawParty(SpriteBatch batch, Character player)
        {
            ClearLists();
            var party = player.Monsters;
            var buttonPos = 0;
            Rectangle rec = new Rectangle(buttonPos - ContentLoader.Button.Width, ContentLoader.GrassyBackground.Height, ContentLoader.Button.Width, ContentLoader.Button.Height);

            foreach (var monster in party) {
                if (monster.UId != party[0].UId) {
                    if (!monster.IsDead) {
                        var rect = new Rectangle(rec.X += ContentLoader.Button.Width,
                            rec.Y + ContentLoader.Button.Height, rec.Width, rec.Height);
                        var b = new Button(rect, ContentLoader.Button);
                        b.Draw(batch);
                        batch.Draw(monster.PartySprite, new Vector2(rect.X + monster.PartySpriteSize.X - 4, rect.Y + 4),
                            monster.SourceRectangle, Color.White);
                        PartyButtons.Add(new ContainerButton(b, monster));
                    }
                }
            }
        }
开发者ID:DuckDefense,项目名称:duck,代码行数:21,代码来源:Drawer.cs

示例5: DrawMoves

 public static void DrawMoves(SpriteBatch batch, Character player)
 {
     ClearLists();
     var buttonPos = 0;
     float widthMultiplier = 1.5f;
     //Position.X + ((Position.Width - stringsize.X) / 2)
     Rectangle rec = new Rectangle(buttonPos - Convert.ToInt32(ContentLoader.Button.Width * widthMultiplier), ContentLoader.GrassyBackground.Height, ContentLoader.Button.Width, ContentLoader.Button.Height);
     foreach (var move in player.Monsters[0].Moves) {
         var stringsize = ContentLoader.Arial.MeasureString($"{move.Uses}/{move.MaxUses}");
         var b = new Button(new Rectangle(rec.X += Convert.ToInt32(ContentLoader.Button.Width * widthMultiplier), rec.Y + ContentLoader.Button.Height, Convert.ToInt32(rec.Width * widthMultiplier), rec.Height), ContentLoader.Button, $"{move.Name}", ContentLoader.Arial);
         var typeRec = new Rectangle(rec.X + ((b.Position.Width - ContentLoader.NormalType.Width) / 2), rec.Y + ContentLoader.Button.Height + (ContentLoader.NormalType.Height * 2), ContentLoader.NormalType.Width, ContentLoader.NormalType.Height);
         var usesRec = new Rectangle(rec.X + Convert.ToInt32((b.Position.Width - stringsize.X) / 2), rec.Y + (ContentLoader.Button.Height + (ContentLoader.NormalType.Height * 3)), ContentLoader.NormalType.Width, ContentLoader.NormalType.Height);
         b.Draw(batch);
         batch.Draw(GetTypeTexture(move.Type), typeRec, Color.White);
         batch.DrawString(ContentLoader.Arial, $"{move.Uses}/{move.MaxUses}", new Vector2(usesRec.X, usesRec.Y), Color.White);
         MoveButtons.Add(new ContainerButton(b, move));
     }
 }
开发者ID:DuckDefense,项目名称:duck,代码行数:18,代码来源:Drawer.cs

示例6: DrawButton

 // return value indicates if the thumbnail of the button was not painted and we need to create them after
 bool DrawButton(Cairo.Context cr, Button button)
 {
     if (asynchronous == false ||
         (asynchronous == true && button.IsThumbnailCreated)) {
         // In the button object the image is already loaded and cached
         button.Draw (cr, project);
         return false;
     }
     return true;
 }
开发者ID:GNOME,项目名称:mistelix,代码行数:11,代码来源:DvdMenu.cs


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