PowerTools CalendarGrid for Windows Forms 1.0J
ボタンのキャプションを設定する

複数行のキャプション

既定ではButton型セルのキャプションはボタンのサイズに応じて自動的に複数行にワードラップ表示されます。サイズにかかわらず常に複数行表示にするには、CalendarButtonCellType.MultiLineプロパティをTrueに設定し、改行したい位置に改行コードを追加します。

Imports GrapeCity.Win.CalendarGrid

Dim today As DateTime = DateTime.Today
Dim template As CalendarTemplate = GcCalendarGrid1.Template
template.RowHeader.ColumnCount = 1
Dim buttonCellType As New CalendarButtonCellType()
buttonCellType.Multiline = True
buttonCellType.WordWrap = True
GcCalendarGrid1.Content(today).Rows(1).Cells(0).Value = "複数行の" & Environment.NewLine & "キャプション"
GcCalendarGrid1.Content(today).Rows(1).Cells(0).CellType = buttonCellType.Clone()
GcCalendarGrid1.Content(today).Rows(1).Cells(0).CellStyle.Alignment = CalendarGridContentAlignment.MiddleCenter
GcCalendarGrid1.LayoutSettings.SetVerticalLength(18, 70)
GcCalendarGrid1.ScrollIntoView(today)
using GrapeCity.Win.CalendarGrid;

var today = DateTime.Today;
CalendarTemplate template = gcCalendarGrid1.Template;
template.RowHeader.ColumnCount = 1;
var buttonCellType = new CalendarButtonCellType();
buttonCellType.Multiline = true;
buttonCellType.WordWrap = true;
gcCalendarGrid1.Content[today].Rows[1].Cells[0].Value = "複数行の" + Environment.NewLine + "キャプション";
gcCalendarGrid1.Content[today].Rows[1].Cells[0].CellType = buttonCellType.Clone();
gcCalendarGrid1.Content[today].Rows[1].Cells[0].CellStyle.Alignment = CalendarGridContentAlignment.MiddleCenter;
gcCalendarGrid1.LayoutSettings.SetVerticalLength(18, 70);
gcCalendarGrid1.ScrollIntoView(today);


キャプションの省略表示

Button型セルに表示しきれない長いキャプションの一部を省略記号で代替表示するには、ButtonCellType.Ellipsisプロパティを使用します。また、EllipsisStringプロパティで代替表示する省略記号を設定できます。

Imports GrapeCity.Win.CalendarGrid

Dim today As DateTime = DateTime.Today
Dim buttonCellType As New CalendarButtonCellType()
buttonCellType.Ellipsis = CalendarGridEllipsisMode.EllipsisEnd
buttonCellType.EllipsisString = "..."
gcCalendarGrid1.Content(today).Rows(1).Cells(0).Value = "長い長い長い文字列"
gcCalendarGrid1.Content(today).Rows(1).Cells(0).CellType = buttonCellType.Clone()
gcCalendarGrid1.ScrollIntoView(today)
using GrapeCity.Win.CalendarGrid;

var today = DateTime.Today;
var buttonCellType = new CalendarButtonCellType();
buttonCellType.Ellipsis = CalendarGridEllipsisMode.EllipsisEnd;
buttonCellType.EllipsisString = "...";
gcCalendarGrid1.Content[today].Rows[1].Cells[0].Value = "長い長い長い文字列";
gcCalendarGrid1.Content[today].Rows[1].Cells[0].CellType = buttonCellType.Clone();
gcCalendarGrid1.ScrollIntoView(today);


アクセスキーの接頭文字

Button型セルのValueプロパティに含まれるアンパサンド文字(&)をアクセスキーの接頭文字として表示できます。アンパサンド文字をアクセスキーの接頭文字として表示するには、ButtonCellType.UseMnemonicプロパティをTrueに設定します。

Imports GrapeCity.Win.CalendarGrid

Dim today As DateTime = DateTime.Today
Dim buttonCellType As New CalendarButtonCellType()
buttonCellType.UseMnemonic = True

GcCalendarGrid1.Content(today).Rows(1).Cells(0).Value = "削除(&D)"
GcCalendarGrid1.Content(today).Rows(1).Cells(0).CellType = buttonCellType.Clone()
GcCalendarGrid1.ScrollIntoView(today)
using GrapeCity.Win.CalendarGrid;

var today = DateTime.Today;
var buttonCellType = new CalendarButtonCellType();
buttonCellType.UseMnemonic = true;

gcCalendarGrid1.Content[today].Rows[1].Cells[0].Value = "削除(&D)";
gcCalendarGrid1.Content[today].Rows[1].Cells[0].CellType = buttonCellType.Clone();
gcCalendarGrid1.ScrollIntoView(today);


参照

 

 


© 2014 GrapeCity inc. All rights reserved.