예제 #1
0
        protected override void OnDrawItem(DrawItemEventArgs e)
        {
            e.DrawBackground();
            Graphics g = e.Graphics;

            if (e.Index >= 0)
            {
                string name = (string)Items[e.Index];
                using (TextObject sample = new TextObject())
                {
                    sample.Bounds    = new RectangleF(e.Bounds.Left + 2, e.Bounds.Top + 2, e.Bounds.Width - 4, e.Bounds.Height - 4);
                    sample.Text      = name;
                    sample.HorzAlign = HorzAlign.Center;
                    sample.VertAlign = VertAlign.Center;
                    if (FStyles != null)
                    {
                        int index = FStyles.IndexOf(name);
                        if (index != -1)
                        {
                            sample.ApplyStyle(FStyles[index]);
                        }
                    }
                    using (GraphicCache cache = new GraphicCache())
                    {
                        sample.Draw(new FRPaintEventArgs(g, 1, 1, cache));
                    }
                }
            }
        }
예제 #2
0
        private void ComboBox_DrawItem(object sender, DrawItemEventArgs e)
        {
            e.DrawBackground();
            Graphics g = e.Graphics;

            if ((e.State & DrawItemState.ComboBoxEdit) > 0)
            {
                TextRenderer.DrawText(g, ComboBoxEx.Text, e.Font, e.Bounds.Location, e.ForeColor, e.BackColor);
            }
            else if (e.Index >= 0)
            {
                string name = (string)Items[e.Index];
                using (TextObject sample = new TextObject())
                {
                    sample.Bounds    = new RectangleF(e.Bounds.Left + 2, e.Bounds.Top + 2, e.Bounds.Width - 4, e.Bounds.Height - 4);
                    sample.Text      = name;
                    sample.HorzAlign = HorzAlign.Center;
                    sample.VertAlign = VertAlign.Center;
                    if (FReport != null)
                    {
                        int index = FReport.Styles.IndexOf(name);
                        if (index != -1)
                        {
                            sample.ApplyStyle(FReport.Styles[index]);
                        }
                    }
                    using (GraphicCache cache = new GraphicCache())
                    {
                        sample.Draw(new FRPaintEventArgs(g, 1, 1, cache));
                    }
                }
            }
        }
예제 #3
0
        private Bitmap GetImage(HighlightCondition c)
        {
            Bitmap bmp = new Bitmap(16, 16);

            using (Graphics g = Graphics.FromImage(bmp))
            {
                g.FillRectangle(Brushes.White, 0, 0, 16, 16);

                using (TextObject sample = new TextObject())
                {
                    sample.Bounds = new RectangleF(0, 0, 15, 15);
                    sample.ApplyCondition(c);
                    sample.Font      = new Font("Times New Roman", 12, FontStyle.Bold);
                    sample.Text      = "A";
                    sample.HorzAlign = HorzAlign.Center;
                    sample.VertAlign = VertAlign.Center;

                    using (GraphicCache cache = new GraphicCache())
                    {
                        sample.Draw(new FRPaintEventArgs(g, 1, 1, cache));
                    }
                }
            }

            return(bmp);
        }
예제 #4
0
        protected override void OnDraw(FrameEventArgs e)
        {
            _controlManager.Draw();

            _text.Draw();

            _triangle.Draw();
            _rectangle.Draw();
        }
예제 #5
0
파일: Label.cs 프로젝트: JAHva0/TriEngine
        public override void Draw()
        {
            base.Draw(_drawPosition);

            if (_textObject == null)
            {
                return;
            }

            _textObject.Draw();
        }
 public override void Draw(SpriteBatch batch)
 {
     for (int i = 0; i < Sprites.Count; i++)
     {
         Sprites[i].Draw(batch);
     }
     for (int i = 0; i < Objects.Count; i++)
     {
         Objects[i].Draw(batch);
     }
     player.Draw(batch);
     info.Draw(batch);
     base.Draw(batch);
 }
