public InitRootGraphics ( RootGraphic rootgfx, ITopWindowEventRoot topWinEventRoot, InnerViewportKind innerViewportKind ) : void | ||
rootgfx | RootGraphic | |
topWinEventRoot | ITopWindowEventRoot | |
innerViewportKind | InnerViewportKind | |
Résultat | void |
static void CreateNewFormCanvas( Form form1, MyRootGraphic myRootGfx, InnerViewportKind internalViewportKind, out LayoutFarm.UI.UISurfaceViewportControl canvasViewport) { var innerViewport = canvasViewport = new LayoutFarm.UI.UISurfaceViewportControl(); Rectangle screenClientAreaRect = Conv.ToRect(Screen.PrimaryScreen.WorkingArea); canvasViewport.InitRootGraphics(myRootGfx, myRootGfx.TopWinEventPortal, internalViewportKind); canvasViewport.Bounds = new System.Drawing.Rectangle(0, 0, screenClientAreaRect.Width, screenClientAreaRect.Height); ////---------------------- //form1.Controls.Add(canvasViewport); ////---------------------- MakeFormCanvas(form1, canvasViewport); form1.SizeChanged += (s, e) => { if (form1.WindowState == FormWindowState.Maximized) { Screen currentScreen = GetScreenFromX(form1.Left); //make full screen ? if (innerViewport != null) { innerViewport.Size = currentScreen.WorkingArea.Size; } } }; }
private void cmdShowEmbededViewport_Click(object sender, EventArgs e) { Form simpleForm = new Form(); simpleForm.Text = "SimpleForm2"; simpleForm.WindowState = FormWindowState.Maximized; Rectangle screenClientAreaRect = Screen.PrimaryScreen.WorkingArea; var viewport = new LayoutFarm.UI.UISurfaceViewportControl(); viewport.Bounds = new Rectangle(0, 0, screenClientAreaRect.Width, screenClientAreaRect.Height); simpleForm.Controls.Add(viewport); int w = 800; int h = 600; var rootgfx = new MyRootGraphic(this.uiPlatformWinForm, this.gfxPlatform, w, h); viewport.InitRootGraphics(rootgfx, rootgfx.TopWinEventPortal, InnerViewportKind.GdiPlus); viewport.PaintMe(); simpleForm.Show(); ShowFormLayoutInspector(viewport); }
public static Form CreateNewFormCanvas( MyRootGraphic myRootGfx, InnerViewportKind internalViewportKind, out UISurfaceViewportControl canvasViewport) { Form form1 = new Form(); var innerViewport = canvasViewport = new UISurfaceViewportControl(); Rectangle screenClientAreaRect = new Rectangle(0, 0, 800, 600); //Conv.ToRect(Screen.PrimaryScreen.WorkingArea); canvasViewport.InitRootGraphics(myRootGfx, myRootGfx.TopWinEventPortal, internalViewportKind); canvasViewport.Bounds = new Rectangle(0, 0, screenClientAreaRect.Width, screenClientAreaRect.Height); //---------------------- form1.Controls.Add(canvasViewport); //---------------------- MakeFormCanvas(form1, canvasViewport); //TODO: review here //form1.SizeChanged += (s, e) => //{ // if (form1.WindowState == FormWindowState.Maximized) // { // Screen currentScreen = GetScreenFromX(form1.Left); // //make full screen ? // if (innerViewport != null) // { // innerViewport.Size = currentScreen.WorkingArea.Size; // } // } //}; //---------------------- return(form1); }
public static void CreateCanvasControlOnExistingControl( Control landingControl, int xpos, int ypos, int w, int h, InnerViewportKind internalViewportKind, out UISurfaceViewportControl canvasViewport) { //1. init InitWinform(); IInstalledTypefaceProvider fontLoader = s_fontstore; //2. ITextService textService = null; switch (internalViewportKind) { default: //gdi, gdi on gles textService = PixelFarm.Drawing.WinGdi.WinGdiPlusPlatform.GetTextService(); break; case InnerViewportKind.PureAgg: case InnerViewportKind.AggOnGLES: case InnerViewportKind.GLES: textService = new OpenFontTextService(); break; } PixelFarm.Drawing.WinGdi.WinGdiPlusPlatform.SetInstalledTypefaceProvider(fontLoader); //--------------------------------------------------------------------------- MyRootGraphic myRootGfx = new MyRootGraphic(w, h, textService); //--------------------------------------------------------------------------- var innerViewport = canvasViewport = new UISurfaceViewportControl(); Rectangle screenClientAreaRect = Conv.ToRect(Screen.PrimaryScreen.WorkingArea); canvasViewport.InitRootGraphics(myRootGfx, myRootGfx.TopWinEventPortal, internalViewportKind); canvasViewport.Bounds = new System.Drawing.Rectangle(xpos, ypos, screenClientAreaRect.Width, screenClientAreaRect.Height); landingControl.Controls.Add(canvasViewport); // Form ownerForm = landingControl.FindForm(); if (ownerForm != null) { ownerForm.FormClosing += (s, e) => { innerViewport.Close(); }; } }
private void cmdShowEmbededViewport_Click(object sender, EventArgs e) { Form simpleForm = new Form(); simpleForm.Text = "SimpleForm2"; simpleForm.WindowState = FormWindowState.Maximized; Rectangle screenClientAreaRect = Screen.PrimaryScreen.WorkingArea; var viewport = new LayoutFarm.UI.UISurfaceViewportControl(); viewport.Bounds = new Rectangle(0, 0, screenClientAreaRect.Width, screenClientAreaRect.Height); simpleForm.Controls.Add(viewport); int w = 800; int h = 600; var rootgfx = new MyRootGraphic(this.uiPlatformWinForm, w, h); viewport.InitRootGraphics(rootgfx, rootgfx.TopWinEventPortal, InnerViewportKind.GdiPlus); viewport.PaintMe(); simpleForm.Show(); ShowFormLayoutInspector(viewport); }
/// <summary> /// create new UIViewport based on this control's current platform /// </summary> /// <returns></returns> public UISurfaceViewportControl CreateNewOne(int w, int h, InnerViewportKind innerViewportKind) { //each viewport has its own root graphics UISurfaceViewportControl newViewportControl = new UISurfaceViewportControl(); newViewportControl.Size = new System.Drawing.Size(w, h); RootGraphic newRootGraphic = _rootgfx.CreateNewOne(w, h); ITopWindowEventRoot topEventRoot = null; if (newRootGraphic is ITopWindowEventRootProvider) { topEventRoot = ((ITopWindowEventRootProvider)newRootGraphic).EventRoot; } newViewportControl.InitRootGraphics( newRootGraphic,//new root topEventRoot, innerViewportKind); return(newViewportControl); }
/// <summary> /// create new UIViewport based on this control's current platform /// </summary> /// <returns></returns> public UISurfaceViewportControl CreateNewOne(int w, int h) { //each viewport has its own root graphics UISurfaceViewportControl newViewportControl = new UISurfaceViewportControl(); newViewportControl.Size = new System.Drawing.Size(w, h); RootGraphic newRootGraphic = this.rootgfx.CreateNewOne(w, h); ITopWindowEventRoot topEventRoot = null; if (newRootGraphic is ITopWindowEventRootProvider) { topEventRoot = ((ITopWindowEventRootProvider)newRootGraphic).EventRoot; } newViewportControl.InitRootGraphics( newRootGraphic,//new root topEventRoot, this.innerViewportKind); return newViewportControl; }
static void CreateNewFormCanvas( Form form1, MyRootGraphic myRootGfx, InnerViewportKind internalViewportKind, out LayoutFarm.UI.UISurfaceViewportControl canvasViewport) { var innerViewport = canvasViewport = new LayoutFarm.UI.UISurfaceViewportControl(); Rectangle screenClientAreaRect = Conv.ToRect(Screen.PrimaryScreen.WorkingArea); canvasViewport.InitRootGraphics(myRootGfx, myRootGfx.TopWinEventPortal, internalViewportKind); canvasViewport.Bounds = new System.Drawing.Rectangle(0, 0, screenClientAreaRect.Width, screenClientAreaRect.Height); ////---------------------- //form1.Controls.Add(canvasViewport); ////---------------------- MakeFormCanvas(form1, canvasViewport); form1.SizeChanged += (s, e) => { if (form1.WindowState == FormWindowState.Maximized) { Screen currentScreen = GetScreenFromX(form1.Left); //make full screen ? if (innerViewport != null) { innerViewport.Size = currentScreen.WorkingArea.Size; } } }; }