void OnSideThicknessComboSelectedIndexChanged(NValueChangeEventArgs args) { NComboBox combo = args.TargetNode as NComboBox; double sideThickness = combo.SelectedIndex; NMargins bt = m_BoxBorderElement.BorderThickness; if (combo == m_BorderThicknessCombo) { bt = new NMargins(sideThickness); } else if (combo == m_LeftSideThicknessCombo) { bt.Left = sideThickness; } else if (combo == m_RightSideThicknessCombo) { bt.Right = sideThickness; } else if (combo == m_TopSideThicknessCombo) { bt.Top = sideThickness; } else if (combo == m_BottomSideThicknessCombo) { bt.Bottom = sideThickness; } NCustomBorderWallWidget[] elements = GetCustomBorderElements(); for (int i = 0; i < elements.Length; i++) { elements[i].BorderThickness = bt; } }
/// <summary> /// Gets the padding of the element. /// </summary> /// <returns></returns> public override NMargins GetPadding() { NMargins padding = base.GetPadding(); string status = Status; if (String.IsNullOrEmpty(status) == false) { NSize statusTextSize = StatusFont.MeasureString(Status, OwnerDocument); padding.Right += statusTextSize.Width + StatusLeftPadding + StatusRightPadding; } return(padding); }
private void OnPrintPage(NPrintDocument sender, NPrintPageEventArgs e) { NSize pageSizeDIP = new NSize(this.Width, this.Height); try { NMargins pageMargins = NMargins.Zero; NRegion clip = NRegion.FromRectangle(new NRectangle(0, 0, e.PrintableArea.Width, e.PrintableArea.Height)); NMatrix transform = new NMatrix(e.PrintableArea.X, e.PrintableArea.Y); NPaintVisitor visitor = new NPaintVisitor(e.Graphics, 300, transform, clip); // forward traverse the display tree this.OwnerWindow.VisitDisplaySubtree(visitor); e.HasMorePages = false; } catch (Exception x) { NMessageBox.Show(x.Message, "Exception", ENMessageBoxButtons.OK, ENMessageBoxIcon.Error); } }
private NBorderWall CreateCrossBorderWall() { NRectangle r0 = GetContentEdge(); NMargins bt = BorderThickness; bt.Left = Math.Min(bt.Left, r0.Width / 6); bt.Right = Math.Min(bt.Right, r0.Width / 6); bt.Top = Math.Min(bt.Top, r0.Height / 6); bt.Bottom = Math.Min(bt.Bottom, r0.Height / 6); NRectangle r1 = bt.GetInnerRect(r0); NRectangle r2 = NRectangle.FromLTRB( r1.X + r1.Width / 3 - (bt.Left / 2), r1.Y + r1.Height / 3 - (bt.Top / 2), r1.Right - r1.Width / 3 + (bt.Right / 2), r1.Bottom - r1.Height / 3 + (bt.Bottom / 2)); NRectangle r3 = bt.GetInnerRect(r2); double x0 = r0.X; double x1 = r1.X; double x2 = r2.X; double x3 = r3.X; double x4 = r3.Right; double x5 = r2.Right; double x6 = r1.Right; double x7 = r0.Right; double y0 = r0.Y; double y1 = r1.Y; double y2 = r2.Y; double y3 = r3.Y; double y4 = r3.Bottom; double y5 = r2.Bottom; double y6 = r1.Bottom; double y7 = r0.Bottom; NBorderWall wall = new NBorderWall(true); wall.AddLeftTopCorner(new NRectangle(x2, y0, bt.Left, bt.Top)); wall.AddTopSide(new NRectangle(x3, y0, x4 - x3, bt.Top)); wall.AddTopRightCorner(new NRectangle(x4, y0, bt.Right, bt.Top)); wall.AddRightSide(new NRectangle(x4, y1, bt.Right, y2 - y1)); wall.AddRightTopCorner(new NRectangle(x4, y2, bt.Right, bt.Top)); wall.AddTopSide(new NRectangle(x5, y2, x6 - x5, bt.Top)); wall.AddTopRightCorner(new NRectangle(x6, y2, bt.Right, bt.Top)); wall.AddRightSide(new NRectangle(x6, y3, bt.Right, y4 - y3)); wall.AddRightBottomCorner(new NRectangle(x6, y4, bt.Right, bt.Bottom)); wall.AddBottomSide(new NRectangle(x5, y4, x6 - x5, bt.Bottom)); wall.AddBottomRightCorner(new NRectangle(x4, y4, bt.Right, bt.Bottom)); wall.AddRightSide(new NRectangle(x4, y5, bt.Right, y6 - y5)); wall.AddRightBottomCorner(new NRectangle(x4, y6, bt.Right, bt.Bottom)); wall.AddBottomSide(new NRectangle(x3, y6, x4 - x3, bt.Bottom)); wall.AddBottomLeftCorner(new NRectangle(x2, y6, bt.Left, bt.Bottom)); wall.AddLeftSide(new NRectangle(x2, y5, bt.Left, y6 - y5)); wall.AddLeftBottomCorner(new NRectangle(x2, y4, bt.Left, bt.Bottom)); wall.AddBottomSide(new NRectangle(x1, y4, x2 - x1, bt.Bottom)); wall.AddBottomLeftCorner(new NRectangle(x0, y4, bt.Left, bt.Bottom)); wall.AddLeftSide(new NRectangle(x0, y3, bt.Left, y4 - y3)); wall.AddLeftTopCorner(new NRectangle(x0, y2, bt.Left, bt.Top)); wall.AddTopSide(new NRectangle(x1, y2, x2 - x1, bt.Top)); wall.AddTopLeftCorner(new NRectangle(x2, y2, bt.Left, bt.Top)); wall.AddLeftSide(new NRectangle(x2, y1, bt.Left, y2 - y1)); return(wall); }