예제 #7
0
 private void pnSample_Paint(object sender, PaintEventArgs e)
 {
     if (CurrentStyle == null)
     {
         return;
     }
     FSample.ApplyStyle(CurrentStyle);
     FSample.Bounds    = new RectangleF(2, 2, pnSample.Width - 4, pnSample.Height - 4);
     FSample.HorzAlign = HorzAlign.Center;
     FSample.VertAlign = VertAlign.Center;
     using (GraphicCache cache = new GraphicCache())
     {
         FSample.Draw(new FRPaintEventArgs(e.Graphics, 1, 1, cache));
     }
 }
예제 #8
0
 public override void Draw(SpriteBatch batch)
 {
     foreach (GameObject o in Objects)
     {
         o.Draw(batch);
     }
     foreach (GameObject o in Enemys)
     {
         o.Draw(batch);
     }
     player.Draw(batch);
     info.Draw(batch);
     button.Draw(batch);
     test.Draw(batch);
     base.Draw(batch);
 }
예제 #9
0
        private void pnSample_Paint(object sender, PaintEventArgs e)
        {
            if (CurrentCondition == null)
            {
                return;
            }

            TextObject sample = new TextObject();

            sample.Text = Res.Get("Misc,Sample");
            sample.ApplyCondition(CurrentCondition);
            sample.Bounds    = new RectangleF(2, 2, pnSample.Width - 4, pnSample.Height - 4);
            sample.HorzAlign = HorzAlign.Center;
            sample.VertAlign = VertAlign.Center;
            using (GraphicCache cache = new GraphicCache())
            {
                sample.Draw(new FRPaintEventArgs(e.Graphics, 1, 1, cache));
            }
        }
예제 #10
0
 public override void Draw()
 {
     Raylib.ClearBackground(Color.DARKGRAY);
     rect.Draw(col);
     centeredText.Draw();
 }
예제 #11
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(bgColor);

            spriteBatch.Begin();

            //Draw all objects
            if (!gameStarted)
            {
                spriteBatch.Draw(StartScreen, new Rectangle(0, 0,
                                                            graphics.GraphicsDevice.Viewport.Width,
                                                            graphics.GraphicsDevice.Viewport.Height), Color.White);
            }
            else if (!gameOver)
            {
                foreach (Sprite sprite in sprites)
                {
                    sprite.Draw(spriteBatch);
                }

                scoreLabel.Draw(spriteBatch);


                if (console.IsActivated())
                {
                    console.Draw(spriteBatch);
                }
            }
            else if (inHighScore)
            {
                spriteBatch.Draw(HighScoreScreen, new Rectangle(0, 0, graphics.GraphicsDevice.Viewport.Width, graphics.GraphicsDevice.Viewport.Height), Color.White);
                List <TextObject> scoreLabels = new List <TextObject>();

                for (int i = 0; i < HighScores.Count; i++)
                {
                    int sW = graphics.GraphicsDevice.Viewport.Width;
                    int sH = graphics.GraphicsDevice.Viewport.Height;
                    if (i == 9)
                    {
                        scoreLabels.Add(new TextObject("[" + (i + 1) + "]:   " + HighScores[i].ToString(), font, Color.Black, false));
                    }
                    else
                    {
                        scoreLabels.Add(new TextObject("[" + (i + 1) + "]:    " + HighScores[i].ToString(), font, Color.Black, false));
                    }
                    scoreLabels[i].Position = new Vector2(sW / 3, sH / 5 + sH / 15 * i);
                    scoreLabels[i].Draw(spriteBatch);
                }
            }
            else if (gameWon)
            {
                soundPlayer.PauseMusic();
                spriteBatch.Draw(WinScreen, new Rectangle(0, 0, graphics.GraphicsDevice.Viewport.Width, graphics.GraphicsDevice.Viewport.Height), Color.White);
            }
            else if (!gameWon)
            {
                soundPlayer.PauseMusic();
                spriteBatch.Draw(LoseScreen, new Rectangle(0, 0, graphics.GraphicsDevice.Viewport.Width, graphics.GraphicsDevice.Viewport.Height), Color.White);
            }

            spriteBatch.End();


            base.Draw(gameTime);
        }
예제 #12
0
 public override void Draw(GameTime gameTime, SpriteBatch spriteBatch)
 {
     base.Draw(gameTime, spriteBatch);
     Input.Draw(gameTime, spriteBatch);
 }