private void tool_borderSet_Click(object sender, EventArgs e) { using (FarPoint.Win.Spread.Design.BorderEditor borderedit = new FarPoint.Win.Spread.Design.BorderEditor(fpSpread1)) { borderedit.Shown += new EventHandler(borderedit_Shown); DesignHelper.LocalizationCHS(borderedit); if (borderedit.ShowDialog() == DialogResult.OK) { Cell cell = DesignHelper.GetSelectedCell(sheet); if (cell != null) { List <CellStruct> list = DesignHelper.GetListCellStruct(cell, dt); foreach (CellStruct cellStruct in list) { if (cell.Border == null) { cellStruct.DrawInfo.BoundaryLine.SetNoBoundary(); } else { cellStruct.DrawInfo.BoundaryLine.UpperBoundaryLine = cell.Border.Inset.Top == 1; cellStruct.DrawInfo.BoundaryLine.LowerBoundaryLine = cell.Border.Inset.Bottom == 1; cellStruct.DrawInfo.BoundaryLine.LeftBoundaryLine = cell.Border.Inset.Left == 1; cellStruct.DrawInfo.BoundaryLine.RightBooundaryLine = cell.Border.Inset.Right == 1; } } } } } }
private void 对齐ToolStripMenuItem_Click(object sender, EventArgs e) { Cell cell = DesignHelper.GetSelectedCell(sheet); if (cell != null) { cell.VerticalAlignment = CellVerticalAlignment.Bottom; btn_save.Enabled = true; } }
private void 右对齐ToolStripMenuItem_Click(object sender, EventArgs e) { Cell cell = DesignHelper.GetSelectedCell(sheet); if (cell != null) { cell.HorizontalAlignment = CellHorizontalAlignment.Right; btn_save.Enabled = true; } }
//字体设置 private void FontSet(object sender, EventArgs e) { using (FontDialog f = new FontDialog()) { if (f.ShowDialog() == DialogResult.OK) { Cell cell = DesignHelper.GetSelectedCell(sheet); if (cell != null) { cell.Font = f.Font; btn_save.Enabled = true; } } } }
private void 对齐ToolStripMenuItem_Click(object sender, EventArgs e) { Cell cell = DesignHelper.GetSelectedCell(sheet); if (cell != null) { List <CellStruct> list = DesignHelper.GetListCellStruct(cell, dt); cell.VerticalAlignment = CellVerticalAlignment.Bottom; foreach (CellStruct cellStruct in list) { cellStruct.DrawInfo.Format.Alignment = DesignHelper.ConvertVAlignmentToStringAlignment(CellVerticalAlignment.Bottom); } tool_Save.Enabled = true; } }
private void 右对齐ToolStripMenuItem_Click(object sender, EventArgs e) { Cell cell = DesignHelper.GetSelectedCell(sheet); if (cell != null) { List <CellStruct> list = DesignHelper.GetListCellStruct(cell, dt); cell.HorizontalAlignment = CellHorizontalAlignment.Right; foreach (CellStruct cellStruct in list) { cellStruct.DrawInfo.Format.LineAlignment = DesignHelper.ConvertHAlignmentToStringAlignment(CellHorizontalAlignment.Right); } tool_Save.Enabled = true; } }
private void tool_cancelBorder_Click(object sender, EventArgs e) { Cell cell = DesignHelper.GetSelectedCell(sheet); if (cell != null) { FarPoint.Win.BevelBorder border = new FarPoint.Win.BevelBorder(FarPoint.Win.BevelBorderType.Raised, Color.Black, Color.Black, 1, false, false, false, false); cell.Border = border; List <CellStruct> list = DesignHelper.GetListCellStruct(cell, dt); foreach (CellStruct cellStruct in list) { cellStruct.DrawInfo.BoundaryLine.SetNoBoundary(); } tool_Save.Enabled = true; } }
protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { if (keyData == Keys.Delete) { Cell cell = DesignHelper.GetSelectedCell(sheet); if (cell != null) { cell.Text = ""; List <CellStruct> list = DesignHelper.GetListCellStruct(cell, dt); foreach (CellStruct cellStruct in list) { cellStruct.Context = ""; } tool_Save.Enabled = true; } } return(base.ProcessCmdKey(ref msg, keyData)); }
private void tool_FontSet_Click(object sender, EventArgs e) { using (FontDialog f = new FontDialog()) { if (f.ShowDialog() == DialogResult.OK) { Cell cell = DesignHelper.GetSelectedCell(sheet); if (cell != null) { List <CellStruct> list = DesignHelper.GetListCellStruct(cell, dt); foreach (CellStruct cellStruct in list) { cellStruct.DrawInfo.Font = f.Font; } cell.Font = f.Font; tool_Save.Enabled = true; } } } }
private void toolStripButton17_Click(object sender, EventArgs e) { Cell cell = DesignHelper.GetSelectedCell(sheet); if (cell != null) { if (cell.Font == null) { cell.Font = new Font("宋体", 9); } if (cell.Font.Underline) { cell.Font = new Font(cell.Font.FontFamily, cell.Font.Size, cell.Font.Style ^ FontStyle.Underline); } else { cell.Font = new Font(cell.Font.FontFamily, cell.Font.Size, cell.Font.Style | FontStyle.Underline); } btn_save.Enabled = true; } }