C#Winform基礎 八位元轉換為無符號位元(整數,正數)

來源:互聯網
上載者:User

標籤:val   img   input   png   tput   進位   void   .com   object   

鎮場詩:
———大夢誰覺,水月中建部落格。百千磨難,才知世事無常。
———今持佛語,技術無量願學。願盡所學,鑄一良心部落格。
——————————————————————————————————————————

 

1 UI

 

 

 

2 code

 1 using System; 2 using System.Collections.Generic; 3 using System.ComponentModel; 4 using System.Data; 5 using System.Drawing; 6 using System.Linq; 7 using System.Text; 8 using System.Threading.Tasks; 9 using System.Windows.Forms;10 11 namespace WindowsFormsApplication512 {13     public partial class Form1 : Form14     {15         public Form1()16         {17             InitializeComponent();18         }19 20         //private void btn2_8_Click(object sender, EventArgs e)21         //{22         //   textBoxOfOutput.Text= ConvertNumber(textBoxOfInput.Text, 2, 8);23         //}24 25         26         /// <summary>27         /// 進行進位之間的轉換,有缺陷不能進行有符號的進位之間的轉換28         /// </summary>29         /// <param name="input">被處理的資料</param>30         /// <param name="typeOfInput">輸入的資料是多少進位的</param>31         /// <param name="typeOfOutput">輸出的資料是多少進位的</param>32         /// <returns>返迴轉換完成的資料</returns>33         public string ConvertNumber(string input,int typeOfInput,int typeOfOutput)34         {35             int value = Convert.ToInt32(input, typeOfInput);36             string res = Convert.ToString(value, typeOfOutput);37 38             return res;39         }40 41         private void btn8_2_Click(object sender, EventArgs e)42         {43             textBoxOfOutput.Text = ConvertNumber(textBoxOfInput.Text, 8, 2);44         }45     }46 }

 

 

 

3 show

 

——————————————————————————————————————————
博文的精髓,在技術部分,更在鎮場一詩。
C#是優秀的語言,值得努力學習。
如果博文的內容有可以改進的地方,甚至有錯誤的地方,請留下評論,我一定努力改正,爭取鑄成一個良心部落格。
註:此文僅作為科研學習,如果我無意中侵犯了您的權益,請務必及時告知,我會做出改正。

C#Winform基礎 八位元轉換為無符號位元(整數,正數)

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.