1、环境准备
1、获取天气信息地址http://webservice.webxml.com.cn/WebServices/WeatherWS.asmx并返回一个长度为32的数组
2、将天气图片全部下载并放到debug根文件下
3、在项目中添加一个webservice服务
2、源代码块
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace MyOffice
{
public partial class frmWeather : Form
{
public frmWeather()
{
InitializeComponent();
}
/// <summary>
/// 根据城市名字查询天气情况
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnSeach_Click(object sender, EventArgs e)
{

本文介绍了如何使用C#来实现一个Windows Form应用程序,展示天气预报。首先,需要获取来自http://webservice.webxml.com.cn的天气信息数据,并下载相关天气图片。接着,在项目中添加Web Service引用,然后编写源代码以展示天气信息。最后,展示了Windowform运行的最终效果。
最低0.47元/天 解锁文章
506

被折叠的 条评论
为什么被折叠?



