private void toolStripButton15_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 (sheet.SelectionCount == 0) { borderedit.StartColumn = sheet.ActiveColumnIndex; borderedit.ColumnCount = 1; borderedit.StartRow = sheet.ActiveRowIndex; borderedit.RowCount = 1; } else { CellRange range = sheet.GetSelection(0); //选中区域 if (range != null) { borderedit.StartColumn = range.Column; borderedit.ColumnCount = range.ColumnCount; borderedit.StartRow = range.Row; borderedit.RowCount = range.RowCount; } } borderedit.ShowDialog(); } btn_save.Enabled = true; }
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; } } } } } }
void borderedit_Shown(object sender, EventArgs e) { FarPoint.Win.Spread.Design.BorderEditor borderedit = sender as FarPoint.Win.Spread.Design.BorderEditor; GroupBox groupBox = (borderedit.Controls["BorderLineGroupBox"] as GroupBox); ListView lineList = groupBox.Controls["ListView_Style"] as ListView; lineList.Items[6].Selected = true; }
public static void LocalizationCHS(FarPoint.Win.Spread.Design.BorderEditor borderedit) { borderedit.Text = "边框设置"; borderedit.Width = 280; foreach (Control control in borderedit.Controls) { if (control is Button) { Button btn = control as Button; switch (btn.Text) { case "Help": borderedit.Controls.Remove(control); break; case "Ok": btn.Size = new Size(80, 25); btn.Location = new Point(btn.Location.X - 120, btn.Location.Y); btn.Text = "确定"; break; case "Cancel": btn.Size = new Size(80, 25); btn.Location = new Point(btn.Location.X - 120, btn.Location.Y); btn.Text = "取消"; break; } } if (control is Label) { Label label = control as Label; switch (label.Text) { case "Inside": label.Text = "内边框"; break; case "Outline": label.Text = "外边框"; break; case "None": label.Text = "取消边框"; break; case "Border": label.Text = "边框设计"; break; case "Presets": label.Text = "预置边框"; break; } } } }