| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1308 人关注过本帖
标题:(请教高手)计算器进制转换???
只看楼主 加入收藏
purewqk
Rank: 1
等 级:新手上路
帖 子:21
专家分:0
注 册:2007-10-24
收藏
 问题点数:0 回复次数:0 
(请教高手)计算器进制转换???
private void radioButton4_CheckedChanged(object sender, EventArgs e)     //二进制radiobutton
        {
            if (this.radioButton4.Checked)
            {
                convertstring(4);
            }
        }

        private void radioButton3_CheckedChanged(object sender, EventArgs e)  //八进制radiobutton
        {
            if (this.radioButton3.Checked)
            {
                convertstring(3);
            }
        }

        private void radioButton2_CheckedChanged(object sender, EventArgs e)   //十进制radiobutton
        {
            if (this.radioButton2.Checked)
            {
                convertstring(2);
            }
        }
       private void radioButton1_CheckedChanged(object sender, EventArgs e)  //十六进制radiobutton
        {
            if (this.radioButton1.Checked)
            {
                convertstring(1);
            }
        }
        public void convertstring(int th)
        {
            switch (th)
            {
                case 1:
                    intvalue = Convert.ToInt32(txtResult.Text, frombase);
                    value = Convert.ToString(intvalue, 16);
                    txtResult.Text = value.ToString();
                    frombase = 16;
                    break;
                case 2:
                    intvalue = Convert.ToInt32(txtResult.Text, frombase);
                    value = Convert.ToString(intvalue, 10);
                    txtResult.Text = value.ToString();
                    frombase = 10;
                    break;
                case 3:
                    intvalue = Convert.ToInt32(txtResult.Text, frombase);
                    value = Convert.ToString(intvalue, 8);
                    txtResult.Text = value.ToString();
                    frombase = 8;
                    break;
                case 4:
                    intvalue = Convert.ToInt32(txtResult.Text, frombase);
                    value = Convert.ToString(intvalue, 2);
                    txtResult.Text = value.ToString();
                    frombase = 2;
                    break;

            }
        }
        为什么运行后没有作用????
搜索更多相关主题的帖子: 计算器 进制 void sender 
2008-01-09 20:18
快速回复:(请教高手)计算器进制转换???
数据加载中...
 
   



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

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