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


C# Drawing.BufferedGraphics类代码示例

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


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

示例1: draw

        public void draw(MazeGenerator maze, BufferedGraphics buffer, int[,] mazeArray)
        {

            for (int i = 0; i < maze.height; i++)
            {
                for (int j = 0; j < maze.width; j++)
                {
                    if (mazeArray[i, j] == 2)
                    {
                        if (j < 24 && mazeArray[i, j + 1] == 0)
                        {
                            buffer.Graphics.DrawImage(Image3, new Rectangle(20 * i, 20 * j, 20, 20));
                        }
                        else
                        {
                            buffer.Graphics.DrawImage(Image1, new Rectangle(20 * i, 20 * j, 20, 20));
                        }
                    }
                    else
                    {
                        buffer.Graphics.DrawImage(Image2, new Rectangle(20 * i, 20 * j, 20, 20));

                    }
                }

            }
        }
开发者ID:Ripazhakgggdkp,项目名称:ProyectoAlgoritmos,代码行数:27,代码来源:Renderer.cs

示例2: DrawerWnd

        public DrawerWnd(CDrawer dr)
        {
            InitializeComponent();

            // use the log as built from parent
            _log = dr._log;

            // save window size
            m_ciWidth = dr.m_ciWidth;
            m_ciHeight = dr.m_ciHeight;

            // cap delegates, this will be set by owner
            m_delRender = null;
            m_delMouseMove = null;
            m_delMouseLeftClick = null;
            m_delMouseRightClick = null;

            // cap/set references
            m_bgc = new BufferedGraphicsContext();
            m_bg = null;

            // create the bitmap for the underlay and clear it to whatever colour
            m_bmUnderlay = new Bitmap(dr.m_ciWidth, dr.m_ciHeight);    // docs say will use Format32bppArgb

            // fill the bitmap with the default drawer bb colour
            FillBB(Color.Black);

            // show that drawer is up and running
            _log.WriteLine("Drawer Started...");
        }
开发者ID:NigelColpitts,项目名称:GDIDrawer,代码行数:30,代码来源:DrawerWnd.cs

示例3: MainForm

        public MainForm()
        {
            InitializeComponent();

            _VideoWindow = new VideoWindow();
            _Brush = null;

            shemes = new Shemes();
            tscbShemes.Items.Clear();
            tscbShemes.Items.Add(shemes.GetCurrentShemeName());
            tscbShemes.SelectedIndex = 0;

            LoadLastShemeName();

            if (Program.PauseInsteadOfStop)
                tsmiPauseInsteadStop.Image = Properties.Resources.ok;
            else
                tsmiPauseInsteadStop.Image = null;

            brush = new SolidBrush(BackColor);
            this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true);
            this.Resize += new System.EventHandler(this.OnResize);
            this.Paint += new System.Windows.Forms.PaintEventHandler(this.OnPaint);

            UpdateRect();
            context = BufferedGraphicsManager.Current;
            context.MaximumBuffer = rect.Size;
            grafx = context.Allocate(this.CreateGraphics(), rect);
            DrawToBuffer(grafx.Graphics);

            _Runner = new Thread(Runner);
            _Runner.Start();

            _Loader = new Thread(new ParameterizedThreadStart(LoadTile));
        }
开发者ID:OpenJinglePlayer,项目名称:OpenJinglePlayer,代码行数:35,代码来源:MainForm.cs

示例4: Draw

        protected override void Draw(BufferedGraphics g)
        {
            if (!GInformation.Gameinfo.IsIngame)
                return;

            var iValidPlayerCount = GInformation.Gameinfo.ValidPlayerCount;

            if (iValidPlayerCount == 0)
                return;

            if (GInformation.Player.Count <= 0)
                return;

            var iSingleHeight = Height;
            var fNewFontSize = (float) ((29.0/100)*iSingleHeight);

            var dtTimeStamp = DateTime.Now;

            var strTime = dtTimeStamp.ToLongTimeString();
            g.Graphics.DrawString(
                "Time: " + strTime,
                new Font("Century Gothic", fNewFontSize, FontStyle.Regular),
                Brushes.White,
                Brushes.Black, (float) ((13.67/100)*Width),
                (float) ((24.0/100)*iSingleHeight),
                1f, 1f, true);
        }
开发者ID:hfenigma,项目名称:AnotherSc2Hack,代码行数:27,代码来源:PersonalClockRenderer.cs

示例5: Form1

        public Form1()
        {
            InitializeComponent();
            this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true);

            this.Width = 640;
            this.Height = 480;
            pnlRenderArea.Top = 0;
            pnlRenderArea.Left = 0;
            pnlRenderArea.Width = ClientRectangle.Width;
            pnlRenderArea.Height = ClientRectangle.Height;

            // Retrieves the BufferedGraphicsContext for the
            // current application domain.
            context = BufferedGraphicsManager.Current;

            // Sets the maximum size for the primary graphics buffer
            // of the buffered graphics context for the application
            // domain.  Any allocation requests for a buffer larger
            // than this will create a temporary buffered graphics
            // context to host the graphics buffer.
            context.MaximumBuffer = new Size(this.Width + 1, this.Height + 1);

            // Allocates a graphics buffer the size of this form
            // using the pixel format of the Graphics created by
            // the Form.CreateGraphics() method, which returns a
            // Graphics object that matches the pixel format of the form.
            grafx = GetGraphics(pnlRenderArea);
        }
