コード例 #1
0
 /// <summary>
 ///  Required method for Designer support - do not modify
 ///  the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.components    = new System.ComponentModel.Container();
     this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
     this.ClientSize    = new System.Drawing.Size(800, 450);
     this.Text          = "Form1";
     ///
     /// _skControl
     ///
     this._skControl               = new SkiaSharp.Views.Desktop.SKControl();
     this._skControl.Dock          = System.Windows.Forms.DockStyle.Fill;
     this._skControl.PaintSurface += SKControl_PaintSurface;
     this.Controls.Add(_skControl);
 }
コード例 #2
0
ファイル: InteractivePlot.cs プロジェクト: zyhong/QuickPlot
        private void CreateControl(bool useOpenGL = false)
        {
            if (useOpenGL)
            {
                ColorFormat  colorFormat  = new ColorFormat(8, 8, 8, 8);
                int          depth        = 24;
                int          stencil      = 8;
                int          samples      = 4;
                GraphicsMode graphicsMode = new GraphicsMode(colorFormat, depth, stencil, samples);
                glControl1 = new OpenTK.GLControl(graphicsMode)
                {
                    BackColor = Color.FromArgb(0, 0, 192),
                    VSync     = true,
                    Dock      = DockStyle.Fill
                };
                glControl1.Paint += new PaintEventHandler(GlControl1_Paint);
                control           = glControl1;
            }
            else
            {
                skControl1 = new SkiaSharp.Views.Desktop.SKControl
                {
                    BackColor = Color.FromArgb(192, 0, 0),
                    Dock      = DockStyle.Fill
                };
                skControl1.PaintSurface += new EventHandler <SkiaSharp.Views.Desktop.SKPaintSurfaceEventArgs>(SkControl1_PaintSurface);
                control = skControl1;
            }

            Controls.Add(control);
            control.BringToFront();
            control.Update();

            control.MouseMove  += new MouseEventHandler(OnMouseMove);
            control.MouseDown  += new MouseEventHandler(OnMouseDown);
            control.MouseUp    += new MouseEventHandler(OnMouseUp);
            control.MouseWheel += new MouseEventHandler(OnMouseWheel);
            control.MouseClick += new MouseEventHandler(OnMouseClick);
        }