public void Insert(ScLayer pevLayer, ScLayer childLayer) { int idx = 0; for (int i = 0; i < controls.Count(); i++) { if (controls[i] == pevLayer) { idx = i; break; } } childLayer.parent = this; controls.Insert(idx, childLayer); childLayer.CreateContextRelationInfo(); if (suspendLayoutCount == 0) { childLayer.Layout(); } if (childLayer.ShadowLayer != null) { Insert(childLayer, childLayer.ShadowLayer); } }
public void Add(ScLayer childLayer) { if (childLayer == null) { return; } if (childLayer.ShadowLayer != null) { Add(childLayer.ShadowLayer); } childLayer.parent = this; controls.Add(childLayer); childLayer.CreateContextRelationInfo(); if (suspendLayoutCount == 0) { childLayer.Layout(); } }
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(); }