Aspose.Cells.GridWeb.Examples.CSharp.Cells.FormatCells.btnApplyBorderStyles_Click C# (CSharp) 메소드

btnApplyBorderStyles_Click() 보호된 메소드

protected btnApplyBorderStyles_Click ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
리턴 void
        protected void btnApplyBorderStyles_Click(object sender, EventArgs e)
        {
            // ExStart:ApplyBorderStyles
            // Accessing the reference of the worksheet that is currently active and resize first row and column
            GridWorksheet sheet = GridWeb1.WorkSheets[GridWeb1.ActiveSheetIndex];
            sheet.Cells.Clear();
            sheet.Cells.SetColumnWidth(0, 50);
            sheet.Cells.SetRowHeight(0, 40);

            // Accessing a specific cell of the worksheet
            GridCell cell = sheet.Cells["A1"];

            var style = cell.Style;

            // Setting the border style, width and color
            style.BorderStyle = BorderStyle.Solid;
            style.BorderWidth = new Unit(2, UnitType.Pixel);
            style.BorderColor = Color.Blue;
            
            // Set the cell style
            cell.CopyStyle(style);
            // ExEnd:ApplyBorderStyles
        }