作成日: 2022/01/21 最終更新日: 2022/02/24
文書種別
使用方法
詳細
SPREADの幅に合わせて特定の列幅を調節する専用の機能は備えられていませんが、変数に初期値を保存しておき、サイズ変更後に差を調節することで、特定の列だけサイズを拡大することが可能です。
◎サンプルコード(VB)
◎サンプルコード(C#)
◎サンプルコード(VB)
Public Class Form1
Private initSpreadWidth As Integer
Private initColWidth As Integer
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
' 列数の設定
FpSpread1.ActiveSheet.ColumnCount = 4
' SPREADの幅の保存
initSpreadWidth = FpSpread1.Width
' 第2列の幅の保存
initColWidth = FpSpread1.ActiveSheet.GetColumnWidth(1)
End Sub
Private Sub FpSpread1_Resize(sender As Object, e As EventArgs) Handles FpSpread1.Resize
' 第2列の幅の調節
FpSpread1.ActiveSheet.SetColumnWidth(1, initColWidth + FpSpread1.Width - initSpreadWidth)
End Sub
End Class
Private initSpreadWidth As Integer
Private initColWidth As Integer
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
' 列数の設定
FpSpread1.ActiveSheet.ColumnCount = 4
' SPREADの幅の保存
initSpreadWidth = FpSpread1.Width
' 第2列の幅の保存
initColWidth = FpSpread1.ActiveSheet.GetColumnWidth(1)
End Sub
Private Sub FpSpread1_Resize(sender As Object, e As EventArgs) Handles FpSpread1.Resize
' 第2列の幅の調節
FpSpread1.ActiveSheet.SetColumnWidth(1, initColWidth + FpSpread1.Width - initSpreadWidth)
End Sub
End Class
◎サンプルコード(C#)
public Form1()
{
InitializeComponent();
fpSpread1.Resize += fpSpread1_Resize;
}
int initSpreadWidth;
int initColWidth;
private void Form1_Load(object sender, EventArgs e)
{
// 列数の設定
fpSpread1.ActiveSheet.RowCount = 4;
// SPREADの幅の保存
initSpreadWidth = fpSpread1.Width;
// 第2列の幅の保存
initColWidth = fpSpread1.ActiveSheet.GetColumnWidth(1);
}
private void fpSpread1_Resize(object sender, EventArgs e)
{
// 第2列の幅の調節
fpSpread1.ActiveSheet.SetColumnWidth(1, initColWidth + fpSpread1.Width - initSpreadWidth);
}
{
InitializeComponent();
fpSpread1.Resize += fpSpread1_Resize;
}
int initSpreadWidth;
int initColWidth;
private void Form1_Load(object sender, EventArgs e)
{
// 列数の設定
fpSpread1.ActiveSheet.RowCount = 4;
// SPREADの幅の保存
initSpreadWidth = fpSpread1.Width;
// 第2列の幅の保存
initColWidth = fpSpread1.ActiveSheet.GetColumnWidth(1);
}
private void fpSpread1_Resize(object sender, EventArgs e)
{
// 第2列の幅の調節
fpSpread1.ActiveSheet.SetColumnWidth(1, initColWidth + fpSpread1.Width - initSpreadWidth);
}