Form.PageCount プロパティ
フォームの改ページ位置の自動修正後にフォーム内のページ数を返します。
名前空間: System.Web.UI.MobileControls
アセンブリ: System.Web.Mobile (system.web.mobile.dll 内)
構文

Form コントロールは、現在のフォームの改ページ位置自動修正の方法に関する情報を提供する PageCount プロパティと CurrentPage プロパティを公開します。PageCount プロパティは、他のページへの移動機能を提供するのにも役立ちます。たとえば、機能の豊富なデバイスをレンダリングのターゲットにする場合は、ユーザーがリンクの代わりに番号を使ってページの結果を参照できるようにするために、デバイス固有の UI 要素を検索結果のフォームに含めることがあります。
![]() |
---|
この値は、Paginated イベントの発生後に取得可能になります。PageCount プロパティは、フォームの Paginated イベントを処理することで取得できます。 |

Form コントロールの PageCount プロパティの使用方法を次のコード例に示します。このコード例は、ControlToPaginate プロパティのトピックで取り上げているコード例の一部です。
Private Sub Form_Paginated(ByVal sender As Object, _ ByVal e As EventArgs) ' Set the background color based on ' the number of pages If ActiveForm.PageCount > 1 Then ActiveForm.BackColor = Color.LightBlue Else ActiveForm.BackColor = Color.LightGray End If ' Check to see if the Footer template has been chosen If DevSpec.HasTemplates Then Dim lbl As System.Web.UI.MobileControls.Label ' Get the Footer panel Dim pan As System.Web.UI.MobileControls.Panel = Form1.Footer ' Get the Label from the panel lbl = CType(pan.FindControl("lblCount"), System.Web.UI.MobileControls.Label) ' Set the text in the Label lbl.Text = "Page #" + Form1.CurrentPage.ToString() End If End Sub
void Form_Paginated(object sender, EventArgs e) { // Set the background color based on // the number of pages if (ActiveForm.PageCount > 1) ActiveForm.BackColor = Color.LightBlue; else ActiveForm.BackColor = Color.LightGray; // Check to see if the Footer template has been chosen if (DevSpec.HasTemplates) { System.Web.UI.MobileControls.Label lbl = null; // Get the Footer panel System.Web.UI.MobileControls.Panel pan = Form1.Footer; // Get the Label from the panel lbl = (System.Web.UI.MobileControls.Label)pan.FindControl("lblCount"); // Set the text in the Label lbl.Text = "Page #" + Form1.CurrentPage.ToString(); } }

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- Form.PageCount プロパティのページへのリンク