开发者ID:jmoral4,项目名称:Tears,代码行数:29,代码来源:Form1.cs

示例6: MainForm

        public MainForm()
        {
            InitializeComponent();

            this.currentFileData = new GameData(32, 32);
            this.currentFileName = null;

            this.toolImages = new TextureBrush[7];

            for (int i = 0; i < this.toolImages.Length; i++)
            {
                this.toolImages[i] = new TextureBrush(Image.FromFile("images/" + i + ".png"));
            }

            this.backgroundImage = new TextureBrush(Image.FromFile("images/checkerboard.png"));

            this.selectedTool = 1;

            this.graphicsContext = BufferedGraphicsManager.Current;
            this.graphics = graphicsContext.Allocate(this.StageEditBoard.CreateGraphics(),
                new Rectangle(0, 0, 32 * (int)EDIT_BOARD_SCALING, 32 * (int)EDIT_BOARD_SCALING));

            for(int i = 0; i < MainForm.DIRECTIONS.Length; i++)
                this.StartDirection.Items.Add(DIRECTIONS[i]);

            this.LoadTextureFiles();

            this.FileNew(null, null);
        }
开发者ID:erbuka,项目名称:andrea,代码行数:29,代码来源:MainForm.cs

示例7: InitializeGraphics

 private void InitializeGraphics()
 {
     this.DoubleBuffered = true;
     graphics = mainPictureBox.CreateGraphics();
     bufferedGraphicsContext = new BufferedGraphicsContext();
     bufferedGraphics = bufferedGraphicsContext.Allocate(graphics, new Rectangle(0, 0, mainPictureBox.Width, mainPictureBox.Height));
 }
开发者ID:andyskl,项目名称:cell-auto,代码行数:7,代码来源:MainForm.cs

示例8: GameWorld

        private double t; // used for the level timer

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Constructor that sets up graphics buffer and gameworld
        /// </summary>
        /// <param name="dc">Graphics object from the form</param>
        /// <param name="displayRectangle">Rectangle that is the size of the graphics object</param>
        public GameWorld(Graphics dc, Rectangle displayRectangle)
        {
            buffer = BufferedGraphicsManager.Current.Allocate(dc, displayRectangle);
            this.dc = buffer.Graphics;
            m = new Menu(this.dc);
            SetupGameWorld();
        }
开发者ID:Kaninfisk,项目名称:Dash-projekt,代码行数:18,代码来源:GameWorld.cs

示例9: update

        public void update(BufferedGraphics buffer) 
        {
          //  PlayerSpaw();

            //=====balas========
            if (crea1==true)
            {
                balas[indicador].mover();

                if (limit()==true)
                    crea1 = false;
                
            }
            //=====power up ========
            if (cont == 10)
            {
                pu_Spawn(1);
                posiciona_PU();
                pu_draw(buffer);
                if (find_powerup() == true)
                {
                    cont = 0;
                }
            }
            
        }
开发者ID:Ripazhakgggdkp,项目名称:ProyectoAlgoritmos,代码行数:26,代码来源:Game.cs

示例10: frmPathFinderDemo_Load

        private void frmPathFinderDemo_Load(object sender, EventArgs e)
        {
            m_blnIsLoading = true;
            m_blnMouseDown = false;

            mGraphContext = BufferedGraphicsManager.Current;

            mBuffer1 = mGraphContext.Allocate(pnlViewPort.CreateGraphics(), pnlViewPort.DisplayRectangle);
            mBuffer1.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
            mBuffer1.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit;

            m_Pathfinder = new PathFinder();
            m_Pathfinder.InitialiseGraph(CELLS_UP, CELLS_DOWN, pnlViewPort.Width, pnlViewPort.Height);
            m_Pathfinder.InitialiseSourceTargetIndexes();

            m_Pathfinder.ShowGraph = MenuGraph.Checked;
            m_Pathfinder.ShowTiles = MenuTiles.Checked;

            m_intMouseGridIndex = -1;
            ResetButtonAlgos();

            m_Pathfinder.CurrentTerrainBrush = GetButtonTerrainBrush();

            ReDraw();

            m_blnIsLoading = false;
        }
开发者ID:Cloverseer,项目名称:thinksharp,代码行数:27,代码来源:frmPathFinderDemo.cs

