public static char GetBorderChar(BorderStyle style, BorderPosition position) { // TODO: Replace this switch with dictionary switch (style) { case (BorderStyle.Simple): return(SimpleBorder[position]); case (BorderStyle.Bold): return(BoldBorder[position]); case (BorderStyle.ExtraBold): return(ExtraBoldBorder[position]); case (BorderStyle.Dashline): return(DashlineBorder[position]); case (BorderStyle.Double): return(DoubleBorder[position]); case (BorderStyle.Rounded): return(RoundedBorder[position]); case (BorderStyle.None): return(' '); } return(SimpleBorder[position]); }
/// <summary> /// 使用指定的元素和位置创建一个新的窗口边框. /// </summary> /// <param name="position"></param> /// <param name="element"></param> public WindowBorder(BorderPosition position, FrameworkElement element) { if (element == null) { throw new ArgumentNullException("element"); } Position = position; Element = element; }
/// <summary> /// Creates a new window border using the specified element and position. /// </summary> /// <param name="position"></param> /// <param name="element"></param> public WindowBorder(BorderPosition position, FrameworkElement element) { if (element == null) { throw new ArgumentNullException("element"); } Position = position; Element = element; }
public Border( BorderPosition position, Color?color = null, BorderLineStyle lineStyle = BorderLineStyle.Continuous, float weight = 1.0f) { this.Position = position; this.Color = color ?? Color.Black; this.LineStyle = lineStyle; this.Weight = weight; }
private MarkupCrosswalkSelectPropertyPanel AddBorderProperty(BorderPosition position, string text) { var border = ComponentPool.Get <MarkupCrosswalkSelectPropertyPanel>(PropertiesPanel); border.Text = text; border.Position = position; border.Init(); border.OnSelect += (panel) => SelectBorder(panel); border.OnHover += HoverBorder; border.OnLeave += LeaveBorder; return(border); }
private MarkupRegularLine[] GetBorderLines(BorderPosition border) { var point = border == BorderPosition.Right ? EditObject.CrosswalkLine.Start : EditObject.CrosswalkLine.End; if (point.Enter.TryGetPoint(point.Num, MarkupPoint.PointType.Enter, out MarkupPoint enterPoint)) { return(enterPoint.Markup.GetPointLines(enterPoint).OfType <MarkupRegularLine>().ToArray()); } else { return(new MarkupRegularLine[0]); } }
private CrosswalkBorderSelectPropertyPanel AddBorderProperty(BorderPosition position, string name, string text) { var border = ComponentPool.Get <CrosswalkBorderSelectPropertyPanel>(PropertiesPanel, name); border.Text = text; border.Position = position; border.Init(); border.OnSelect += (panel) => SelectBorder(panel); border.OnReset += (panel) => Tool.SetDefaultMode(); border.OnHover += HoverBorder; border.OnLeave += LeaveBorder; return(border); }
public BorderProperty( BorderStyle style = BorderStyle.None, BorderPosition position = BorderPosition.Center, Color color = new Color(), float thickness = 0, float dashLength = 0.05f, float gapLength = 0.05f ) { this.style = style; this.position = position; this.color = color; this.thickness = thickness; this.dashLength = dashLength; this.gapLength = gapLength; }
//Quang Huy 2014-02-19 /// <summary> /// Tạo viền cho ô /// </summary> /// <param name="cell"></param> /// <param name="position"></param> /// <param name="color"></param> private bool SetCellBorder(Aspose.Cells.Cell cell, BorderPosition position = BorderPosition.Around, System.Drawing.Color?color = null) { try { System.Drawing.Color c = color ?? System.Drawing.Color.Black; Aspose.Cells.Style style = cell.GetStyle(); if (((int)position & (int)BorderPosition.Top) == (int)BorderPosition.Top) { style.Borders[Aspose.Cells.BorderType.TopBorder].LineStyle = Aspose.Cells.CellBorderType.Thin; style.Borders[Aspose.Cells.BorderType.TopBorder].Color = c; } if (((int)position & (int)BorderPosition.Right) == (int)BorderPosition.Right) { style.Borders[Aspose.Cells.BorderType.RightBorder].LineStyle = Aspose.Cells.CellBorderType.Thin; style.Borders[Aspose.Cells.BorderType.RightBorder].Color = c; } if (((int)position & (int)BorderPosition.Bottom) == (int)BorderPosition.Bottom) { style.Borders[Aspose.Cells.BorderType.BottomBorder].LineStyle = Aspose.Cells.CellBorderType.Thin; style.Borders[Aspose.Cells.BorderType.BottomBorder].Color = c; } if (((int)position & (int)BorderPosition.Left) == (int)BorderPosition.Left) { style.Borders[Aspose.Cells.BorderType.LeftBorder].LineStyle = Aspose.Cells.CellBorderType.Thin; style.Borders[Aspose.Cells.BorderType.LeftBorder].Color = c; } if (((int)position & (int)BorderPosition.DiagonalDown) == (int)BorderPosition.DiagonalDown) { style.Borders[Aspose.Cells.BorderType.DiagonalDown].LineStyle = Aspose.Cells.CellBorderType.Thin; style.Borders[Aspose.Cells.BorderType.DiagonalDown].Color = c; } if ((((int)position & (int)BorderPosition.DiagonalUp) == (int)BorderPosition.DiagonalUp) || (position == BorderPosition.Full)) { style.Borders[Aspose.Cells.BorderType.DiagonalUp].LineStyle = Aspose.Cells.CellBorderType.Thin; style.Borders[Aspose.Cells.BorderType.DiagonalUp].Color = c; } //Apply the border styles to the cell cell.SetStyle(style); return(true); } catch { } return(false); }
void UpdateBorderLayer(BorderPosition borderPosition, nfloat thickness) { var borderLayer = borderLayers[(int)borderPosition]; if (thickness <= 0) { if (borderLayer != null) { borderLayer.RemoveFromSuperLayer(); borderLayers[(int)borderPosition] = null; } } else { if (borderLayer == null) { borderLayer = new CALayer(); Layer.AddSublayer(borderLayer); borderLayers[(int)borderPosition] = borderLayer; } switch (borderPosition) { case BorderPosition.Left: borderLayer.Frame = new CGRect(0, 0, thickness, (nfloat)Element.Height); break; case BorderPosition.Top: borderLayer.Frame = new CGRect(0, 0, (nfloat)Element.Width, thickness); break; case BorderPosition.Right: borderLayer.Frame = new CGRect((nfloat)Element.Width - thickness, 0, thickness, (nfloat)Element.Height); break; case BorderPosition.Bottom: borderLayer.Frame = new CGRect(0, (nfloat)Element.Height - thickness, (nfloat)Element.Width, thickness); break; } borderLayer.BackgroundColor = Element.Stroke.ToCGColor(); borderLayer.CornerRadius = (nfloat)Element.CornerRadius; } }
private int GetBorderPositionOrdering(BorderPosition pos) { switch (pos) { default: return(-1); case BorderPosition.Left: return(0); case BorderPosition.Right: return(1); case BorderPosition.Top: return(2); case BorderPosition.Bottom: return(3); case BorderPosition.DiagonalRight: return(4); case BorderPosition.DiagonalLeft: return(4); } }
void UpdateBorderLayer(BorderPosition borderPosition, nfloat thickness, nfloat width, nfloat height) { var borderLayer = borderLayers[(int)borderPosition]; if (thickness <= 0) { if (borderLayer != null) { borderLayer.RemoveFromSuperLayer(); borderLayers[(int)borderPosition] = null; } } else { if (borderLayer == null) { borderLayer = new CALayer(); Layer.AddSublayer(borderLayer); borderLayers[(int)borderPosition] = borderLayer; } switch (borderPosition) { case BorderPosition.Left: borderLayer.Frame = new CGRect(0, 0, thickness, height); break; case BorderPosition.Top: borderLayer.Frame = new CGRect(0, 0, width, thickness); break; case BorderPosition.Right: borderLayer.Frame = new CGRect(width - thickness, 0, thickness, height); break; case BorderPosition.Bottom: borderLayer.Frame = new CGRect(0, height - thickness, width, thickness); break; } borderLayer.BackgroundColor = TranslateFormsColor(SourceView.OutlineColor).CGColor; borderLayer.CornerRadius = (nfloat)SourceView.Radius; } }
//Quang Huy 2014-02-17 /// <summary> /// tạo viền cho range /// </summary> /// <param name="range"></param> /// <param name="position"></param> /// <param name="color"></param> private void SetRangeBorder(Aspose.Cells.Range range, BorderPosition position = BorderPosition.Around, System.Drawing.Color?color = null) { System.Drawing.Color c = color ?? System.Drawing.Color.Black; if (((int)position & (int)BorderPosition.Top) == (int)BorderPosition.Top) { range.SetOutlineBorder(Aspose.Cells.BorderType.TopBorder, CellBorderType.Thin, c); } if (((int)position & (int)BorderPosition.Right) == (int)BorderPosition.Right) { range.SetOutlineBorder(Aspose.Cells.BorderType.RightBorder, CellBorderType.Thin, c); } if (((int)position & (int)BorderPosition.Bottom) == (int)BorderPosition.Bottom) { range.SetOutlineBorder(Aspose.Cells.BorderType.BottomBorder, CellBorderType.Thin, c); } if (((int)position & (int)BorderPosition.Left) == (int)BorderPosition.Left) { range.SetOutlineBorder(Aspose.Cells.BorderType.LeftBorder, CellBorderType.Thin, c); } if (((int)position & (int)BorderPosition.DiagonalDown) == (int)BorderPosition.DiagonalDown) { range.SetOutlineBorder(Aspose.Cells.BorderType.DiagonalDown, CellBorderType.Thin, c); } if (((int)position & (int)BorderPosition.DiagonalUp) == (int)BorderPosition.DiagonalUp) { range.SetOutlineBorder(Aspose.Cells.BorderType.DiagonalUp, CellBorderType.Thin, c); } if (((int)position & (int)BorderPosition.Full) == (int)BorderPosition.Full) { for (int i = 0; i < range.RowCount; i++) { for (int j = 0; j < range.ColumnCount; j++) { SetCellBorder(range.FirstRow + i, range.FirstColumn + j); } } } }
/// <summary> /// Puts a resize message on the message queue for the specified border position. /// </summary> /// <param name="direction"></param> private void ResizeWindow(BorderPosition direction) { NativeMethods.SendMessage(hwndSource.Handle, 0x112, (IntPtr)direction, IntPtr.Zero); }
private void ResizeWindow(BorderPosition direction) { SendMessage(_windowHandle, 0x112, (IntPtr)direction, IntPtr.Zero); }
public void SetBorder(string border, BorderPosition position, bool textureRepeat, bool textureRotate, string textureFilename, long colorKey, bool hasCorners, bool cornerTextureRotate) { _strBorder = border; _borderPosition = position; _borderTextureRepeat = textureRepeat; _borderTextureRotate = textureRotate; _borderTextureFileName = textureFilename; _borderColorKey = colorKey; _borderHasCorners = hasCorners; _borderCornerTextureRotate = cornerTextureRotate; FinalizeBorder(); }
public float GetT(BorderPosition border) => (int)border;
/// <summary> /// Puts a resize message on the message queue for the specified border position. /// </summary> /// <param name="direction"></param> private void ResizeWindow(BorderPosition direction) { _win32.SendWMMessage(hwndSource.Handle, 0x112, (IntPtr)direction, IntPtr.Zero); }
public CrosswalkBorderEdge(MarkupCrosswalkLine crosswalkLine, BorderPosition border) : base() { CrosswalkLine = crosswalkLine; Border = border; Update(); }
/// <summary> /// Puts a resize message on the message queue for the specified border position. /// </summary> /// <param name="direction"></param> private void ResizeWindow(BorderPosition direction) { SendMessage(hwndSource.Handle, 0x112, (IntPtr)direction, IntPtr.Zero); }
public CrosswalkBorderEdge(MarkupCrosswalkLine crosswalkLine, BorderPosition border) : base(crosswalkLine.Trajectory.Position(crosswalkLine.GetT(border))) { CrosswalkLine = crosswalkLine; Border = border; }
//Quang Huy 2014-02-19 /// <summary> /// Thực hiện đặt viền cho ô /// </summary> /// <param name="rowIndex">chỉ số dòng (dòng 1 chỉ số là 0)</param> /// <param name="colIndex">chỉ số cột (cột A chỉ số là 1)</param> /// <param name="position">Vị trí viền (mặc định viền xung quanh)</param> /// <param name="color">màu viền (mặc định đen)</param> /// <returns></returns> public bool SetCellBorder(int rowIndex, int colIndex, BorderPosition position = BorderPosition.Around, System.Drawing.Color?color = null) { Aspose.Cells.Cell cell = _worksheet.Cells[rowIndex, colIndex]; return(SetCellBorder(cell, position, color)); }
//Quang Huy 2014-02-17 /// <summary> /// Tạo viền cho nhóm ô /// </summary> /// <param name="topLeftCellName">Tên ô đầu (phía trên bên trái) vd "A1"</param> /// <param name="bottomRightCellName">Tên ô (phía dưới bên phải) vd "B4"</param> /// <param name="position">Vị trí của viền</param> /// <param name="color">Màu của viền</param> public void SetRangeBorder(string topLeftCellName, string bottomRightCellName, BorderPosition position = BorderPosition.Around, System.Drawing.Color?color = null) { Aspose.Cells.Range range = _worksheet.Cells.CreateRange(topLeftCellName, bottomRightCellName); SetRangeBorder(range, position, color); }
//Quang Huy 2014-02-17 /// <summary> /// Tạo viền cho nhóm ô /// </summary> /// <param name="rowIndex">chỉ số dòng (dòng 1 chỉ số là 0)</param> /// <param name="colIndex">chỉ số cột (cột A chỉ số là 1)</param> /// <param name="rowNumber">có bao nhiêu dòng</param> /// <param name="collumnNumber">bao nhiêu cột</param> /// <param name="position">Vị trí của viền</param> /// <param name="color">Màu của viền</param> public void SetRangeBorder(int firstRow, int firstColumn, int rowNumber, int columnNumber, BorderPosition position = BorderPosition.Around, System.Drawing.Color?color = null) { Aspose.Cells.Range range = _worksheet.Cells.CreateRange(firstRow, firstColumn, rowNumber, columnNumber); SetRangeBorder(range, position, color); }
//Quang Huy 2014-02-19 /// <summary> /// Thực hiện đặt viền cho ô /// </summary> /// <param name="cellName">Tên của ô (VD "B6")</param> /// <param name="position">Vị trí viền (mặc định viền xung quanh)</param> /// <param name="color">màu viền (mặc định đen)</param> public bool SetCellBorder(string cellName, BorderPosition position = BorderPosition.Around, System.Drawing.Color?color = null) { Aspose.Cells.Cell cell = _worksheet.Cells[cellName]; return(SetCellBorder(cell, position, color)); }
public CellBorder(BorderPosition position) { this.Position = position; }