public ScMgr(Control stdControl, bool isUsedUpdateLayerFrm = false) { if (isUsedUpdateLayerFrm) { if (stdControl == null) { stdControl = new UpdateLayerFrm(); } Init(stdControl as UpdateLayerFrm); } else { Init(stdControl.Width, stdControl.Height, DrawType.NOIMAGE); stdControl.Controls.Add(control); } }
void Init(UpdateLayerFrm form) { cacheRootScLayer = rootScLayer; drawType = DrawType.IMAGE; controlType = ControlType.UPDATELAYERFORM; form.scMgr = this; control = form; bitmap = new Bitmap(control.Width, control.Height, System.Drawing.Imaging.PixelFormat.Format32bppPArgb); var wicFactory = new ImagingFactory(); wicBitmap = new WicBitmap( wicFactory, control.Width, control.Height, SharpDX.WIC.PixelFormat.Format32bppPBGRA, BitmapCreateCacheOption.CacheOnLoad); form.bitmap = bitmap; this.graphicsType = GraphicsType.D2D; GraphicsType = GraphicsType.D2D; D2DGraphics d2dGraph = (D2DGraphics)graphics; Size2 pixelSize = d2dGraph.renderTarget.PixelSize; Size2F logicSize = d2dGraph.renderTarget.Size; sizeScale = new SizeF(logicSize.Width / pixelSize.Width, logicSize.Height / pixelSize.Height); rootScLayer.ScMgr = this; rootScLayer.Dock = ScDockStyle.Fill; rootScLayer.Name = "__root__"; rootScLayer.D2DPaint += RootScControl_D2DPaint; rootParent = new ScLayer(this); rootParent.DirectionRect = rootScLayer.DirectionRect; rootParent.DrawBox = rootScLayer.DirectionRect; rootParent.Add(rootScLayer); RegControlEvent(); }
public ScMgr(UpdateLayerFrm form, GraphicsType graphicsType = GraphicsType.D2D) { cacheRootScLayer = rootScLayer; drawType = DrawType.IMAGE; controlType = ControlType.UPDATELAYERFORM; form.scMgr = this; control = form; bitmap = new Bitmap(control.Width, control.Height, System.Drawing.Imaging.PixelFormat.Format32bppPArgb); if (graphicsType == GraphicsType.D2D) { var wicFactory = new ImagingFactory(); wicBitmap = new WicBitmap(wicFactory, control.Width, control.Height, SharpDX.WIC.PixelFormat.Format32bppPBGRA, BitmapCreateCacheOption.CacheOnLoad); } form.bitmap = bitmap; this.graphicsType = graphicsType; GraphicsType = graphicsType; rootScLayer.ScMgr = this; rootScLayer.Dock = ScDockStyle.Fill; rootScLayer.Width = control.Width; rootScLayer.Height = control.Height; rootScLayer.D2DPaint += RootScControl_D2DPaint; rootParent = new ScLayer(this); rootParent.DirectionRect = rootScLayer.DirectionRect; rootParent.DrawBox = rootScLayer.DirectionRect; rootParent.Add(rootScLayer); rootScLayer.Layout(); RegControlEvent(); }
public void Show() { UpdateLayerFrm frm = control as UpdateLayerFrm; frm.Show(); }