次の方法で共有


HtmlInputImage コンストラクタ

HtmlInputImage クラスの新しいインスタンスを初期化します。

Public Sub New()
[C#]
public HtmlInputImage();
[C++]
public: HtmlInputImage();
[JScript]
public function HtmlInputImage();

解説

このコンストラクタを使用して、 HtmlInputImage クラスのインスタンスを作成し、初期化します。

HtmlInputImage のインスタンスの初期プロパティ値を次の表に示します。

プロパティ 初期値
TagName "image" リテラル文字列。

使用例

 
<%@ Page Language="VB" AutoEventWireup="True" %>

<html>
   <script runat="server" >
  
      Sub Page_Load(sender As Object, e As EventArgs)

         ' Create an HtmlInputImage control.
         Dim image As HtmlInputImage = New HtmlInputImage()
         image.Src = "image.jpg"
         image.Alt = "Alternate text for image."
 
         ' Add the control to the Controls collection of the 
         ' PlaceHolder control.
         Place.Controls.Clear()
         Place.Controls.Add(image)
         
      End Sub
  
   </script>
  
<body>

   <form runat="server">
  
      <h3> HtmlInputImage Constructor Example </h3> 
  
      <asp:PlaceHolder id="Place" runat="server"/>
  
   </form>

</body>
</html>
 

[C#] 
<%@ Page Language="C#" AutoEventWireup="True" %>

<html>
   <script runat="server" >
  
      void Page_Load(Object sender, EventArgs e)
      {

         // Create an HtmlInputImage control.
         HtmlInputImage image = new HtmlInputImage();
         image.Src = "image.jpg";
         image.Alt = "Alternate text for image."; 
 
         // Add the control to the Controls collection of the 
         // PlaceHolder control.
         Place.Controls.Clear();
         Place.Controls.Add(image);
         
      }
  
   </script>
  
<body>

   <form runat="server">
  
      <h3> HtmlInputImage Constructor Example </h3> 
  
      <asp:PlaceHolder id="Place" runat="server"/>
  
   </form>

</body>
</html>
 

[C++, JScript] C++ および JScript のサンプルはありません。Visual Basic および C# のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

HtmlInputImage クラス | HtmlInputImage メンバ | System.Web.UI.HtmlControls 名前空間