protected override Size MeasureOverride(Size availableSize) { if (_owner.Excel._fastScroll) { return(availableSize); } var sheet = _owner.Excel.ActiveSheet; _gridLine = sheet.GetGridLine(SheetArea.Cells); _recycledStart = 0; _location = _owner.PointToClient(new Point()); _lines.Clear(); _vBorderLineCache.Clear(); _hBorderLineCache.Clear(); _cellBoundsCache.Clear(); CalcVisibleRowColumnIndexes(); BuildHorizontalBorders(); BuildVerticalBorders(); LinkBorders(availableSize); RecycleBorders(); return(availableSize); }
void BuildVerticalBorders() { if (_visibleCols.Count == 0) { return; } for (int i = 0; i < _visibleCols.Count; i++) { int column = _visibleCols[i]; if (column > _viewportRightColumn) { return; } LineItem previousLineItem = null; BorderLine previousLine = null; BorderLine line2 = null; BorderLine line3 = null; int length = _visibleRows.Count; for (int j = 0; j < length; j++) { int row = _visibleRows[j]; if ((j == (length - 1)) && (row > _viewportBottomRow)) { break; } if ((row != -1) || (column != -1)) { BuildBordersInternal(ref j, ref i, row, column, 1, ref previousLineItem, ref previousLine, ref line2, ref line3); } } } }
public void ApplyColors() { GridColor = ColorThemeHelper.ColorBetween(WindowColor, ForeColor, 0.5f); var ln = new BorderLine(GridColor, 1); DefaultBorderF = new RectangleBorder(ln, ln, ln, ln); DefaultBorder3 = new RectangleBorder(BorderLine.NoBorder, ln, ln, ln); DefaultBorder = new RectangleBorder(ln, ln); titleModel.ForeColor = ForeColor; titleModel.BackColor = ColorThemeHelper.ColorBetween(BackColor, ForeColor, 0.1f); titleModel.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter; titleModel.Border = DefaultBorderF; titleModel2.ForeColor = ForeColor; titleModel2.BackColor = BackColor; titleModel2.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter; titleModel2.Border = DefaultBorder; titleDataCellModel.ForeColor = ForeColor; titleDataCellModel.BackColor = titleModel.BackColor; titleDataCellModel.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleRight; titleDataCellModel.Border = DefaultBorderF; rowHeaderModel.ForeColor = ForeColor; rowHeaderModel.BackColor = BackColor; rowHeaderModel.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter; rowHeaderModel.Border = DefaultBorder3; rowHeaderModelRed.ForeColor = Color.White; rowHeaderModelRed.BackColor = Color.IndianRed; rowHeaderModelRed.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter; rowHeaderModelRed.Border = DefaultBorder3; captionModel.ForeColor = ForeColor; captionModel.BackColor = BackColor; captionModel.Border = DefaultBorder; dataCellModel.ForeColor = ForeColor; dataCellModel.BackColor = WindowColor; dataCellModel.Border = DefaultBorder; dataCellMultiLineModel.ForeColor = ForeColor; dataCellMultiLineModel.BackColor = WindowColor; dataCellMultiLineModel.Border = DefaultBorder; dataCellMultiLineModel.TextAlignment = ContentAlignment.TopLeft; dataCellMultiLineModel.WordWrap = true; dataCellModelAllignRight.ForeColor = ForeColor; dataCellModelAllignRight.BackColor = WindowColor; dataCellModelAllignRight.TextAlignment = ContentAlignment.MiddleRight; dataCellModelAllignRight.Border = DefaultBorder; dataCellCheckBox.ForeColor = ForeColor; dataCellCheckBox.BackColor = WindowColor; dataCellCheckBox.Border = DefaultBorder; }
private static void DrawScreen() { //lock (ScreenManager.LockSection) //{ RightBorderLine.draw(); BorderLine.draw(); InstrutionLabel.draw(); menutxtBox.draw(); messagebox.draw(); //} }
private float HTMLBorderWidth(BorderLine line) { if (line.Style == LineStyle.Double) { return(line.Width * 3 * Zoom); } else { return(line.Width * Zoom); } }
public FlatHeaderVisual() { _background = new BackgroundSolid(Color.Empty); BackColor = Color.FromKnownColor(KnownColor.Control); var darkdarkControl = Utilities.CalculateLightDarkColor(BackColor, -0.2f); var darkB = new BorderLine(darkdarkControl, 1); _border = new RectangleBorder(darkB, darkB); }
public Header(float gradientAngle) { GradientAngle = gradientAngle; mBackground = new BackgroundLinearGradient(Color.Empty, Color.Empty, GradientAngle); BackColor = Color.FromKnownColor(KnownColor.Control); Color darkdarkControl = Utilities.CalculateLightDarkColor(BackColor, -0.2f); BorderLine darkB = new BorderLine(darkdarkControl, 1); mBorder = new RectangleBorder(darkB, darkB); }
void SetBorder(Cell cell, BorderLine border) { if (border == null) { cell.BorderLeft = cell.BorderTop = cell.BorderRight = cell.BorderBottom = null; } else { cell.BorderLeft = border.Clone() as BorderLine; cell.BorderTop = border.Clone() as BorderLine; cell.BorderRight = border.Clone() as BorderLine; cell.BorderBottom = border.Clone() as BorderLine; } }
private static void DrawScreen() { //lock (ScreenManager.LockSection) //{ BorderLine.draw(); TitleLabel.draw(); menutxtBox.draw(); HealthLevelTitleLabel.draw(); EnemyTitleLabel.draw(); HealthBar.draw(); EnemyHealthBar.draw(); //} }
private string HTMLBorderWidthPx(BorderLine line) { if (line.Style != LineStyle.Double && line.Width == 1 && Zoom == 1) { return("1px;"); } float width; if (line.Style == LineStyle.Double) { width = line.Width * 3 * Zoom; } else { width = line.Width * Zoom; } return(Convert.ToString(Math.Round(width, 2), numberFormat) + "px;"); }
private string HTMLBorderStyle(BorderLine line) { switch (line.Style) { case LineStyle.Dash: case LineStyle.DashDot: case LineStyle.DashDotDot: return("dashed"); case LineStyle.Dot: return("dotted"); case LineStyle.Double: return("double"); default: return("solid"); } }
public void ToggleLine(BorderLines line, bool state) { BorderLine line1 = null; switch (line) { case BorderLines.Top: line1 = Border.TopLine; break; case BorderLines.Bottom: line1 = Border.BottomLine; break; case BorderLines.Left: line1 = Border.LeftLine; break; case BorderLines.Right: line1 = Border.RightLine; break; } if (line1 != null) { if (state || (line1.Style != LineStyle || line1.Width != LineWidth || line1.Color != LineColor)) { Border.Lines = Border.Lines | line; line1.Style = LineStyle; line1.Width = LineWidth; line1.Color = LineColor; } else { Border.Lines = Border.Lines & ~line; } } Change(); }
private static void DrawScreen() { BorderLine.draw(); TitleLabel.draw(); WeaponTypeLabel.draw(); ArmourTypeLabel.draw(); //Updatable GoldItemLabel.draw(); SilverItemLabel.draw(); KeyItemLabel.draw(); ArmourItemLabel.draw(); SwordItemLabel.draw(); HealthPotionLabel.draw(); TotalItemLabel.draw(); TotalEnemyLabel.draw(); TotalMonsterWLabel.draw(); TotalGlobinWLabel.draw(); WeaponTypeValLabel.draw(); ArmourTypeValLabel.draw(); WeaponBar.draw(); ArmourBar.draw(); }
public BaseAppointmentBook() { CanResize = true; HasRowHeaders = true; HasColHeaders = true; HorizontalBorderLine = new BorderLine { Color = Color.Lavender, DashStyle = System.Drawing.Drawing2D.DashStyle.Dash, Padding = 0, Width = 1 }; SelectedAppointmentBorderLine = new BorderLine { Color = Color.Black, DashStyle = System.Drawing.Drawing2D.DashStyle.Solid, Padding = 0, Width = 2 }; AppointmentBorderLine = new BorderLine { Color = Color.Black, DashStyle = System.Drawing.Drawing2D.DashStyle.Solid, Padding = 0, Width = 1 }; MaxColumnWidth = 400; MinColumnWidth = 100; RowHeaderColumnWidth = 32; DistanceMovedToInitiateDragging = 12; InitializeComponent(); _grid.Cursor = null; _viewModel = null; _cellDisplays = new Dictionary <Tuple <int, int>, Tuple <SourceGrid.Cells.Cell, CellViewModel> >(); ClearSelection(); }
private static void DrawScreen() { //lock (ScreenManager.LockSection) //{ TitleLabel.draw(); BorderLine.draw(); ScoreLabel.draw(); NoRoomLabel.draw(); ExperienceLabel.draw(); GameLevelLabel.draw(); HealthLevelLabel.draw(); //Second Column HealthPotionLabel.draw(); RoomLabel.draw(); TotalGoldLabel.draw(); TotalSilverLabel.draw(); WeaponLabel.draw(); ArmourLabel.draw(); DrawLogo(); //} }
BorderLine GetCellActualBorderLine(int row, int column, Borders borderIndex, out bool isInCellflow) { isInCellflow = false; bool flag = false; BorderLine empty = null; Cell cachedCell = null; byte state = _owner.CachedSpanGraph.GetState(row, column); switch (borderIndex) { case Borders.LEFT: if (state <= 0) { CellOverflowLayoutModel model = _owner.CellOverflowLayoutBuildEngine.GetModel(row); if (model != null) { CellOverflowLayout cellOverflowLayout = model.GetCellOverflowLayout(column); if (cellOverflowLayout != null) { if (cellOverflowLayout.StartingColumn > -1) { if (cellOverflowLayout.StartingColumn == column) { empty = GetCellBorderByBorderIndex(row, column, borderIndex, ref cachedCell); } else { empty = null; isInCellflow = true; } } else if (cellOverflowLayout.Column == column) { empty = GetCellBorderByBorderIndex(row, column, borderIndex, ref cachedCell); } else { empty = null; isInCellflow = true; } } else { empty = GetCellBorderByBorderIndex(row, column, borderIndex, ref cachedCell); } } else { empty = GetCellBorderByBorderIndex(row, column, borderIndex, ref cachedCell); } break; } if ((state & 1) != 1) { flag = true; break; } empty = GetCellBorderByBorderIndex(row, column, borderIndex, ref cachedCell); break; case Borders.TOP: if (state <= 0) { empty = GetCellBorderByBorderIndex(row, column, borderIndex, ref cachedCell); break; } if ((state & 2) != 2) { flag = true; break; } empty = GetCellBorderByBorderIndex(row, column, borderIndex, ref cachedCell); break; case Borders.RIGHT: if (state <= 0) { CellOverflowLayoutModel model2 = _owner.CellOverflowLayoutBuildEngine.GetModel(row); if (model2 != null) { CellOverflowLayout layout2 = model2.GetCellOverflowLayout(column); if (layout2 != null) { if (layout2.EndingColumn > -1) { if (layout2.EndingColumn == column) { empty = GetCellBorderByBorderIndex(row, column, borderIndex, ref cachedCell); } else { empty = null; isInCellflow = true; } } else if (layout2.Column == column) { empty = GetCellBorderByBorderIndex(row, column, borderIndex, ref cachedCell); } else { empty = null; isInCellflow = true; } } else { empty = GetCellBorderByBorderIndex(row, column, borderIndex, ref cachedCell); } } else { empty = GetCellBorderByBorderIndex(row, column, borderIndex, ref cachedCell); } break; } if ((state & 4) != 4) { flag = true; break; } empty = GetCellBorderByBorderIndex(row, column, borderIndex, ref cachedCell); break; case Borders.BOTTOM: if (state <= 0) { empty = GetCellBorderByBorderIndex(row, column, borderIndex, ref cachedCell); break; } if ((state & 8) != 8) { flag = true; break; } empty = GetCellBorderByBorderIndex(row, column, borderIndex, ref cachedCell); break; } if ((!flag && !isInCellflow) && (empty == null)) { if (_owner.Excel.ZoomFactor < 0.4f) { return(BorderLine.Empty); } empty = _gridLine; if ((state & 0x20) == 0x20) { return(BorderLine.Empty); } if (state != 0) { return(empty); } if (cachedCell == null) { cachedCell = _owner.CellCache.GetCachedCell(row, column); } if ((cachedCell != null) && (cachedCell.ActualBackground != null)) { empty = BorderLine.Empty; } } return(empty); }
public void ApplyColors() { GridColor = ColorThemeHelper.ColorBetween(WindowColor, ForeColor, 0.5f); CaptionColor = ColorThemeHelper.ColorBetween(BackColor, ForeColor, 0.3f); WeekendBackColor = ColorThemeHelper.ColorBetween(BackColor, ForeColor, 0.1f); HollydayBackColor = ColorThemeHelper.ColorBetween(BackColor, ForeColor, 0.2f); HollydayForeColor = ColorThemeHelper.ColorBetween(Color.FromArgb(250, 0, 0), ForeColor, 0.3f); OutForeColor = ColorThemeHelper.ColorBetween(BackColor, ForeColor, 0.7f); var ln = new BorderLine(GridColor, 1); DefaultBorderF = new RectangleBorder(ln, ln, ln, ln); DefaultBorder3 = new RectangleBorder(BorderLine.NoBorder, ln, ln, ln); DefaultBorder = new RectangleBorder(ln, ln); captionModel.ForeColor = ForeColor; captionModel.BackColor = CaptionColor; captionModel.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter; captionModel.Border = DefaultBorderF; dayCellModel.ForeColor = ForeColor; dayCellModel.BackColor = BackColor; dayCellModel.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter; dayCellModel.Border = DefaultBorder; dayCellModelLeft.ForeColor = ForeColor; dayCellModelLeft.BackColor = BackColor; dayCellModelLeft.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter; dayCellModelLeft.Border = DefaultBorder3; dayCellModelWeekend.ForeColor = ForeColor; dayCellModelWeekend.BackColor = WeekendBackColor; dayCellModelWeekend.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter; dayCellModelWeekend.Border = DefaultBorder; dayCellModelHollyday.ForeColor = HollydayForeColor; dayCellModelHollyday.BackColor = BackColor; dayCellModelHollyday.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter; dayCellModelHollyday.Border = DefaultBorder; dayCellModelHollydayLeft.ForeColor = HollydayForeColor; dayCellModelHollydayLeft.BackColor = BackColor; dayCellModelHollydayLeft.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter; dayCellModelHollydayLeft.Border = DefaultBorder3; dayCellModelHollydayWeekend.ForeColor = HollydayForeColor; dayCellModelHollydayWeekend.BackColor = WeekendBackColor; dayCellModelHollydayWeekend.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter; dayCellModelHollydayWeekend.Border = DefaultBorder; dayCellModelOut.ForeColor = OutForeColor; dayCellModelOut.BackColor = BackColor; dayCellModelOut.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter; dayCellModelOut.Border = DefaultBorder; dayCellModelOutLeft.ForeColor = OutForeColor; dayCellModelOutLeft.BackColor = BackColor; dayCellModelOutLeft.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter; dayCellModelOutLeft.Border = DefaultBorder3; dayCellModelOutWeekend.ForeColor = OutForeColor; dayCellModelOutWeekend.BackColor = WeekendBackColor; dayCellModelOutWeekend.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter; dayCellModelOutWeekend.Border = DefaultBorder; }
static bool IsDoubleLine(BorderLine line) { return(BorderLineLayoutEngine.IsDoubleLine(line)); }
BorderLine GetBorderLine(int rIndex, int cIndex, int row, int column, Borders borderIndex) { if ((row == -1) && (borderIndex != Borders.BOTTOM)) { return(null); } if ((column == -1) && (borderIndex != Borders.RIGHT)) { return(null); } ulong num = ConverIndexToKey(rIndex, cIndex, row, column, borderIndex); BorderLine noBorder; if ((borderIndex == Borders.LEFT) || (borderIndex == Borders.RIGHT)) { if (_vBorderLineCache.TryGetValue(num, out noBorder)) { return(noBorder); } } else if (_hBorderLineCache.TryGetValue(num, out noBorder)) { return(noBorder); } bool isInCellflow = false; noBorder = GetCellActualBorderLine(row, column, borderIndex, out isInCellflow); if (!isInCellflow) { BorderLine line2 = null; Borders borders = (Borders)(((int)borderIndex + 2) % 4); if (borderIndex == Borders.LEFT) { line2 = GetCellActualBorderLine(row, PreviousColumn(cIndex), borders, out isInCellflow); } else if (borderIndex == Borders.TOP) { line2 = GetCellActualBorderLine(PreviousRow(rIndex), column, borders, out isInCellflow); } else if (borderIndex == Borders.RIGHT) { line2 = GetCellActualBorderLine(row, NextColumn(cIndex), borders, out isInCellflow); } else { line2 = GetCellActualBorderLine(NextRow(rIndex), column, borders, out isInCellflow); } if (!IsDoubleLine(noBorder) && IsDoubleLine(line2)) { noBorder = line2; } else if ((!IsDoubleLine(noBorder) || IsDoubleLine(line2)) && (line2 > noBorder)) { noBorder = line2; } } if (noBorder == null) { noBorder = BorderLine.NoBorder; } if ((borderIndex == Borders.LEFT) || (borderIndex == Borders.RIGHT)) { _vBorderLineCache.Add(num, noBorder); } else { _hBorderLineCache.Add(num, noBorder); } return(noBorder); }
void BuildBordersInternal(ref int rIndex, ref int cIndex, int row, int column, int lineDirection, ref LineItem previousLineItem, ref BorderLine previousLine, ref BorderLine previousBreaker1, ref BorderLine previousBreaker2) { if ((row == -1) && (lineDirection == 1)) { // 垂直线 previousBreaker1 = GetBorderLine(rIndex, cIndex, 0, column, Borders.TOP); previousBreaker2 = GetBorderLine(rIndex, cIndex, 0, NextColumn(cIndex), Borders.TOP); } else if ((column != -1) || (lineDirection != 0)) { BorderLine line; if (column == -1) { line = GetBorderLine(rIndex, cIndex, row, 0, Borders.LEFT); } else if (row == -1) { line = GetBorderLine(rIndex, cIndex, 0, column, Borders.TOP); } else { Borders borderIndex = (lineDirection == 0) ? Borders.BOTTOM : Borders.RIGHT; line = GetBorderLine(rIndex, cIndex, row, column, borderIndex); } bool flag = !BorderLineLayoutEngine.IsDoubleLine(line) && object.Equals(line, previousLine); if (flag) { flag = BorderLine.Max(previousBreaker1, previousBreaker2) < line || BorderLine.Max(previousBreaker1, previousBreaker2) == line; } if (flag && (IsDoubleLine(previousBreaker1) || IsDoubleLine(previousBreaker2))) { flag = false; } LineItem item; if (flag) { // 等同上一线 item = previousLineItem; switch (lineDirection) { case 0: previousLineItem.ColumnEnd = column; break; case 1: previousLineItem.RowEnd = row; break; } } else { item = new LineItem { Direction = lineDirection, RowFrom = row, RowEnd = row, ColumnFrom = column, ColumnEnd = column, Line = line, PreviousLine = previousLine, PreviousBreaker1 = previousBreaker1, PreviousBreaker2 = previousBreaker2 }; if (((item.Line != BorderLine.Empty) && (item.Line != BorderLine.NoBorder)) && (!item.IsGridLine || (line.Color.A != 0))) { ((IThemeContextSupport)line).SetContext(_owner.Excel.ActiveSheet); CreateLine(item); ((IThemeContextSupport)line).SetContext(null); } } switch (lineDirection) { case 0: if (row != -1) { item.NextLine = GetBorderLine(rIndex, cIndex, row, NextColumn(cIndex), Borders.BOTTOM); item.NextBreaker1 = GetBorderLine(rIndex, cIndex, row, column, Borders.RIGHT); item.NextBreaker2 = GetBorderLine(rIndex, cIndex, NextRow(rIndex), column, Borders.RIGHT); break; } item.NextLine = GetBorderLine(rIndex, cIndex, 0, NextColumn(cIndex), Borders.TOP); item.NextBreaker1 = _gridLine; item.NextBreaker2 = GetBorderLine(rIndex, cIndex, 0, column, Borders.RIGHT); break; case 1: if (column != -1) { item.NextLine = GetBorderLine(rIndex, cIndex, NextRow(rIndex), column, Borders.RIGHT); item.NextBreaker1 = GetBorderLine(rIndex, cIndex, row, column, Borders.BOTTOM); item.NextBreaker2 = GetBorderLine(rIndex, cIndex, row, NextColumn(cIndex), Borders.BOTTOM); break; } item.NextLine = GetBorderLine(rIndex, cIndex, NextRow(rIndex), column, Borders.LEFT); item.NextBreaker1 = _gridLine; item.NextBreaker2 = GetBorderLine(rIndex, cIndex, row, 0, Borders.BOTTOM); break; } ulong num = (ulong)row; num = num << 0x20; num |= (uint)column; Rect empty; if (!_cellBoundsCache.TryGetValue(num, out empty)) { empty = GetCellBounds(row, column); _cellBoundsCache.Add(num, empty); } item.Bounds.Add(empty); previousLine = line; previousLineItem = item; previousBreaker1 = item.NextBreaker1; previousBreaker2 = item.NextBreaker2; } }