示例11: Environment

 public Environment(BufferedGraphics g, ImageList newEntities, int size, int newIterations, int newDuration)
 {
     rnd = new Random(System.Environment.TickCount);
       stats = new Dictionary<STATISTIC, double>();
       results = new List<string>();
       messageQueue = new MessageQueue();
       Environment a = this;
       executionTree = new ExecutionTree(ref a);
       entities = newEntities;
       device = g;
       WorkerSupportsCancellation = true;
       speed = 5;
       // Determine the percent chance that a new agent will be introduced into the environment.
       // The higher the chance the more likely the size of the population will be larger.
       if (size == 0)
     populationSize = 0.10;
       else if (size == 1)
     populationSize = 0.25;
       else if (size == 2)
     populationSize = 0.50;
       // Set the run parameters
       iterations = newIterations;
       duration = newDuration * 60;
       timer = new TimeSpan();
 }
开发者ID:stevenandrewcarter,项目名称:COG,代码行数:25,代码来源:Environment.cs

示例12: frmCogMain

 public frmCogMain()
 {
     InitializeComponent();
       // Create a new Environment
       Graphics g = Graphics.FromHwnd(pnlSimulation.Handle);
       context = BufferedGraphicsManager.Current;
       context.MaximumBuffer = new Size((int)g.VisibleClipBounds.Width + 1, (int)g.VisibleClipBounds.Height + 1);
       grafx = context.Allocate(g, new Rectangle(0, 0, (int)g.VisibleClipBounds.Width, (int)g.VisibleClipBounds.Height));
       this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
       env = new Clockwork.Environment(grafx, imgDrawList, COG_Model.Properties.Settings.Default.NumberOfAgents,
                               (int)COG_Model.Properties.Settings.Default.NumberIterations, (int)COG_Model.Properties.Settings.Default.TimeIteration);
       // Register the events
       env.NewAgent += new Clockwork.Environment.NewAgentCallBack(env_NewAgent);
       env.DeleteAgent += new Clockwork.Environment.DeleteAgentCallBack(env_DeleteAgent);
       env.StatUpdate += new Clockwork.Environment.StatUpdateCallBack(env_StatUpdate);
       env.TimerChange += new Clockwork.Environment.TimerCallBack(env_TimerChange);
       env.Complete += new Clockwork.Environment.CompleteCallBack(env_Complete);
       env.New();
       // Disable the run controls
       btnStop.Enabled = false;
       // Add the Execution plan tree to the display
       executionTree = new ucExecutionTree(ref env);
       executionTree.Dock = DockStyle.Fill;
       spltInfo.Panel2.Controls.Add(executionTree);
 }
开发者ID:stevenandrewcarter,项目名称:COG,代码行数:25,代码来源:FrmCogMain.cs

示例13: AllocBuffer

 private BufferedGraphics AllocBuffer(Graphics targetGraphics, IntPtr targetDC, Rectangle targetRectangle)
 {
     if (Interlocked.CompareExchange(ref this.busy, 1, 0) != 0)
     {
         return this.AllocBufferInTempManager(targetGraphics, targetDC, targetRectangle);
     }
     this.targetLoc = new Point(targetRectangle.X, targetRectangle.Y);
     try
     {
         Graphics graphics;
         if (targetGraphics != null)
         {
             IntPtr hdc = targetGraphics.GetHdc();
             try
             {
                 graphics = this.CreateBuffer(hdc, -this.targetLoc.X, -this.targetLoc.Y, targetRectangle.Width, targetRectangle.Height);
             }
             finally
             {
                 targetGraphics.ReleaseHdcInternal(hdc);
             }
         }
         else
         {
             graphics = this.CreateBuffer(targetDC, -this.targetLoc.X, -this.targetLoc.Y, targetRectangle.Width, targetRectangle.Height);
         }
         this.buffer = new BufferedGraphics(graphics, this, targetGraphics, targetDC, this.targetLoc, this.virtualSize);
     }
     catch
     {
         this.busy = 0;
         throw;
     }
     return this.buffer;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:35,代码来源:BufferedGraphicsContext.cs

示例14: GraphicDrawter

        protected BufferedGraphicsContext graphicContext = null; // методы сознания графичечких буферов

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Инициализирует новый экземпляр класса
        /// </summary>
        /// <param name="g">Повехность на которой необходимо выполнять рисование</param>
        /// <param name="FrameToDraw">Область и положение, занимаемое графиком калибровки на форме</param>
        public GraphicDrawter(Graphics g, Rectangle FrameToDraw)
        {
            graphicContext = BufferedGraphicsManager.Current;
            graphicBuffer = graphicContext.Allocate(g, FrameToDraw);

            graphicBuffer.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
            //graphicBuffer.Graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
        }
开发者ID:slawer,项目名称:sgt,代码行数:19,代码来源:GraphicDrawter.cs

示例15: SmoothPanel2

        public SmoothPanel2()
        {
            GraphicManager = BufferedGraphicsManager.Current;
            GraphicManager.MaximumBuffer = new Size(this.Width + 1, this.Height + 1);
            ManagedBackBuffer = GraphicManager.Allocate(this.CreateGraphics(), ClientRectangle);

            //SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true);
        }
开发者ID:hpavlov,项目名称:tangra3,代码行数:8,代码来源:SmoothPanel.cs


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