91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

C#調用WebService制作天氣預報

發布時間:2020-06-28 15:47:24 來源:網絡 閱讀:320 作者:huangchaosuper 欄目:編程語言

 添加Web引用:http://www.webxml.com.cn/WebServices/WeatherWebService.asmx

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace 天氣助手
{
    public partial class Weather : Form
    {
        public Weather()
        {
            InitializeComponent();
        }

        public string[] GetWeather(string xCity)
        {
            cn.com.webxml.www.WeatherWebService mWeatherWebService = new cn.com.webxml.www.WeatherWebService();
            string[] WeatherOfCity = mWeatherWebService.getWeatherbyCityName(xCity);
            return WeatherOfCity;
        }

        private void Weather_Load(object sender, EventArgs e)
        {


        }

        public void Weather_Shown(object sender, EventArgs e)
        {
            try
            {
                cn.com.webxml.www.WeatherWebService mWeatherWebService = new cn.com.webxml.www.WeatherWebService();
                string[] mArea = mWeatherWebService.getSupportProvince();

                int mCount = mArea.Length - 1;

                comboBox01.Items.Clear();
                for (int mI = 0; mI <= mCount; mI++)
                {
                    comboBox01.Items.Add(mArea[mI].ToString());

                }
                comboBox01.SelectedIndex = 0;

                               
            }
            catch
            {

            }
        }

        public void comboBox01_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                cn.com.webxml.www.WeatherWebService mWeatherWebService = new cn.com.webxml.www.WeatherWebService();
                string[] mCity = mWeatherWebService.getSupportCity(comboBox01.Text);

                int mCount = mCity.Length - 1;

                comboBox02.Items.Clear();
                for (int mI = 0; mI <= mCount; mI++)
                {
                    comboBox02.Items.Add(mCity[mI].Remove(mCity[mI].IndexOf("(")));

                }
                comboBox02.SelectedIndex = 0;
            }
            catch
            {

            }

        }

        public void comboBox02_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                string[] WeatherOfCity = GetWeather(comboBox02.Items[comboBox02.SelectedIndex].ToString());

                label03.Text = WeatherOfCity[0].ToString();
                label05.Text = WeatherOfCity[1].ToString();

                label06.Text = WeatherOfCity[10].ToString();

                //今天
                pictureBox01.ImageLocation = @"p_w_picpaths/weather/" + WeatherOfCity[8].ToString();
                pictureBox02.ImageLocation = @"p_w_picpaths/weather/" + WeatherOfCity[9].ToString();
                label07.Text = WeatherOfCity[6].ToString() + WeatherOfCity[5].ToString() + WeatherOfCity[7].ToString();
                label08.Text = WeatherOfCity[11].ToString();               

                //明天
                pictureBox03.ImageLocation = @"p_w_picpaths/weather/" + WeatherOfCity[15].ToString();
                pictureBox04.ImageLocation = @"p_w_picpaths/weather/" + WeatherOfCity[16].ToString();
                label16.Text = WeatherOfCity[13].ToString() + WeatherOfCity[12].ToString() + WeatherOfCity[14].ToString();

                //后天
                pictureBox05.ImageLocation = @"p_w_picpaths/weather/" + WeatherOfCity[20].ToString();
                pictureBox06.ImageLocation = @"p_w_picpaths/weather/" + WeatherOfCity[21].ToString();
                label17.Text = WeatherOfCity[18].ToString() + WeatherOfCity[17].ToString() + WeatherOfCity[19].ToString();

                //城市說明及圖片
                pictureBox07.ImageLocation = @"http://www.cma.gov.cn/tqyb/img/city/" + WeatherOfCity[3].ToString();                
                label18.Text = WeatherOfCity[22].ToString();

                //預計時間
                label19.Text = "預報時間:" + WeatherOfCity[4].ToString();

            }
            catch
            {

            }
        }

    }
}

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

武威市| 垣曲县| 许昌市| 定兴县| 长汀县| 安图县| 伊通| 浦北县| 溧阳市| 临泽县| 平顶山市| 红河县| 石首市| 日喀则市| 十堰市| 循化| 巴青县| 廊坊市| 抚州市| 黑水县| 旅游| 宁夏| 安福县| 张家界市| 大厂| 同仁县| 安平县| 永年县| 西城区| 会同县| 鲁山县| 陈巴尔虎旗| 沁阳市| 电白县| 建瓯市| 栖霞市| 门源| 安阳市| 昌乐县| 奉新县| 蚌埠市|