タイマーでテキストビューを変更するには、以下を実行します

Tile1 は次のような表示になるはずです。
Visual Basic コードの書き方
| Visual Basic |
コードのコピー
|
|---|---|
Public Partial Class Form1
Inherits Form
Private _tile1Flipped As Boolean
Public Sub New()
InitializeComponent()
End Sub
Private Sub timer1_Tick(sender As Object, e As EventArgs)
Dim a As Boolean = _tile1Flipped
tile1.Template = If(a, template1, template2)
_tile1Flipped = Not a
End Sub
End Class
|
|
C# コードの書き方
| C# |
コードのコピー
|
|---|---|
public partial class Form1 : Form
{
bool _tile1Flipped;
public Form1()
{
InitializeComponent();
}
private void timer1_Tick(object sender, EventArgs e)
{
bool a = _tile1Flipped;
tile1.Template = a ? template1 : template2;
_tile1Flipped = !a;
}
}
|
|

このトピックの作業結果タイルはタイマーに基づいてテンプレートを変更します。 タイルの1番目のテンプレートが数秒間表示された後、2番目のテンプレートが1番目の代わりに表示されます。