小 .因此为了适应接受设备的视觉效果 .我们在设计一个移动网站的时候要首先考虑到用户移动设备的显示分辨率问题 ,已达到最好的浏览效果 .
我们从左边的移动 Web窗体中拖放一个 Label控件和一个 Command控件和一个 Label控件放到右边的移动 Form中 .并且将 Label1的 Text属性改为 ”welcome to the Wap world”,将 Command1的 Text属性改为 ” Go to Form 2”. 将 Label1的 NavigateUrl属性改为 :http://wap.sina.com,并且将其 Text属性改为 :”Link to sina”.然后双击 Command1.进入到名为 MobileWebForm1.aspx.cs 的代码隐藏文件中 . 在其中加入黑体字 .
|
private void Command1_Click(object sender, System.EventArgs e)
{
ActiveForm = Form2;
} |
再从左边拖进一个 Form控件 .并且在其中添加一个 Label控件 .双击 Form2窗体 .进入后台代码 .在其中添加黑体字 :
|
private void Form2_Activate(object sender, System.EventArgs e)
{
Label2.Text="Hello World!";
} |
最后我们要注意将 Form1的 Method属性改为 :get,否则在 wap浏览器观看时会返回 HTTP 405 error (method not allowed) 这样的错误 .
完成以上操作之后我们来运行一下这个编好的网页 .按 F5键 .在 IE中得到了如下的输出结果 :

这个是 .aspx文件在 ie中的显示效果 . 在点选了按钮之后会跳到另一个界面 :

上一页 [1] [2] [3] [4] 下一页