public void SetCanvas(PictureBoxObj pb) { lock (_canvasSync) { if (pb == null || pb.Image == null) { return; } Width = pb.Width; Height = pb.Height; _backPicture = pb; this.Controls.Add(_backPicture); _backPicture.SendToBack(); _backPicture.Invalidate(); _frontPicture = new PictureBoxObj(_backPicture.ClientID, _backPicture.UniqueID, PictureBoxStatus.Canvas); this.Controls.Add(_frontPicture); _frontPicture.Width = pb.Width; _frontPicture.Height = pb.Width; _frontPicture.Image = new Bitmap(Width, Height); _frontPicture.BringToFront(); _editPBDrawObjects[0] = new DrawObjectList(0); } _isCleared = false; _needUpdateFrontPicture = true; AppLogger.Log("Picture loaded: width " + Width + ", height " + Height); }
private void RemoveDrawObjectList(long picObjID) { DrawObjectList drl = null; lock (_canvasSync) { _editPBDrawObjects.TryGetValue(picObjID, out drl); _editPBDrawObjects.Remove(picObjID); } if (drl != null) { drl.Clear(); } }