الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

برنامج calculator!

استطلاع
بدأه mafia1211 في 26 نوفمبر 2011 · 1 رد · 409 مشاهدة · في Microsoft Visual C#.NET
مشاركة: واتساب X فيسبوك تيليجرام

اعجبك برنامجي

1 مشارك في التصويت

??? ??? ???????

??? ???1 صوت · 100%
???0 صوت · 0%
????0 صوت · 0%
???0 صوت · 0%
??? ??? ???? ?? ?????0 صوت · 0%
#1 صاحب الموضوع

اردت فقط ان اهديكم برنامج calculator مع الكود بتاعة مع ال source file و كمان ال setup بتاعه وطبعا إن شاء الله هشرحة ان اعجبكم برجاء التصويت

برجاء التغط عل هذا الرابط لفتح صورة تصميم البرنامج

الشرح:

نضع الارقام كما هو موضح في الصورة من 0 الي 9 نضع الoperator نضع 2 text boxes واحد نخفيه التاني نظهره نخلي المستخدم يكتب رقم و لما ندوس علي ال operator يحفظ الرقم في variable ويمسحه من ال text box 1 ويحط ال operator ولنقل مثلا + في ال textbox الخفي textbox2 ودخل رقم اخر لم ندوس علي equal button يدخل الرقم الذي في textbox1 في variable اخر ويمسحه وهنا نستخدم ال if statement نقول للكمبيوتر لو ال textbox2 = + يبقي نعمل الاتنين variables hg احنا دخلنا فيهم الارقام زائد بعض واالرقم اللي يطلع منهم نحفظه في vairable واحد وهذا ال variable ندخله في textbox1 فمثلا لو ان ال variable للرقم الاول x وال variable للرقم الثاني y وال variable للنتيجة result يبقي نعملresult=X+y

ثم

textbox.text=result.tosrtring();

مع مراعاة انها textbox1.text=result.tostring(); وليست result=convert.ToDecimal(textbox1.text)

وهذا سوف تجده في الكود في الاسفل

واي سؤال في الكود ارجوكم اسالوني وسوف ارد فورا

شكرا

برجاء الطغت علي هذا الرابط لتحميل ال Installation

Calculator Setup!.rar

اقتباس
اهدي هذا البرنامج الي عماد صالح

