このトピックでは、C1OutBar コントロールのページのタイトル領域をカスタマイズする方法を学びます。3つの C1OutPage を含む C1OutBar を作成し、いくつかのプロパティを設定して、各タイトルにカスタム色をペイントするコードをプロジェクトに追加します。
以下の手順を実行します。
Visual Basic コードの書き方
| Visual Basic |
コードのコピー
|
|---|---|
Imports C1.Win.C1Command |
|
C# コードの書き方
| C# |
コードのコピー
|
|---|---|
using C1.Win.C1Command |
|
Visual Basic コードの書き方
| Visual Basic |
コードのコピー
|
|---|---|
‘e.page パラメータはページを判定します。
IIf e.Page Is c1OutPage1 Then
e.Graphics.FillRectangle(Brushes.Gold, e.Bounds)
e.Graphics.DrawString("I", c1OutBar1.Font, Brushes.Black, New PointF(e.Bounds.Right - 40, e.Bounds.Top + 2))
ElseIf e.Page Is c1OutPage2 Then
e.Graphics.FillRectangle(Brushes.Silver, e.Bounds)
e.Graphics.DrawString("II", c1OutBar1.Font, Brushes.White, New PointF(e.Bounds.Right - 40, e.Bounds.Top + 2))
ElseIf e.Page Is c1OutPage3 Then
e.Graphics.FillRectangle(Brushes.Plum, e.Bounds)
e.Graphics.DrawString("III", c1OutBar1.Font, Brushes.Yellow, New PointF(e.Bounds.Right - 40, e.Bounds.Top + 2))
End If
|
|
C# コードの書き方
| C# |
コードのコピー
|
|---|---|
//e.page パラメータはページを判定します。
If (e.Page == c1OutPage1)
{
e.Graphics.FillRectangle(Brushes.Gold, e.Bounds)
e.Graphics.DrawString("I", c1OutBar1.Font, Brushes.Black, new PointF(e.Bounds.Right - 40, e.Bounds.Top + 2))
}
else if (e.Page == c1OutPage2)
{
e.Graphics.FillRectangle(Brushes.Silver, e.Bounds)
e.Graphics.DrawString("II", c1OutBar1.Font, Brushes.White, new PointF(e.Bounds.Right -40, e.Bounds.Top + 2))
}
else if (e.Page == c1OutPage3)
{
e.Graphics.FillRectangle(Brushes.Plum, e.Bounds)
.Graphics.DrawString("III", c1OutBar1.Font, Brushes.Yellow, new PointF(e.Bounds.Right - 40, e.Bounds.Top + 2))
}
|
|
