Ejemplo n.º 1
1
        public VideoRender(PictureBox view)
        {
            this.view = view;
			this.bufferContext = BufferedGraphicsManager.Current;
            this.foreground = new SolidBrush(Color.ForestGreen);
            this.background = new SolidBrush(Color.Black);
        }
Ejemplo n.º 2
0
        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...");
        }
Ejemplo n.º 3
0
        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));
        }
Ejemplo n.º 4
0
Archivo: Form1.cs Proyecto: rNdm74/C-
        private void Form1_Load(object sender, EventArgs e)
        {
            // Gets a reference to the current BufferedGraphicsContext
            currentContext = BufferedGraphicsManager.Current;

            // New random generator
            rGen = new Random();

            // Make Ships
            ships = new List<Ship>();
            for (int i = 0; i < SHIPS; i++)
                ships.Add(new Ship(rGen, canvas.Width, canvas.Height));

            // Make Bots
            bots = new List<Bot>();
            for (int i = 0; i < BOTS; i++)
                bots.Add(new Bot(rGen, canvas.Width, canvas.Height, i * 30));

            // Create the eventmanager
            eManager = new EventManager(rGen, bots, ships);

            // Load into objects list for move, update, draw
            objects = new List<SimulationObject>();
            objects.AddRange(ships);
            objects.AddRange(bots);

            // Start the timer
            clock.Enabled = true;
        }
Ejemplo n.º 5
0
 public UltraPanel()
 {
     X = new BufferedGraphicsContext();
     this.Paint += new PaintEventHandler(UltraPanel_Paint);
     firstColor = ColorTranslator.FromHtml("#0077FF");
     lastColor = ColorTranslator.FromHtml("#00FFFF");
 }
Ejemplo n.º 6
0
        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);
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
 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);
 }
Ejemplo n.º 9
0
 protected override void OnPaintBackground(PaintEventArgs e)
 {
     BufferedGraphicsContext bgc = new BufferedGraphicsContext();
     BufferedGraphics bg = bgc.Allocate(e.Graphics, e.ClipRectangle);
     Draw(bg.Graphics);
     bg.Render();
 }
Ejemplo n.º 10
0
 private void InitializeGraphics()
 {
     this.DoubleBuffered = true;
     graphics = mainPictureBox.CreateGraphics();
     bufferedGraphicsContext = new BufferedGraphicsContext();
     bufferedGraphics = bufferedGraphicsContext.Allocate(graphics, new Rectangle(0, 0, mainPictureBox.Width, mainPictureBox.Height));
 }
Ejemplo n.º 11
0
 public BufferedControl()
 {
     _BufferContext = new BufferedGraphicsContext();
       SizeGraphicsBuffer();
       SetStyle(ControlStyles.OptimizedDoubleBuffer, false);
       SetStyle(ControlStyles.DoubleBuffer, false);
 }
Ejemplo n.º 12
0
        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;
        }
Ejemplo n.º 13
0
 public MainForm()
 {
     InitializeComponent();
     doc = new Document();
     bufferContext = new BufferedGraphicsContext();
     bufferContext.MaximumBuffer = this.ClientRectangle.Size;
 }
Ejemplo n.º 14
0
 public Canvas(Control control)
 {
     this.control = control;
     control.BackColor = Color.SkyBlue;
     context = new BufferedGraphicsContext();
     control.Paint += new PaintEventHandler(control_Paint);
     InitializeGraphics();
 }
Ejemplo n.º 15
0
        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);
        }
        void DashFireWin_Load(object sender, EventArgs e)
        {
            m_blnIsLoading = true;

            mGraphContext = BufferedGraphicsManager.Current;

            ReloadSteeringScenario();
        }
Ejemplo n.º 17
0
        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;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="RenderControl" /> class.
        /// </summary>
        public TopologyRenderControl()
        {
            SetStyle(ControlStyles.ResizeRedraw, true);

            this.BackColor = Color.Black;

            context = new BufferedGraphicsContext();
        }
Ejemplo n.º 19
0
 public Form1()
 {
     InitializeComponent();
     X = new BufferedGraphicsContext();
     G = new Bitmap("test.png");
     collections = new List<Collection>();
     Podcasts = new List<Podcast>();
     fCC = new frmColorChooser(this);
 }
