private void saveTransform() { if (curDrawing != null) { bool bFound = false; Graphics g = this.CreateGraphics(); DrawingLayer lstDrawings = GetLayerById(curDrawing.LayerId); if (lstDrawings == null) { throw new ExceptionDrawing2D("Layer {0} not found", curDrawing.LayerId); } foreach (DrawingItem obj in lstDrawings) { if (obj.DrawingId == curDrawing.DrawingId) { curTransform = g.Transform; bFound = true; break; } obj.Draw(g); } if (!bFound) { curTransform = g.Transform; } g.Dispose(); } }
public object Clone() { DrawingLayer obj = new DrawingLayer(); obj._name = _name; obj._layerId = _layerId; obj.AddRange(this); return(obj); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (context != null && context.Instance != null && provider != null) { IWindowsFormsEditorService service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (service != null) { DrawingItem item = context.Instance as DrawingItem; if (item == null) { IDrawDesignControl dc = context.Instance as IDrawDesignControl; if (dc != null) { item = dc.Item; } } if (item != null && item.Page != null) { ListBox list = new ListBox(); foreach (DrawingLayer l in item.Page.DrawingLayers) { list.Items.Add(l); } list.Tag = service; list.Click += new EventHandler(list_Click); service.DropDownControl(list); if (list.SelectedIndex >= 0) { DrawingLayer ly = list.Items[list.SelectedIndex] as DrawingLayer; item.Page.MoveItemToLayer(item, ly); value = ly.LayerId.ToString(); Type t = service.GetType(); PropertyInfo pif0 = t.GetProperty("OwnerGrid"); if (pif0 != null) { PropertyGrid pg = pif0.GetValue(service, null) as PropertyGrid; if (pg != null) { pg.Refresh(); } } } } } } return(value); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { object v = base.EditValue(context, provider, value); DrawingLayer layer = value as DrawingLayer; DrawingLayerCollection ls = context.Instance as DrawingLayerCollection; if (layer != null && ls != null) { foreach (DrawingItem item in layer) { item.LayerId = layer.LayerId; } IDrawingOwnerPointer iw = ls.Page.DesignerPointer; if (iw != null) { iw.OnDrawingCollectionChanged(layer); } } if (provider != null) { IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (edSvc != null) { Type t = edSvc.GetType(); PropertyInfo pif0 = t.GetProperty("OwnerGrid"); if (pif0 != null) { object g = pif0.GetValue(edSvc, null); PropertyGrid pg = g as PropertyGrid; if (pg != null) { pg.Refresh(); } } } } return(v); }
protected override void OnPaint(PaintEventArgs e) { if (hotspots == null) { return; } DrawingLayer lst = hotspots.Drawings; //.GetDrawings(); System.Drawing.Color color = hotspots.SpotColor; GraphicsPath myPath = new GraphicsPath(); myPath.FillMode = System.Drawing.Drawing2D.FillMode.Alternate; foreach (DrawingItem objDraw in lst) { if (objDraw != null) { objDraw.AddToPath(myPath); } } e.Graphics.DrawPath(new Pen(color, 1), myPath); System.Drawing.SolidBrush br = new SolidBrush(color); e.Graphics.FillPath(br, myPath); }
public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value) { if (context != null && context.Instance != null && provider != null) { IWindowsFormsEditorService service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (service != null) { dlgDrawingBoard dlg = new dlgDrawingBoard(); DrawingLayer lst = value as DrawingLayer; Hotspots hs = null; IDrawingPage page = null; hs = context.Instance as Hotspots; if (hs == null) { page = context.Instance as IDrawingPage; if (page != null) { dlg.Attrs = page.PageAttributes; } Control cOwner = context.Instance as Control; if (cOwner != null) { dlg.ImgBK = cOwner.BackgroundImage; } DrawingLayerCollection ls = value as DrawingLayerCollection; dlg.LoadData(ls); } else { lst = (DrawingLayer)hs.Drawings.Clone(); dlg.LoadData(hs); hs.clearBK(); } try { if (service.ShowDialog(dlg) == System.Windows.Forms.DialogResult.OK) { if (hs != null) { value = dlg.lstShapes; hs.InitBK(); } else { value = dlg.DrawingLayers; if (page != null) { page.PageAttributes = dlg.Attrs; } } } else { if (hs != null) { hs.SetDrawings(lst); hs.InitBK(); } } } catch (Exception err) { DrawingItem.ShowMessage(err.Message); } } } return(value); }
public PropertyDescriptorLayer(string name, DrawingLayer layer, Attribute[] attrs) : base(name, attrs) { _layer = layer; }
public DrawingLayerHeader(DrawingLayer layer) { LayerId = layer.LayerId; Name = layer.LayerName; Visible = layer.Visible; }
public void SetDrawings(DrawingLayer drawings) { _drawings = drawings; }
public override void MoveItemToLayer(DrawingItem item, DrawingLayer layer) { base.MoveItemToLayer(item, layer); editor.RefreshPropertyGrids(); }
public void LoadData(DrawingLayer lst) { drawings = lst; ReloadData(); ShowBKbutton(); }