| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 327 人关注过本帖
标题:窗口文件求解
只看楼主 加入收藏
于红光521
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2012-10-11
结帖率:75%
收藏
已结贴  问题点数:2 回复次数:2 
窗口文件求解
using System;
using System.Collections.Generic;
using
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace constllationsearch
{
    public partial class Form1 : Form
    {//根据星座返回相应的星座特色,幸运色,幸运日,幸运地点,个性特征,优点,缺点
        public class search {

            public static string[] Constellation(string str) {
            string []Description=new string [8];
            if (str !=""){
                switch (str) {
                    case "摩羯座":
                        Description[0] = "现实,安全,平稳";
                        Description[1] = "暗绿色";
                        Description[2] = "6";
                        Description[3] = "星期三";
                        Description[4] = "远离嘈杂的地点";
                        Description[5] = "你思想谨慎,冷静让他准确的判断力,给人沉稳而严肃的印象";
                        Description[6] = "1,有实际的人生观;2,做事脚踏实地;3意志力强";
                        break;
                    case "狮子座":
                        Description[0] = "现实,安全,平稳";
                        Description[1] = "暗绿色";
                        Description[2] = "6";
                        Description[3] = "星期三";
                        Description[4] = "远离嘈杂的地点";
                        Description[5] = "你思想谨慎,冷静让他准确的判断力,给人沉稳而严肃的印象";
                        Description[6] = "1,有实际的人生观;2,做事脚踏实地;3意志力强";
                        break;
                    case "天秤座":
                        Description[0] = "现实,安全,平稳";
                        Description[1] = "暗绿色";
                        Description[2] = "6";
                        Description[3] = "星期三";
                        Description[4] = "远离嘈杂的地点";
                        Description[5] = "你思想谨慎,冷静让他准确的判断力,给人沉稳而严肃的印象";
                        Description[6] = "1,有实际的人生观;2,做事脚踏实地;3意志力强";
                        break;
                    case "巨蟹座":
                        Description[0] = "现实,安全,平稳";
                        Description[1] = "暗绿色";
                        Description[2] = "6";
                        Description[3] = "星期三";
                        Description[4] = "远离嘈杂的地点";
                        Description[5] = "你思想谨慎,冷静让他准确的判断力,给人沉稳而严肃的印象";
                        Description[6] = "1,有实际的人生观;2,做事脚踏实地;3意志力强";
                        break;
                    case "双子座":
                        Description[0] = "现实,安全,平稳";
                        Description[1] = "暗绿色";
                        Description[2] = "6";
                        Description[3] = "星期三";
                        Description[4] = "远离嘈杂的地点";
                        Description[5] = "你思想谨慎,冷静让他准确的判断力,给人沉稳而严肃的印象";
                        Description[6] = "1,有实际的人生观;2,做事脚踏实地;3意志力强";
                        break;
                    case "双鱼座":
                        Description[0] = "现实,安全,平稳";
                        Description[1] = "暗绿色";
                        Description[2] = "6";
                        Description[3] = "星期三";
                        Description[4] = "远离嘈杂的地点";
                        Description[5] = "你思想谨慎,冷静让他准确的判断力,给人沉稳而严肃的印象";
                        Description[6] = "1,有实际的人生观;2,做事脚踏实地;3意志力强";
                        break;
                    case "金牛座":
                        Description[0] = "现实,安全,平稳";
                        Description[1] = "暗绿色";
                        Description[2] = "6";
                        Description[3] = "星期三";
                        Description[4] = "远离嘈杂的地点";
                        Description[5] = "你思想谨慎,冷静让他准确的判断力,给人沉稳而严肃的印象";
                        Description[6] = "1,有实际的人生观;2,做事脚踏实地;3意志力强";
                        break;
                    case "射手座":
                        Description[0] = "现实,安全,平稳";
                        Description[1] = "暗绿色";
                        Description[2] = "6";
                        Description[3] = "星期三";
                        Description[4] = "远离嘈杂的地点";
                        Description[5] = "你思想谨慎,冷静让他准确的判断力,给人沉稳而严肃的印象";
                        Description[6] = "1,有实际的人生观;2,做事脚踏实地;3意志力强";
                        break;
                  

                        //其他星座的信息
                    default :
                        Description [0]="星座输入有误";
                        break ;
                }
            
            }
            return Description ;}
        
        }
/// <summary>
/// 根据生日查询所属星座
/// </summary>
/// <param name ="strBirthday">生日</param>
/// <returns></returns>
///
        public static string GetConstellation(DateTime strBirthday)
        {

            string strConstellation = null;
            float birthday = 0.00F;
            if (strBirthday.Month == 1 && strBirthday.Day < 20)
            {

                birthday = float.Parse(string.Format("13.{0}", strBirthday));
            }
            else
            {
                if (strBirthday.Day < 10)
                    birthday = float.Parse(string.Format("{0}.{1}", strBirthday.Month, strBirthday.Day));


            }

            float[] atomBoud = { 1.20F, 2.20F, 3.12F, 4.21F, 5.21F, 6.22F, 7.23F, 8.23F, 9.23F, 10.23F, 11.21F, 12.22F, 13.20F };//定义星座间隔之间的数字
            string[] atoms = { "水瓶座", "双鱼座 ", "白羊座", "金牛座", "双子座", "巨蟹座", "狮子座", "处女座", "天秤座", "天蝎座", "射手座", "摩羯座" };//定义星座名称
            for (int i = 0; i < atomBoud.Length - 1; i++)//遍历星座间隔之间的数字
            {
                //判断遍历到的数字跟生日的大小关系
               
                    if (atomBoud[i] <= birthday && atomBoud[i + 1] > birthday)
                    {
                        strConstellation = atoms[i];
                        break;
                    }


  }

               return strConstellation;//返回得到的星座名称
            
        }

        public Form1()
        {
            InitializeComponent();
        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (int i = 1; i <= 12; i++)
            {

            }
        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void pictureBox1_Click(object sender, EventArgs e)
        {
            try {
                DateTime dt=new DateTime (1,Convert.ToInt32 (cbbMonth .SelectedItem .ToString ()),
                    Convert .ToInt32 (cbbDay .SelectedItem .ToString ()));//获取选择的生日
                lblName.Text =search.GetConstellation(dt);//根据生日获取所属星座名称
                //获取其他信息
                string[] info = search.ConstellationDescription(search.GetConstellation(dt));
               
                lblTrait.Text=info[0];
                lblColor.Text=info [1];
                lblNum.Text=info [2];
                lblDate.Text=info [3];
                lblPlace.Text=info [4];
             rtbpersonality.Text=info [5];
                   rtbvirtue .Text =info [6];
               rtbflaw.Text=info [7];
               switch (lblName .Text .Trim()){


                   case "白羊座":
                     ptbConstellation .Image =Properties .Resources .白羊座;break ;
                   case "处女座":
                       ptbConstellation .Image=Properties .Resources .处女座;break ;
                   case "金牛座":
                       ptbConstellation .Image =Properties .Resources .金牛座;break ;
                   case "巨蟹座":
                     ptbConstellation .Image =Properties .Resources .巨蟹座;break ;
                      case "魔蝎座":   
                     ptbConstellation .Image =Properties .Resources .魔蝎座;break ;
                  
                     ptbConstellation .Image =Properties .Resources .魔蝎座;break ;
                   case "天秤座":
                     ptbConstellation .Image =Properties .Resources .天秤座;break ;
                   case "双子座"   :
                     ptbConstellation .Image =Properties .Resources .双子座;break ;
                   case "双鱼座":  
                     ptbConstellation .Image =Properties .Resources .双鱼座;break ;
                   case "狮子座" :
                     ptbConstellation .Image =Properties .Resources .狮子座;break ;
                      case "天蝎座":   
                     ptbConstellation .Image =Properties .Resources .天蝎座;break ;
                   case "射手座  " :
                     ptbConstellation .Image =Properties .Resources .射手座;break ;
               }

        }
                catch {
                    MessageBox .Show ("选择日期有误","警告",MessageBoxButtons .OK ,MessageBoxIcon .Error );}}
        

        private void comboBox1_SelectedIndexChanged_1(object sender, EventArgs e)
        {
        
        }

        private void cbbMonth_Click(object sender, EventArgs e)
        {

        }

        private void label2_Click(object sender, EventArgs e)
        {
        
        }

        private void label3_Click(object sender, EventArgs e)
        {
        
        }

        private void label4_Click(object sender, EventArgs e)
        {
        
        }
    }
}
搜索更多相关主题的帖子: 特色 public search 幸运色 星座 
2012-10-13 21:48
lybh24
Rank: 8Rank: 8
等 级:贵宾
威 望:19
帖 子:120
专家分:701
注 册:2012-9-8
收藏
得分:2 
看起都累啊 呵呵

新群:273209143
2012-10-13 22:25
于红光521
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2012-10-11
收藏
得分:0 
回复 2楼 lybh24
是,呵呵但是没什么就是重复的代码多!你能帮我解释解释吗
2012-10-14 15:51
快速回复:窗口文件求解
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.066491 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved