private void ChangeItemUnknown(object sender, System.EventArgs e) { if (lbitem.Tag != null) { return; } if (lbitem.SelectedIndex < 0) { return; } try { lbitem.Tag = true; ShapeItem item = (ShapeItem)lbitem.Items[lbitem.SelectedIndex]; item.Unknown1 = (int)Convert.ToUInt32(tbitemunk1.Text, 16); item.Unknown2 = Convert.ToByte(tbitemunk2.Text, 16); item.Unknown3 = (int)Convert.ToUInt32(tbitemunk3.Text, 16); item.Unknown4 = Convert.ToByte(tbitemunk4.Text, 16); lbitem.Items[lbitem.SelectedIndex] = item; } catch (Exception) {} finally { lbitem.Tag = null; } }
public void Build(ShortcutSettings sSettings, GameObject parentObj) { _id = ShortcutUtil.ItemAutoId; switch (sSettings.Type) { case (ShortcutType.Arc): ArcItem _aItem = parentObj.AddComponent <ArcItem>(); _item = _aItem; break; case (ShortcutType.Stick): StickItem _sItem = parentObj.AddComponent <StickItem>(); _item = _sItem; break; default: break; } _item.transform.SetParent(parentObj.transform, false); SetItemDatas(); _item.Build(sSettings, parentObj); }
/// <summary> /// Constructs a selection adorner /// </summary> /// <param name="adornedElement">The adorned element</param> public CanvasShapeSelectionAdorner(UIElement adornedElement) : base(adornedElement) { visualChildren = new VisualCollection(this); thumbs = new List <Thumb>(); ContentPresenter path = adornedElement as ContentPresenter; if (path != null) { shape = path.DataContext as ShapeItem; if (shape != null) { for (int i = 0; i < shape.Points.Count; i++) { //point = polygon.Points[i]; Thumb thumb = new Thumb(); buildThumb(ref thumb, Cursors.Hand); thumb.Tag = i; thumb.DragDelta += new DragDeltaEventHandler(HandleThumb_DragDelta); thumb.DragStarted += new DragStartedEventHandler(HandleThumb_DragStarted); thumbs.Add(thumb); } } } }
private void BtnInsertCube_Click(object sender, EventArgs e) { if (shapeSize != null && !string.IsNullOrEmpty(shapeSize.Text)) { Length = double.Parse(shapeSize.Text); } var polymesh = CreateBrepCube(Length); var shapeItem = new ShapeItem { Name = ShapeName, ShapeFacetedBrep = polymesh, UpAxis = ShapeUpAxis.Z_Axis }; shapeItem.Delete(); var result = shapeItem.Insert(); BtnModifyPyramid.Enabled = true; BtnAddCurrentModel.Enabled = true; shapeTypeBox.Text = "Cube"; }
private void SelectItems(object sender, System.EventArgs e) { if (lbitem.Tag != null) { return; } if (lbitem.SelectedIndex < 0) { return; } try { lbitem.Tag = true; ShapeItem item = (ShapeItem)lbitem.Items[lbitem.SelectedIndex]; tbitemflname.Text = item.FileName; tbitemunk1.Text = "0x" + Helper.HexString((uint)item.Unknown1); tbitemunk2.Text = "0x" + Helper.HexString(item.Unknown2); tbitemunk3.Text = "0x" + Helper.HexString((uint)item.Unknown3); tbitemunk4.Text = "0x" + Helper.HexString(item.Unknown4); } catch (Exception) {} finally { lbitem.Tag = null; } }
public static dynamic GetTSObject(ShapeItem dynObject) { if (dynObject is null) { return(null); } return(dynObject.teklaObject); }
public DesignerInterfaceShape(SortedList <int, ReportItem> repitem) : base(repitem) { if (repitem.Count == 1) { FPrintItemShape = (ShapeItem)repitem.Values[0]; } }
private void Add(RNode <T> currentNode, ShapeItem <T> item) { if (!currentNode.HasChildren()) { currentNode.Add(item); } else { this.Add(this.AddStrategy.GetNode(currentNode.Children, item.BoundingBox), item); } }
private void UpdateLists() { try { SimPe.Plugin.Shape shape = (SimPe.Plugin.Shape) this.Tag; ShapeItem[] items = new ShapeItem[lbitem.Items.Count]; for (int i = 0; i < items.Length; i++) { items[i] = (ShapeItem)lbitem.Items[i]; } shape.Items = items; } catch (Exception) {} }
/// <summary> /// Creates a new Shape Item on the Canvas map /// </summary> /// <param name="layerId">The layer put the object on</param> /// <param name="name">The name of the object</param> /// <param name="texture">The texture for the item</param> /// <param name="position">The position</param> /// <returns>The created item</returns> public IRenderable CreateItem(string layerId, string name, List <Point> points, WorldPosition position) { // TODO: Make the layer id a string lookup ShapeItem shapeItem = ShapeItem.Create( layerId, name, points, position, 0 ); this.AddItem(layerId, shapeItem); return(shapeItem); }
public Boolean Add(ShapeItem <T> item) { if (this.Node == null) { this.Node = new RNode <T>(this.Config, this.SplitStrategy); this.Node.Add(item); this.Count += 1; return(true); } else { this.Add(this.Node, item); } return(false); }
public void HandleThumb_DragStarted(object sender, DragStartedEventArgs args) { FrameworkElement element = this.AdornedElement as FrameworkElement; if (element != null) { ShapeItem item = element.DataContext as ShapeItem; ContentPresenter path = this.AdornedElement as ContentPresenter; if (path != null && shape != null) { Thumb thumb = (Thumb)sender; Point point = shape.Points[(int)thumb.Tag]; HandlePointDrag((int)thumb.Tag, point, true); } } }
private void linkLabel6_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e) { try { //Shpe wrp = (Shpe)wrapper; SimPe.Plugin.Shape shape = (SimPe.Plugin.Shape) this.Tag; ShapeItem val = new ShapeItem(shape); val.FileName = tbitemflname.Text; val.Unknown1 = Convert.ToInt32(tbitemunk1.Text, 16); val.Unknown2 = Convert.ToByte(tbitemunk2.Text, 16); val.Unknown3 = Convert.ToInt32(tbitemunk3.Text, 16); val.Unknown4 = Convert.ToByte(tbitemunk4.Text, 16); lbitem.Items.Add(val); UpdateLists(); } catch (Exception) {} }
private void BtnModifyPyramid_Click(object sender, EventArgs e) { if (shapeSize != null && !string.IsNullOrEmpty(shapeSize.Text)) { Length = double.Parse(shapeSize.Text); } var pyramidBrep = CreateBrepPyramid(Length); var modifyShapeItem = new ShapeItem { Name = ShapeName, ShapeFacetedBrep = pyramidBrep, UpAxis = ShapeUpAxis.Z_Axis }; var resultOfModify = modifyShapeItem.Modify(); shapeTypeBox.Text = "Pyramid"; }
public void Add(ShapeItem <T> item) { if (this.Items.Count == 0) { this.BoundingBox = (IBoundingBox <T>)item.BoundingBox.Clone(); this.Items.Add(item); return; } if (!this.BoundingBox.Contains(item.BoundingBox)) { this.BoundingBox = this.BoundingBox.GetCoveredBoundingbox(item.BoundingBox); } this.Items.Add(item); if (this.Config.Max < this.Items.Count) { this.Split(); } }
public void Build(ShortcutSettings sSettings, GameObject parentObj) { _id = ShortcutUtil.ItemAutoId; switch (sSettings.Type) { case (ShortcutType.Arc) : ArcItem _aItem = parentObj.AddComponent<ArcItem>(); _item = _aItem; break; case (ShortcutType.Stick) : StickItem _sItem = parentObj.AddComponent<StickItem>(); _item = _sItem; break; default : break; } _item.transform.SetParent (parentObj.transform, false); SetItemDatas (); _item.Build(sSettings, parentObj); }
private void ChangedItemFilename(object sender, System.EventArgs e) { if (lbitem.Tag != null) { return; } if (lbitem.SelectedIndex < 0) { return; } try { lbitem.Tag = true; ShapeItem item = (ShapeItem)lbitem.Items[lbitem.SelectedIndex]; item.FileName = tbitemflname.Text; lbitem.Items[lbitem.SelectedIndex] = item; } catch (Exception) {} finally { lbitem.Tag = null; } }
public static Product CreateVectorMaskProduct() { var photo = new FileInfo(HostingEnvironment.MapPath("~/assets/photo.jpg")); var items = new System.Collections.ObjectModel.Collection <BaseItem>(); var imageItem = new ImageItem(photo, new PointF(10, 10), 100, 100); imageItem.Mask = new ItemMask { VectorMask = Path.CreateEllipsePath( imageItem.SourceRectangle.X, imageItem.SourceRectangle.Y, imageItem.SourceRectangle.Width, imageItem.SourceRectangle.Height) }; items.Add(imageItem); var placeholderRectangle = new RectangleF(120, 10, 100, 100); var placeholderContent = new ImageItem(photo, placeholderRectangle.Location, placeholderRectangle.Width, placeholderRectangle.Height); var placeholder = new PlaceholderItem(placeholderContent, placeholderRectangle); var radius = new[] { new SizeF(5, 5), new SizeF(10, 10) }; var placeholderMask = Path.CreateRoundedRectanglePath( placeholderRectangle, new[] { radius[0], radius[1], radius[0], radius[1] }); placeholder.Mask = new ItemMask { VectorMask = placeholderMask }; items.Add(placeholder); var shape = new ShapeItem(Path.CreateRectanglePath(230, 10, 100, 100)) { Mask = new ItemMask { VectorMask = Path.CreateEllipsePath(180, 10, 100, 100) } }; items.Add(shape); var boundedTextMask = new Path(); boundedTextMask.MoveTo(340, 10); boundedTextMask.LineTo(390, 60); boundedTextMask.LineTo(340, 110); boundedTextMask.LineTo(290, 60); boundedTextMask.Close(); items.Add(new BoundedTextItem(TestText.LoremIpsum, new RectangleF(290, 10, 100, 100), fontSize: 6) { Mask = new ItemMask { VectorMask = boundedTextMask } }); var surface = new Surface(400, 400) { PrintAreas = { new PrintArea(new RectangleF(0, 0, 400, 200)) }, Containers = { new SurfaceContainer(items) { Name = Common.Utils.MainContainerName } } }; return(new Product { Surfaces = { surface } }); }
public static void PrepareReport(Report nreport, DataGridView ngrid, DataGridViewPrintOptions opts) { const int DefaultScreenDPI = 142; int BOOL_WIDTH = 100; int BOOL_SEP = 20; if (nreport.SubReports[0].Sections.Count == 1) { nreport.SubReports[0].AddGroup("TOTAL"); } Section Detail = nreport.SubReports[0].Sections[nreport.SubReports[0].FirstDetail]; Section GroupHeader = nreport.SubReports[0].Sections[nreport.SubReports[0].FirstDetail - 1]; Section GroupFooter = nreport.SubReports[0].Sections[nreport.SubReports[0].LastDetail + 1]; string aliasname = nreport.DataInfo[0].Alias; int totalwidth = Detail.Width; int rowcount = ngrid.Rows.Count; if (opts.PrintSelected) { rowcount = ngrid.SelectedRows.Count; } SortedList <string, DataGridViewColumn> CampoColumna = new SortedList <string, DataGridViewColumn>(); List <DataGridViewColumn> Columnas = new List <DataGridViewColumn>(); SortedList <int, DataGridViewColumn> ColumnasString = new SortedList <int, DataGridViewColumn>(); SortedList <int, DataGridViewColumn> ColumnasBool = new SortedList <int, DataGridViewColumn>(); SortedList <int, DataGridViewColumn> ColumnasImage = new SortedList <int, DataGridViewColumn>(); List <string> Campos = new List <string>(); int idxcol = 0; if (opts.SelectedColumns.Count == 0) { foreach (DataGridViewColumn ncol in ngrid.Columns) { if (ncol.Visible) { Columnas.Add(ncol); idxcol++; CampoColumna.Add("CAMPO" + idxcol.ToString(), ncol); Campos.Add("CAMPO" + idxcol.ToString()); } } } else { foreach (DataGridViewColumn ncol in opts.SelectedColumns) { Columnas.Add(ncol); idxcol++; CampoColumna.Add("CAMPO" + idxcol.ToString(), ncol); Campos.Add("CAMPO" + idxcol.ToString()); } } int separator = 40; int level_separator = 200; int level_separator_gap = 50; // Calculate total width for the selected int maxwidth = 0; float screendpi = GraphicUtils.ScreenDPI(); float scalepixels = 1440f / screendpi; for (idxcol = 0; idxcol < Columnas.Count; idxcol++) { DataGridViewColumn ncol = Columnas[idxcol]; int newwidth = System.Convert.ToInt32(Math.Round(ncol.Width * scalepixels)); maxwidth = maxwidth + newwidth; if (idxcol < (Columnas.Count - 1)) { maxwidth = maxwidth + separator; } } List <ShapeItem> HorzShapes = new List <ShapeItem>(); int pagewidth = opts.PaperWidth(); pagewidth = pagewidth - nreport.LeftMargin - nreport.RightMargin; float fsize = ngrid.Font.Size; float fontscale = 1.0f; float scalesep = 1.0f; float newscale = 1.0f; if (opts.AdjustWidth) { newscale = (float)pagewidth / maxwidth; scalepixels = 1440f / screendpi * newscale; scalesep = newscale; if (maxwidth > pagewidth) { fontscale = newscale; fsize = fsize * fontscale; if (fsize <= 0) { fsize = 1; } } } // Calculate font size and width scale int rowheight = System.Convert.ToInt32(Math.Round(ngrid.RowTemplate.Height * scalepixels)); BOOL_WIDTH = System.Convert.ToInt32(BOOL_WIDTH * fontscale); BOOL_SEP = System.Convert.ToInt32(BOOL_SEP * fontscale); separator = System.Convert.ToInt32(separator * fontscale); level_separator = System.Convert.ToInt32(level_separator * fontscale); level_separator_gap = System.Convert.ToInt32(level_separator_gap * fontscale); GroupHeader.Height = rowheight; Detail.Height = rowheight; // Prepare datatable DataTable ntable = new DataTable(); idxcol = 0; int posx = 0; // Grey header ShapeItem sitem = new ShapeItem(nreport); sitem.Shape = ShapeType.Rectangle; sitem.BrushStyle = BrushType.Solid; sitem.PenStyle = Reportman.Drawing.PenType.Clear; sitem.BrushColor = GraphicUtils.IntegerFromColor(Color.FromArgb(200, 200, 200)); sitem.Height = rowheight; sitem.Align = PrintItemAlign.TopBottom; HorzShapes.Add(sitem); nreport.GenerateNewName(sitem); GroupHeader.Components.Add(sitem); sitem = new ShapeItem(nreport); sitem.Shape = ShapeType.VertLine; sitem.Height = rowheight; sitem.Align = PrintItemAlign.TopBottom; nreport.GenerateNewName(sitem); GroupHeader.Components.Add(sitem); if (opts.DrawBackGroundColors) { // Background color sitem = new ShapeItem(nreport); sitem.PrintCondition = aliasname + ".BACKCOLOR<>NULL"; sitem.BrushColorExpression = aliasname + ".BACKCOLOR"; sitem.Shape = ShapeType.Rectangle; sitem.Width = maxwidth; sitem.PenStyle = Reportman.Drawing.PenType.Clear; sitem.PosX = posx; sitem.Align = PrintItemAlign.TopBottom; Detail.Components.Add(sitem); HorzShapes.Add(sitem); } sitem = new ShapeItem(nreport);; sitem.Shape = ShapeType.HorzLine; sitem.Width = maxwidth; HorzShapes.Add(sitem); nreport.GenerateNewName(sitem); GroupHeader.Components.Add(sitem); sitem = new ShapeItem(nreport);; sitem.Shape = ShapeType.HorzLine; sitem.Width = maxwidth; HorzShapes.Add(sitem); nreport.GenerateNewName(sitem); GroupFooter.Components.Add(sitem); sitem = new ShapeItem(nreport);; sitem.Shape = ShapeType.HorzLine; sitem.Width = maxwidth; HorzShapes.Add(sitem); sitem.Align = PrintItemAlign.Bottom; nreport.GenerateNewName(sitem); GroupHeader.Components.Add(sitem); if (opts.VerticalLines) { sitem = new ShapeItem(nreport); sitem.Shape = ShapeType.VertLine; sitem.Height = rowheight; sitem.Align = PrintItemAlign.TopBottom; nreport.GenerateNewName(sitem); Detail.Components.Add(sitem); } string columnlevel = ""; for (idxcol = 0; idxcol < Columnas.Count; idxcol++) { DataGridViewColumn ncol = Columnas[idxcol]; DataGridViewContentAlignment cellalign = DataGridViewContentAlignment.NotSet; if (ngrid.DefaultCellStyle != null) { cellalign = ngrid.DefaultCellStyle.Alignment; } if (ncol.DefaultCellStyle != null) { cellalign = ncol.DefaultCellStyle.Alignment; } LabelItem litem = new LabelItem(nreport); SetAlignFromCellFormat(cellalign, litem); litem.VAlignment = TextAlignVerticalType.Top; if (litem.Alignment == TextAlignType.Left) { litem.Alignment = TextAlignType.Justify; } litem.Height = rowheight; litem.FontSize = System.Convert.ToInt16(fsize); nreport.GenerateNewName(litem); litem.Text = ncol.HeaderText; GroupHeader.Components.Add(litem); litem.Height = rowheight; litem.PosX = posx; litem.WordWrap = opts.WordWrap; litem.CutText = !opts.WordWrap; litem.Width = System.Convert.ToInt32(Math.Round(ncol.Width * scalepixels)); bool istextcolumn = false; istextcolumn = ncol is DataGridViewTextBoxColumn; if (!istextcolumn) { if (ncol is DataGridViewColumnAdvanced) { istextcolumn = true; } } TreeGridAdvanced ngridav; if (istextcolumn) { ntable.Columns.Add(Campos[idxcol], System.Type.GetType("System.String")); ColumnasString.Add(idxcol, ncol); if ((ncol is TreeGridAdvancedColumn) && (ngrid is TreeGridAdvanced)) { if (columnlevel == "") { columnlevel = "LEVEL"; } ngridav = (TreeGridAdvanced)ngrid; for (int idxlevel = 1; idxlevel <= ngridav.MaxLevel; idxlevel++) { // Add Image for level ImageItem imaitem = new ImageItem(nreport); imaitem.Expression = aliasname + ".IMAGE"; imaitem.PrintCondition = aliasname + ".LEVEL=" + idxlevel.ToString(); imaitem.Height = rowheight; imaitem.Align = PrintItemAlign.TopBottom; imaitem.Width = level_separator; imaitem.PosX = level_separator_gap + posx + level_separator * (idxlevel) - level_separator + level_separator_gap; imaitem.PosY = 0; imaitem.DrawStyle = ImageDrawStyleType.Full; imaitem.dpires = System.Convert.ToInt32(DefaultScreenDPI); nreport.GenerateNewName(imaitem); Detail.Components.Add(imaitem); // Add expression foreach level ExpressionItem exitem = new ExpressionItem(nreport); exitem.Expression = aliasname + "." + Campos[idxcol]; exitem.PrintCondition = aliasname + ".LEVEL=" + idxlevel.ToString(); exitem.WordWrap = opts.WordWrap; exitem.CutText = !opts.WordWrap; SetAlignFromCellFormat(cellalign, exitem); if (exitem.Alignment == TextAlignType.Left) { exitem.Alignment = TextAlignType.Justify; } exitem.VAlignment = TextAlignVerticalType.Top; exitem.FontSize = System.Convert.ToInt16(fsize); exitem.Height = rowheight; exitem.PosX = level_separator_gap * 2 + posx + level_separator * idxlevel; exitem.Height = rowheight; nreport.GenerateNewName(exitem); exitem.Width = litem.Width - level_separator * (idxlevel + 1); Detail.Components.Add(exitem); if (opts.DrawTreeLines) { // Last child line sitem = new ShapeItem(nreport); sitem.PrintCondition = "((" + aliasname + ".LEVEL=" + idxlevel.ToString() + ") AND (" + aliasname + ".LASTCHILD))"; sitem.Shape = ShapeType.VertLine; sitem.PenStyle = Reportman.Drawing.PenType.Dot; sitem.PosX = level_separator_gap + posx + level_separator * idxlevel - level_separator; sitem.Height = rowheight / 3; Detail.Components.Add(sitem); // Not last child horz line sitem = new ShapeItem(nreport); sitem.PrintCondition = "((" + aliasname + ".LEVEL=" + idxlevel.ToString() + ") AND (NOT (" + aliasname + ".LASTCHILD)))"; sitem.Shape = ShapeType.VertLine; sitem.PenStyle = Reportman.Drawing.PenType.Dot; sitem.PosX = level_separator_gap + posx + level_separator * idxlevel - level_separator; sitem.Align = PrintItemAlign.TopBottom; Detail.Components.Add(sitem); // Other parent lines sitem = new ShapeItem(nreport); sitem.PrintCondition = aliasname + ".LEVEL>" + idxlevel.ToString(); sitem.Shape = ShapeType.VertLine; sitem.Align = PrintItemAlign.TopBottom; sitem.PenStyle = Reportman.Drawing.PenType.Dot; sitem.PosX = level_separator_gap + posx + level_separator * idxlevel - level_separator; sitem.Height = rowheight / 2; Detail.Components.Add(sitem); // Horz arrow sitem = new ShapeItem(nreport); sitem.PrintCondition = aliasname + ".LEVEL=" + idxlevel.ToString(); sitem.PenStyle = Reportman.Drawing.PenType.Dot; sitem.Shape = ShapeType.HorzLine; sitem.PosX = level_separator_gap + posx + level_separator * idxlevel - level_separator; sitem.PosY = rowheight / 3; sitem.Width = level_separator / 2; Detail.Components.Add(sitem); } } } else { ExpressionItem exitem = new ExpressionItem(nreport); exitem.Expression = aliasname + "." + Campos[idxcol]; exitem.WordWrap = opts.WordWrap; exitem.CutText = !opts.WordWrap; SetAlignFromCellFormat(cellalign, exitem); if (exitem.Alignment == TextAlignType.Left) { exitem.Alignment = TextAlignType.Justify; } exitem.VAlignment = TextAlignVerticalType.Top; exitem.FontSize = System.Convert.ToInt16(fsize); exitem.Height = rowheight; exitem.PosX = posx; exitem.Height = rowheight; nreport.GenerateNewName(exitem); exitem.Width = litem.Width; Detail.Components.Add(exitem); } } else { if (ncol is DataGridViewImageColumn) { ColumnasImage.Add(idxcol, ncol); ntable.Columns.Add(Campos[idxcol], System.Type.GetType("System.Object")); ImageItem imaitem = new ImageItem(nreport); imaitem.Expression = aliasname + "." + Campos[idxcol]; imaitem.Height = rowheight; imaitem.Align = PrintItemAlign.TopBottom; imaitem.Width = litem.Width; imaitem.PosX = posx + separator; imaitem.PosY = 0; imaitem.DrawStyle = ImageDrawStyleType.Full; imaitem.dpires = System.Convert.ToInt32(DefaultScreenDPI); nreport.GenerateNewName(imaitem); Detail.Components.Add(imaitem); } else if (ncol is DataGridViewCheckBoxColumn) { ColumnasBool.Add(idxcol, ncol); ntable.Columns.Add(Campos[idxcol], System.Type.GetType("System.Boolean")); ShapeItem cuaditem = new ShapeItem(nreport); cuaditem.Shape = ShapeType.Rectangle; cuaditem.PrintCondition = aliasname + "." + Campos[idxcol] + "<>NULL"; //cuaditem.Align = PrintItemAlign.TopBottom; cuaditem.BrushStyle = BrushType.Clear; cuaditem.Height = rowheight; int shapepos = posx + (litem.Width / 2) - BOOL_WIDTH / 2; cuaditem.PosX = shapepos; cuaditem.PosY = BOOL_SEP; cuaditem.Width = BOOL_WIDTH; cuaditem.Height = BOOL_WIDTH; nreport.GenerateNewName(cuaditem); Detail.Components.Add(cuaditem); cuaditem = new ShapeItem(nreport); cuaditem.Shape = ShapeType.Oblique1; cuaditem.PrintCondition = aliasname + "." + Campos[idxcol]; //cuaditem.Align = PrintItemAlign.TopBottom; cuaditem.BrushStyle = BrushType.Clear; cuaditem.Height = rowheight; cuaditem.PosX = shapepos; cuaditem.PosY = BOOL_SEP; cuaditem.Width = BOOL_WIDTH; cuaditem.Height = BOOL_WIDTH; nreport.GenerateNewName(cuaditem); Detail.Components.Add(cuaditem); cuaditem = new ShapeItem(nreport); cuaditem.Shape = ShapeType.Oblique2; cuaditem.PrintCondition = aliasname + "." + Campos[idxcol]; //cuaditem.Align = PrintItemAlign.TopBottom; cuaditem.BrushStyle = BrushType.Clear; cuaditem.Height = rowheight; cuaditem.PosX = shapepos; cuaditem.PosY = BOOL_SEP; cuaditem.Width = BOOL_WIDTH; cuaditem.Height = BOOL_WIDTH; nreport.GenerateNewName(cuaditem); Detail.Components.Add(cuaditem); } else { throw new Exception("Tipo de columna no soportada:" + ncol.GetType().ToString()); } } posx = posx + litem.Width; posx = posx + System.Convert.ToInt32(separator * scalesep); if (opts.VerticalLines) { sitem = new ShapeItem(nreport); sitem.Shape = ShapeType.VertLine; sitem.PosX = posx; sitem.Height = rowheight; sitem.Align = PrintItemAlign.TopBottom; Detail.Components.Add(sitem); } sitem = new ShapeItem(nreport); sitem.Shape = ShapeType.VertLine; sitem.PosX = posx; sitem.Height = rowheight; sitem.Align = PrintItemAlign.TopBottom; GroupHeader.Components.Add(sitem); if (opts.HorizontalLines) { sitem = new ShapeItem(nreport); sitem.Shape = ShapeType.HorzLine; sitem.Width = maxwidth; HorzShapes.Add(sitem); //sitem.Align = PrintItemAlign.Top; Detail.Components.Add(sitem); sitem = new ShapeItem(nreport); sitem.PrintCondition = "CURRENTGROUP=0"; sitem.Shape = ShapeType.HorzLine; sitem.Width = maxwidth; HorzShapes.Add(sitem); sitem.Align = PrintItemAlign.Bottom; Detail.Components.Add(sitem); } } foreach (ShapeItem nshape in HorzShapes) { nshape.Width = posx; } int colbackground = 0; if (opts.DrawBackGroundColors) { ntable.Columns.Add("BACKCOLOR", System.Type.GetType("System.Int32")); colbackground = ntable.Columns.Count - 1; } if (columnlevel != "") { ntable.Columns.Add("IMAGE", System.Type.GetType("System.Object")); ntable.Columns.Add("LEVEL", System.Type.GetType("System.Int32")); ntable.Columns.Add("LASTCHILD", System.Type.GetType("System.Boolean")); } object[] nvalues = new object[ntable.Columns.Count]; int counter = 0; foreach (DataGridViewRow dgrow in ngrid.Rows) { if ((!opts.PrintSelected) || ((opts.PrintSelected) && (dgrow.Selected))) { foreach (int index in ColumnasString.Keys) { nvalues[index] = dgrow.Cells[ColumnasString[index].Index].FormattedValue; } foreach (int index in ColumnasBool.Keys) { nvalues[index] = dgrow.Cells[ColumnasBool[index].Index].Value; } foreach (int index in ColumnasImage.Keys) { MemoryStream mstream = GetImageStreamFromObject(dgrow.Cells[ColumnasImage[index].Index].Value); if (mstream != null) { nvalues[index] = mstream; } else { nvalues[index] = DBNull.Value; } } if (opts.DrawBackGroundColors) { DataGridViewCellStyle nstyle = null; if (!dgrow.DefaultCellStyle.BackColor.IsEmpty) { nstyle = dgrow.DefaultCellStyle; } if (nstyle == null) { if ((!ngrid.AlternatingRowsDefaultCellStyle.BackColor.IsEmpty)) { if (counter % 2 == 1) { nstyle = ngrid.AlternatingRowsDefaultCellStyle; } else if (!ngrid.DefaultCellStyle.BackColor.IsEmpty) { nstyle = ngrid.DefaultCellStyle; } } else { if (!ngrid.DefaultCellStyle.BackColor.IsEmpty) { nstyle = ngrid.AlternatingRowsDefaultCellStyle; } } } nvalues[colbackground] = DBNull.Value; if (nstyle != null) { if (nstyle.BackColor != Color.White) { if (nstyle.BackColor != Color.FromArgb(255, 255, 255)) { nvalues[colbackground] = GraphicUtils.IntegerFromColor(nstyle.BackColor); } } } } if (columnlevel.Length > 0) { TreeGridRow trow = (TreeGridRow)dgrow; MemoryStream mstream = GetImageStreamFromObject(trow.Image); if (mstream != null) { nvalues[nvalues.Length - 3] = mstream; } nvalues[nvalues.Length - 2] = trow.Level; nvalues[nvalues.Length - 1] = trow.IsLastSibling; /* * if (trow.Parent != null) * nvalues[nvalues.Length - 1] = ((trow.Node.Childs.Count == 0) || (!trow.Node.Expanded)) && (((TreeGridRow)dgrow).ChildIndex + 1) == ((TreeGridRow)dgrow).Parent.Node.Childs.Count; * else * { * nvalues[nvalues.Length - 1] = ((trow.Node.Childs.Count == 0) || (!trow.Node.Expanded)) && (((TreeGridAdvanced)ngrid).MainNode.Childs.Count == trow.ChildIndex + 1); * }*/ } ntable.Rows.Add(nvalues); counter++; } } nreport.DataInfo[aliasname].DataViewOverride = new DataView(ntable); //return meta; }
private void InitShapeComboBox() { Debug.Assert(templateController != null && templateController.IsInitialized); if (shapeComboBox.Items.Count > 0) shapeComboBox.Items.Clear(); ShapeType shapeType = null; if (templateController.WorkTemplate.Shape != null) shapeType = templateController.WorkTemplate.Shape.Type; foreach (Shape shape in templateController.Shapes) { if (!shape.Type.SupportsAutoTemplates) continue; ShapeItem item = new ShapeItem(shape, shapeComboBox.Items.Count); int idx = shapeComboBox.Items.Add(item); Debug.Assert(idx == item.Index); if (shape.DisplayService != this) shape.DisplayService = this; if (shapeType != null && shape.Type == shapeType) shapeComboBox.SelectedIndex = item.Index; } }