Ejemplo n.º 20
0
        private static int              rop = 0xcc0020; // RasterOp.SOURCE.GetRop();

        /// <include file='doc\BufferedGraphics.uex' path='docs/doc[@for="BufferedGraphics.BufferedGraphics"]/*' />
        /// <devdoc>
        ///         Internal constructor, this class is created by the BufferedGraphicsContext.
        /// </devdoc>
        internal BufferedGraphics(Graphics bufferedGraphicsSurface, BufferedGraphicsContext context, Graphics targetGraphics,
                                  IntPtr targetDC, Point targetLoc, Size virtualSize) {
            this.context = context;
            this.bufferedGraphicsSurface = bufferedGraphicsSurface;
            this.targetDC = targetDC;
            this.targetGraphics = targetGraphics;
            this.targetLoc = targetLoc;
            this.virtualSize = virtualSize;
        }
		// what sort of TRANSPARENT does it allow?... ommitting will require "override OnResize()"
		//ABSOLUTELY_FLICKERS protected override CreateParams CreateParams { get {
		//	CreateParams cp = base.CreateParams;
		//	cp.ExStyle |= 0x00000020; //WS_EX_TRANSPARENT
		//	return cp;
		//} }

		public UserControlDoubleBuffered() : base() {
			Application.ApplicationExit += new EventHandler(DisposeAndNullifyToRecreateInPaint);
			base.SetStyle( ControlStyles.AllPaintingInWmPaint
						 | ControlStyles.OptimizedDoubleBuffer
					//	 | ControlStyles.UserPaint
					//	 | ControlStyles.ResizeRedraw
					, true);
			this.graphicManager = BufferedGraphicsManager.Current;
		}
Ejemplo n.º 22
0
 public GraphicForm()
 {
     InitializeComponent();
     pictureBox.BackColor = Color.Gray;
     currentContext = BufferedGraphicsManager.Current;
     myBuffer = currentContext.Allocate(pictureBox.CreateGraphics(), pictureBox.DisplayRectangle);
     this.graphic = myBuffer.Graphics;
     pen = new Pen(Color.Gold);
     figureList = new List<Figure>();
 }
Ejemplo n.º 23
0
    	private void Form1_Load(object sender, EventArgs e)
        {
        	pbBox.AllowDrop = true;
            BGC = BufferedGraphicsManager.Current;
			view.Window = new Rectangle(0, 0, pbBox.Width - 1, pbBox.Height - 1);
            grOffside = BGC.Allocate(pbBox.CreateGraphics(), view.Window);
            grOffside.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
            grOffside.Graphics.SmoothingMode = SmoothingMode.HighQuality;    		
            timer.Enabled = true;            
        }
Ejemplo n.º 24
0
 public ProgressBarEx()
     : base()
 {
     _context = BufferedGraphicsManager.Current;
     _context.MaximumBuffer = new Size(Width+1, Height+1);
     _bufferedGraphics = _context.Allocate(
         CreateGraphics(),
         new Rectangle(Point.Empty, Size));
     SetRegion();
 }
Ejemplo n.º 25
0
        public VideoScreen()
        {
            bufferContext = BufferedGraphicsManager.Current;
            width = Width;
            height = Height;
            bg = bufferContext.Allocate(CreateGraphics(), new Rectangle(0, 0, Width, Height));
            g = bg.Graphics;

            InitializeComponent();
        }
Ejemplo n.º 26
0
 public DrawingSystem(Form form, EntityManager manager)
     : base(manager)
 {
     _form = form;
     _form.Invoke(new Action(() =>
     {
         _context = BufferedGraphicsManager.Current;
         _buffer = _context.Allocate(_form.CreateGraphics(), _form.DisplayRectangle);
     }));
 }
Ejemplo n.º 27
0
 public mainForm()
 {
     InitializeComponent();
     arrowPen.EndCap = System.Drawing.Drawing2D.LineCap.ArrowAnchor;
     axisPoints[1] = new Point(80, 450);
     axisPoints[0] = new Point(80, 150);
     axisPoints[2] = new Point(380, 450);
     CS = CurrentSimulation.SteeringBehaviours;
     context = new BufferedGraphicsContext();
 }
Ejemplo n.º 28
0
		public void Dispose()
		{
			DisposeBuffer();

			if (_graphicsContext != null)
			{
				_graphicsContext.Dispose();
				_graphicsContext = null;
			}
		}
Ejemplo n.º 29
0
 public FlyingDragon(Graphics g, int width, int height, Pen stroke, Fill fill, int interval)
 {
     _g = g;
     GraphicManager = BufferedGraphicsManager.Current;
     GraphicManager.MaximumBuffer =
         new Size(width + 1, height + 1);
     ManagedBackBuffer =
         GraphicManager.Allocate(_g, new Rectangle(0, 0, width, height));
     _ctx = new CanvasRenderingContext2D(ManagedBackBuffer.Graphics, null, stroke, fill, false);
     this.interval = interval;
 }