الكود :

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 Calculator__
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        decimal  x, y,z, result;



        private void add_Click(object sender, EventArgs e)
        {


        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void button12_Click(object sender, EventArgs e)
        {
            x = Convert.ToDecimal(textBox1.Text);
            textBox2.Text = "+";
            textBox1.Clear();
            button11.Hide();
            button12.Hide();
            button13.Hide();
            button14.Hide();
            button15.Hide();
            button18.Hide();




        }

        private void button16_Click(object sender, EventArgs e)
        {
             button12.Show();
             button13.Show();
             button14.Show();
             button15.Show();
            if (textBox2.Text == "+")
            {
                y =Convert.ToDecimal ( textBox1.Text);
                result = x + y;
                textBox1.Clear();
                textBox1.Text = result.ToString();
                button17.Show();

            }
            else if (textBox2.Text == "-")
            {

                y = Convert.ToDecimal(textBox1.Text);
                result = x - y;
                textBox1.Clear();
                textBox1.Text = result.ToString();
                button17.Show();
            }
            else if (textBox2.Text == "*")
            {

                y = Convert.ToDecimal(textBox1.Text);
                result = x * y;
                textBox1.Clear();
                textBox1.Text = result.ToString();
                button17.Show();
            }
            else if (textBox2.Text == "\\")
            {

                y = Convert.ToDecimal(textBox1.Text);
                result = x / y;
                textBox1.Clear();
                textBox1.Text = result.ToString();
                button17.Show();
            }
            else if (textBox2.Text == "%")
            {
                y = Convert.ToDecimal(textBox1.Text);
                result = y / x;
                z = result * 100;
                textBox1.Text =  z.ToString() + "%"  ;
                button17.Show();

            }







        }

        private void button1_Click(object sender, EventArgs e)
        {
            textBox1.Text = textBox1.Text + 1;
            button11.Show();
            button12.Show();
            button13.Show();
            button14.Show();
            button15.Show();
            button18.Show();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            textBox1.Text = textBox1.Text + 2;
            button11.Show();
            button12.Show();
            button13.Show();
            button14.Show();
            button15.Show();
            button18.Show();
        }

        private void button4_Click(object sender, EventArgs e)
        {
            textBox1.Text = textBox1.Text + 3;
            button11.Show();
            button12.Show();
            button13.Show();
            button14.Show();
            button15.Show();
            button18.Show();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            textBox1.Text = textBox1.Text + 4;
            button11.Show();
            button12.Show();
            button13.Show();
            button14.Show();
            button15.Show();
            button18.Show();
        }

        private void button6_Click(object sender, EventArgs e)
        {
            textBox1.Text = textBox1.Text + 5;
            button11.Show();
            button12.Show();
            button13.Show();
            button14.Show();
            button15.Show();
            button18.Show();
        }

        private void button5_Click(object sender, EventArgs e)
        {
            textBox1.Text = textBox1.Text + 6;
            button11.Show();
            button12.Show();
            button13.Show();
            button14.Show();
            button15.Show();
            button18.Show();
        }

        private void button7_Click(object sender, EventArgs e)
        {
            textBox1.Text = textBox1.Text + 7;
            button11.Show();
            button12.Show();
            button13.Show();
            button14.Show();
            button15.Show();
            button18.Show();
        }

        private void button8_Click(object sender, EventArgs e)
        {
            textBox1.Text = textBox1.Text + 8;
            button11.Show();
            button12.Show();
            button13.Show();
            button14.Show();
            button15.Show();
            button18.Show();
        }

        private void button9_Click(object sender, EventArgs e)
        {
            textBox1.Text = textBox1.Text + 9;
            button11.Show();
            button12.Show();
            button13.Show();
            button14.Show();
            button15.Show();
            button18.Show();
        }

        private void button10_Click(object sender, EventArgs e)
        {
            textBox1.Clear ();
            button11.Hide();
            button12.Hide();
            button13.Hide();
            button14.Hide();
            button15.Hide();
            button18.Hide();
        }

        private void button0_Click(object sender, EventArgs e)
        {
            textBox1.Text = textBox1.Text + 0;
            button11.Show();
            button12.Show();
            button13.Show();
            button14.Show();
            button15.Show();
            button18.Show();
        }

        private void button11_Click(object sender, EventArgs e)
        {
            textBox1.Text = textBox1.Text + ".";
        }

        private void Exit_Click(object sender, EventArgs e)
        {
            DialogResult exit;
            exit = MessageBox.Show("Are you Sure you want to Exit?", "Good Bye", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (exit == DialogResult.Yes)
            {
                Close();
            }

        }

        private void button17_Click(object sender, EventArgs e)
        {
            textBox1.Text =textBox1.Text + result.ToString();
        }

        private void button13_Click(object sender, EventArgs e)
        {
            x = Convert.ToDecimal(textBox1.Text);
            textBox2.Text = "-";
            textBox1.Clear();
            button11.Hide();
            button12.Hide();
            button13.Hide();
            button14.Hide();
            button15.Hide();
            button18.Hide();
        }

        private void button15_Click(object sender, EventArgs e)
        {
            x = Convert.ToDecimal(textBox1.Text);
            textBox2.Text = "\\";
            textBox1.Clear();
            button11.Hide();
            button12.Hide();
            button13.Hide();
            button14.Hide();
            button15.Hide();
            button18.Hide();
        }

        private void button14_Click(object sender, EventArgs e)
        {
            x = Convert.ToDecimal(textBox1.Text);
            textBox2.Text = "*";
            textBox1.Clear();
            button11.Hide();
            button12.Hide();
            button13.Hide();
            button14.Hide();
            button15.Hide();
            button18.Hide();
        }

        private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {
            if (checkBox1.Checked)
            {
                DialogResult p;
                textBox1.ReadOnly = false;
                button0.Hide();
                button1.Hide();
                button2.Hide();
                button3.Hide();
                button4.Hide();
                button5.Hide();
                button6.Hide();
                button7.Hide();
                button8.Hide();
                button9.Hide();
                button12.Show();
                button13.Show();
                button14.Show();
                button15.Show();
                button10.Hide();
                button18.Show();
                MessageBox.Show("You are responsible for any errors !", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                p = MessageBox.Show("Are you still want to continue?","continue",MessageBoxButtons .YesNo ,MessageBoxIcon.Stop );
                if (p == DialogResult.Yes)
                {
                    checkBox1.Checked = true;
                }
                else if (p == DialogResult.No)
                {
                    checkBox1.Checked = false;
                }

            }
            else if (checkBox1.Checked == false)
            {
                textBox1.ReadOnly = true;
                button0.Show();
                button1.Show();
                button2.Show();
                button3.Show();
                button4.Show();
                button5.Show();
                button6.Show();
                button7.Show();
                button8.Show();
                button9.Show();
                button12.Hide();
                button13.Hide();
                button14.Hide();
                button15.Hide();
                button18.Hide();
            }
        }

        private void button18_Click(object sender, EventArgs e)
        {
            x = Convert.ToDecimal(textBox1.Text);
            textBox2.Text = "%";
            textBox1.Clear();
            button11.Hide();
            button12.Hide();
            button13.Hide();
            button14.Hide();
            button15.Hide();
            button18.Hide();
        }







    }
}

برجاء النظر الي التعليقات بالاسفل

يوجد بها بقية الموضوع

#2

اسف لاني لم استطع تنزيل الصورة وال source File code ولكنك ستجدهم في هذه الروابط :)

الصورة:

?d=SWZOW31G

source Program :

Press here

press here

Photo

مواضيع مشابهة