Пример #1
0
        public Form1()
        {
            InitializeComponent();


            // Get the right device context
            fDeviceContext = GDIContext.CreateForWindowClientArea(this.Handle);   // This is fairly fast for the window
            //fDeviceContext = GDIContext.CreateForDesktopBackground();   // This one is the desktop background and is fast
            //fDeviceContext = GDIContext.CreateForDefaultDisplay();    // This one is way slow on Vista

            fChannel = new GDIRenderer(fDeviceContext);

            fDemoCounter = 0;
            //this.Text = "PixTour";

            bezierer = new BezierTest(ClientRectangle.Size);
            aTextTest = new TextTest(ClientRectangle.Size);

            PrintDeviceContext(fDeviceContext);
        }
Пример #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            fSendingChannel.GraphPort.UseDefaultBrush();
            fSendingChannel.GraphPort.UseDefaultPen();
            fSendingChannel.GraphPort.Flush();

            switch (fDemoCounter)
            {
                case 0:
                    LineDemo1 aLineDemo = new LineDemo1(new Size(ClientSize.Width, ClientSize.Height));
                    aLineDemo.ReceiveCommand(new Command_Render(fSendingChannel.GraphPort));
                    break;
                case 1:
                    RectangleTest aRectTest = new RectangleTest(new Size(ClientSize.Width, ClientSize.Height));
                    aRectTest.ReceiveCommand(new Command_Render(fSendingChannel.GraphPort));
                    break;

                case 2:
                    TextTest aTextTest = new TextTest(new Size(ClientSize.Width, ClientSize.Height));
                    aTextTest.ReceiveCommand(new Command_Render(fSendingChannel.GraphPort));
                    break;

                case 3:
                    SineWave siner = new SineWave(new Size(ClientSize.Width, ClientSize.Height), 100);
                    siner.ReceiveCommand(new Command_Render(fSendingChannel.GraphPort));
                    break;

                case 4:
                    PolygonTest polygoner = new PolygonTest(new Size(ClientSize.Width, ClientSize.Height));
                    polygoner.ReceiveCommand(new Command_Render(fSendingChannel.GraphPort));
                    break;

                case 5:
                    BezierTest bezierer = new BezierTest(new Size(ClientSize.Width, ClientSize.Height));
                    bezierer.ReceiveCommand(new Command_Render(fSendingChannel.GraphPort));
                    break;

                case 6:
                    GraphTest grapher = new GraphTest(new Size(ClientSize.Width, ClientSize.Height));
                    grapher.ReceiveCommand(new Command_Render(fSendingChannel.GraphPort));
                    break;

                case 7:
                    RandomRect randrect = new RandomRect(new Size(ClientSize.Width, ClientSize.Height));
                    randrect.ReceiveCommand(new Command_Render(fSendingChannel.GraphPort));
                    break;
            }

            ((Button)sender).Text = fDemoCounter.ToString();

            fDemoCounter++;
            if (fDemoCounter == 8)
                fDemoCounter = 0;
        }