Ejemplo n.º 30
0
 public UCNoteGraph()
 {
     InitializeComponent();
     PitchStart = 0;
     PitchRange = 20;
     NoteWidth = 5;
     lastNoteLocation = new Point(0, Height);
     bufferedGraphicsContext = BufferedGraphicsManager.Current;
     bufferedGraphics = bufferedGraphicsContext.Allocate(CreateGraphics(), ClientRectangle);
     SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true);
 }
Ejemplo n.º 31
0
        private void LMSAPIForm_Load(object sender, EventArgs e)
        {
            this.cbRangoAngular.SelectedIndex   = 0;
            this.cbRangoDistancia.SelectedIndex = 0;
            this.cbResAngular.SelectedIndex     = 0;
            this.cbPuerto.SelectedIndex         = 0;

            //crear herramientas graficas
            context = BufferedGraphicsManager.Current;
            gfx     = null;
            resize_canvas();
        }
Ejemplo n.º 32
0
        //Constructor
        public DXGDI_Interface(Form form)
        {
            // local copy of game form
            this.form = form;

            //Create drawing surface from game form
            formGraphics = form.CreateGraphics();

            //Initialize back-buffer graphics
            currenContext = BufferedGraphicsManager.Current;
            backBuffer    = currenContext.Allocate(formGraphics, form.ClientRectangle);

            //Initialize drawing brush
            blackBrush = new SolidBrush(Color.White);
        }
Ejemplo n.º 33
0
        public void Dispose()
        {
            if (_context != null)
            {
                _context.ReleaseBuffer(this);

                if (DisposeContext)
                {
                    _context.Dispose();
                    _context = null;
                }
            }

            if (_bufferedGraphicsSurface != null)
            {
                _bufferedGraphicsSurface.Dispose();
                _bufferedGraphicsSurface = null;
            }
        }
 private void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (this.context != null)
         {
             this.context.ReleaseBuffer(this);
             if (this.DisposeContext)
             {
                 this.context.Dispose();
                 this.context = null;
             }
         }
         if (this.bufferedGraphicsSurface != null)
         {
             this.bufferedGraphicsSurface.Dispose();
             this.bufferedGraphicsSurface = null;
         }
     }
 }
Ejemplo n.º 35
0
        static public void Init(Form form)
        {
            // Графическое устройство для вывода графики
            Graphics g;

            // предоставляет доступ к главному буферу графического контекста для текущего приложения
            context = BufferedGraphicsManager.Current;
            g       = form.CreateGraphics(); // Создаём объект - поверхность рисования и связываем его с формой
                                             // Запоминаем размеры формы
            Width  = form.Width;
            Height = form.Height;
            // Связываем буфер в памяти с графическим объектом.
            // для того, чтобы рисовать в буфере
            buffer = context.Allocate(g, new Rectangle(0, 0, Width, Height));

            Load();
            Timer timer = new Timer();

            timer.Interval = 100;
            timer.Start();
            timer.Tick += Timer_Tick;
        }
Ejemplo n.º 36
0
        private BufferedGraphics AllocBufferInTempManager(Graphics targetGraphics, IntPtr targetDC, Rectangle targetRectangle)
        {
            BufferedGraphicsContext tempContext = null;
            BufferedGraphics        tempBuffer  = null;

            try {
                tempContext = new BufferedGraphicsContext();
                if (tempContext != null)
                {
                    tempBuffer = tempContext.AllocBuffer(targetGraphics, targetDC, targetRectangle);
                    tempBuffer.DisposeContext = true;
                }
            }
            finally {
                if (tempContext != null && (tempBuffer == null || (tempBuffer != null && !tempBuffer.DisposeContext)))
                {
                    tempContext.Dispose();
                }
            }

            return(tempBuffer);
        }
        private BufferedGraphics AllocBufferInTempManager(Graphics targetGraphics, IntPtr targetDC, Rectangle targetRectangle)
        {
            BufferedGraphicsContext context  = null;
            BufferedGraphics        graphics = null;

            try
            {
                context = new BufferedGraphicsContext();
                if (context != null)
                {
                    graphics = context.AllocBuffer(targetGraphics, targetDC, targetRectangle);
                    graphics.DisposeContext = true;
                }
            }
            finally
            {
                if ((context != null) && ((graphics == null) || ((graphics != null) && !graphics.DisposeContext)))
                {
                    context.Dispose();
                }
            }
            return(graphics);
        }
Ejemplo n.º 38
0
 /// <summary>
 /// Static constructor.  Here, we hook the exit &amp; unload events so we can clean up our context buffer.
 /// </summary>
 static BufferedGraphicsManager()
 {
     AppDomain.CurrentDomain.ProcessExit  += new EventHandler(OnShutdown);
     AppDomain.CurrentDomain.DomainUnload += new EventHandler(OnShutdown);
     Current = new BufferedGraphicsContext();
 }