chen0516 님, 안녕하세요.
메시어스입니다.
하기 샘플 코드와 같이 UseVisualStyleBackColor 속성을 false로 설정하고 BackColor 속성을 Blue로 설정하면, 아래 이미지에서 보이는 것처럼 버튼 셀의 배경이 파란색으로 보여집니다.
Dim btncelltype As New FarPoint.Win.Spread.CellType.ButtonCellType
btncelltype.ButtonColor = Color.Blue
btncelltype.DarkColor = Color.Blue
btncelltype.LightColor = Color.Blue
btncelltype.TextColor = Color.White
btncelltype.ShadowSize = 0
btncelltype.Text = "Button"
btncelltype.UseVisualStyleBackColor = False
- Spread.NET WinForms V13 | ButtonColor Property (ButtonCellType)
또한 버튼 셀 유형의 일부 그래픽 요소는 XP 테마(비주얼 스타일, Visual Style)의 영향을 받습니다. FpSpread의 VisualStyles 속성을 "off"로 설정하면 다음과 같이 보여집니다.
fpSpread1.VisualStyles = FarPoint.Win.VisualStyles.On
Dim btncelltype As New FarPoint.Win.Spread.CellType.ButtonCellType
btncelltype.ButtonColor = Color.Blue
btncelltype.DarkColor = Color.Blue
btncelltype.TextColor = Color.White
btncelltype.ShadowSize = 0
btncelltype.Text = "Button"
FpSpread의 VisualStyle을 Off로 설정하는 대신, PaintCell 및 GetEditorControl 메서드를 재정의한 다음 Appearance 개체의 VisualStyles 속성을 OFF로 설정하는 사용자 정의 버튼 셀 유형을 만들어 사용할 수 있습니다. 하기 샘플 코드를 참고 바랍니다. 샘플은 C#으로 작성되었습니다.
private void Form1_Load(object sender, EventArgs e)
{
FlatButtonCellType btncelltype = new FlatButtonCellType();
btncelltype.ButtonColor = Color.Blue;
btncelltype.DarkColor = Color.Blue;
btncelltype.LightColor = Color.Blue;
btncelltype.ShadowSize = 0;
btncelltype.TextColor = Color.White;
btncelltype.Text = "Button";
fpSpread1.ActiveSheet.Cells[1, 1].CellType = btncelltype;
}
public class FlatButtonCellType : FarPoint.Win.Spread.CellType.ButtonCellType
{
public override void PaintCell(Graphics g, Rectangle r, FarPoint.Win.Spread.Appearance appearance, object value, bool isSelected, bool isLocked, float zoomFactor)
{
appearance.VisualStyles = FarPoint.Win.VisualStyles.Off;
base.PaintCell(g, r, appearance, value, isSelected, isLocked, zoomFactor);
}
public override Control GetEditorControl(FarPoint.Win.Spread.Appearance appearance, float zoomFactor)
{
appearance.VisualStyles = FarPoint.Win.VisualStyles.Off;
return base.GetEditorControl(appearance, zoomFactor);
}
public override Control GetEditorControl(Control control, FarPoint.Win.Spread.Appearance appearance, float zoomFactor)
{
appearance.VisualStyles = FarPoint.Win.VisualStyles.Off;
return base.GetEditorControl(appearance, zoomFactor);
}
}
자세한 내용은 아래 링크된 도움말 문서에서 확인하실 수 있습니다.
- Spread.NET WinForms V13 | Using XP Themes with the Component
답변이 도움이 되었다면, 우측 상단의 "채택" 버튼을 눌러 피드백을 남겨주시면 감사하겠습니다. 추가로 궁금하신 내용이 있을 경우 문의해 주시기 바랍니다.
감사합니다.
메시어스 드림