public void GetPropertiesSupported()
        {
            var cvt = new MultilineStringConverter();

            Assert.IsFalse(cvt.GetPropertiesSupported(), "#A1-1");
            Assert.IsFalse(cvt.GetPropertiesSupported(null), "#A1-2");
        }
        public void GetProperties()
        {
            var cvt = new MultilineStringConverter();

            Assert.IsNull(cvt.GetProperties(null, null, null), "#A1-1");
            Assert.IsNull(cvt.GetProperties(null, "string", null), "#A1-2");
            Assert.IsNull(cvt.GetProperties(null, "string", new Attribute[] {}), "#A1-1");
        }
        /// <summary>
        /// Extends ConvertTo so that methods that return a specific type object given a Type parameter can be
        /// used as generic method and casting is not required.
        /// <example>
        /// typeconverter.ConvertTo&lt;int&gt;(value);
        /// </example>
        /// </summary>
        public static T ConvertTo <T>(this MultilineStringConverter typeconverter, Object value)
        {
            if (typeconverter == null)
            {
                throw new ArgumentNullException("typeconverter");
            }

            return((T)typeconverter.ConvertTo(value, typeof(T)));
        }
        /// <summary>
        /// Extends ConvertTo so that methods that return a specific type object given a Type parameter can be
        /// used as generic method and casting is not required.
        /// <example>
        /// multilinestringconverter.ConvertTo&lt;int&gt;(context, culture, value);
        /// </example>
        /// </summary>
        public static T ConvertTo <T>(this MultilineStringConverter multilinestringconverter, ITypeDescriptorContext context, System.Globalization.CultureInfo culture, Object value)
        {
            if (multilinestringconverter == null)
            {
                throw new ArgumentNullException("multilinestringconverter");
            }

            return((T)multilinestringconverter.ConvertTo(context, culture, value, typeof(T)));
        }
        public void ConvertTo()
        {
            var cvt = new MultilineStringConverter();

            AssertThrows <ArgumentNullException> (() =>
            {
                cvt.ConvertTo(null, null, "string", null);
            }, "#A1-1");

            AssertThrows <NotSupportedException> (() =>
            {
                cvt.ConvertTo(null, null, "string", typeof(int));
            }, "#A1-2");

            AssertThrows <NotSupportedException> (() =>
            {
                cvt.ConvertTo(null, null, "string", typeof(double));
            }, "#A1-3");

            object result = cvt.ConvertTo(null, null, "string", typeof(string));

            Assert.IsNotNull(result, "#A2-1");
            Assert.IsTrue(result.GetType() == typeof(string), "#A2-2");
            Assert.AreEqual("(Text)", (string)result, "#A2-3");

            string orig = @"This
is
a
multiline
string";

            result = cvt.ConvertTo(null, null, orig, typeof(string));
            Assert.IsNotNull(result, "#A3-1");
            Assert.IsTrue(result.GetType() == typeof(string), "#A3-2");
            Assert.AreEqual("(Text)", (string)result, "#A3-3");

            result = cvt.ConvertTo(null, null, 1234, typeof(string));
            Assert.IsNotNull(result, "#A4-1");
            Assert.IsTrue(result.GetType() == typeof(string), "#A4-2");
            Assert.AreEqual("1234", (string)result, "#A4-3");
        }
        /// <summary>
        /// Tasarımcı desteği için gerekli metot - bu metodun
        ///içeriğini kod düzenleyici ile değiştirmeyin.
        /// </summary>
        private void InitializeComponent()
        {
            //TextBox
            this.TextBox = new System.Windows.Forms.TextBox();

            //Buttons
            this.zero       = new System.Windows.Forms.Button();
            this.one        = new System.Windows.Forms.Button();
            this.two        = new System.Windows.Forms.Button();
            this.three      = new System.Windows.Forms.Button();
            this.four       = new System.Windows.Forms.Button();
            this.five       = new System.Windows.Forms.Button();
            this.six        = new System.Windows.Forms.Button();
            this.seven      = new System.Windows.Forms.Button();
            this.eight      = new System.Windows.Forms.Button();
            this.nine       = new System.Windows.Forms.Button();
            this.add        = new System.Windows.Forms.Button();
            this.sub        = new System.Windows.Forms.Button();
            this.multiplion = new System.Windows.Forms.Button();
            this.div        = new System.Windows.Forms.Button();
            this.clear      = new System.Windows.Forms.Button();
            this.dot        = new System.Windows.Forms.Button();
            this.equals     = new System.Windows.Forms.Button();

            //additions for fixed size
            this.border = new System.Windows.Forms.Label();
            this.SuspendLayout();

            //
            //TextBox
            //
            this.TextBox.Location = new System.Drawing.Point(200, 30);
            this.TextBox.Size     = new System.Drawing.Size(200, 60);


            //for multiple lines of Textbox
            //=> (Yukaridaki size metodunda en sadece bir satır için geçerlidir.)
            //=> (it applies only to one line,in the size method above)
            this.TextBox.Multiline = MultilineStringConverter.Equals(1, 1);
            this.TextBox.TextAlign = HorizontalAlignment.Center;

            //
            //button 0
            //
            this.zero.Location = new System.Drawing.Point(250, 290);
            this.zero.Size     = new System.Drawing.Size(50, 50);
            this.zero.Text     = "0";
            this.zero.Click   += new System.EventHandler(this.zero_Click);

            //
            //button 1
            //
            this.one.Location = new System.Drawing.Point(200, 240);
            this.one.Size     = new System.Drawing.Size(50, 50);
            this.one.Text     = "1";
            this.one.Click   += new System.EventHandler(this.one_Click);

            //
            //button 2
            //
            this.two.Location = new System.Drawing.Point(250, 240);
            this.two.Size     = new System.Drawing.Size(50, 50);
            this.two.Text     = "2";
            this.two.Click   += new System.EventHandler(this.two_Click);

            //
            //button 3
            //
            this.three.Location = new System.Drawing.Point(300, 240);
            this.three.Size     = new System.Drawing.Size(50, 50);
            this.three.Text     = "3";
            this.three.Click   += new System.EventHandler(this.three_Click);

            //
            //button 4
            //
            this.four.Location = new System.Drawing.Point(200, 190);
            this.four.Size     = new System.Drawing.Size(50, 50);
            this.four.Text     = "4";
            this.four.Click   += new System.EventHandler(this.four_Click);

            //
            //button 5
            //
            this.five.Location = new System.Drawing.Point(250, 190);
            this.five.Size     = new System.Drawing.Size(50, 50);
            this.five.Text     = "5";
            this.five.Click   += new System.EventHandler(this.five_Click);

            //
            //button 6
            //
            this.six.Location = new System.Drawing.Point(300, 190);
            this.six.Size     = new System.Drawing.Size(50, 50);
            this.six.Text     = "6";
            this.six.Click   += new System.EventHandler(this.six_Click);

            //
            //button 7
            //
            this.seven.Location = new System.Drawing.Point(200, 140);
            this.seven.Size     = new System.Drawing.Size(50, 50);
            this.seven.Text     = "7";
            this.seven.Click   += new System.EventHandler(this.seven_Click);

            //
            //button 8
            //
            this.eight.Location = new System.Drawing.Point(250, 140);
            this.eight.Size     = new System.Drawing.Size(50, 50);
            this.eight.Text     = "8";
            this.eight.Click   += new System.EventHandler(this.eight_Click);

            //
            //button 9
            //
            this.nine.Location = new System.Drawing.Point(300, 140);
            this.nine.Size     = new System.Drawing.Size(50, 50);
            this.nine.Text     = "9";
            this.nine.Click   += new System.EventHandler(this.nine_Click);


            //
            //button add
            //
            this.add.Location = new System.Drawing.Point(350, 90);
            this.add.Size     = new System.Drawing.Size(50, 100);
            this.add.Text     = "+";
            this.add.Click   += new System.EventHandler(this.add_Click);

            //
            //button sub
            //
            this.sub.Location = new System.Drawing.Point(300, 90);
            this.sub.Size     = new System.Drawing.Size(50, 50);
            this.sub.Text     = "-";
            this.sub.Click   += new System.EventHandler(this.sub_Click);

            //
            //button multiplion
            //
            this.multiplion.Location = new System.Drawing.Point(250, 90);
            this.multiplion.Size     = new System.Drawing.Size(50, 50);
            this.multiplion.Text     = "*";
            this.multiplion.Click   += new System.EventHandler(this.multiplion_Click);

            //
            //button div
            //
            this.div.Location = new System.Drawing.Point(200, 90);
            this.div.Size     = new System.Drawing.Size(50, 50);
            this.div.Text     = "/";
            this.div.Click   += new System.EventHandler(this.div_Click);

            //
            //button clear
            //
            this.clear.Location = new System.Drawing.Point(350, 190);
            this.clear.Size     = new System.Drawing.Size(50, 150);
            this.clear.Text     = "C";
            this.clear.Click   += new System.EventHandler(this.clear_Click);

            //
            //button dot
            //
            this.dot.Location = new System.Drawing.Point(200, 290);
            this.dot.Size     = new System.Drawing.Size(50, 50);
            this.dot.Text     = ".";
            this.dot.Click   += new System.EventHandler(this.dot_Click);

            //
            //button equals
            //
            this.equals.Location = new System.Drawing.Point(300, 290);
            this.equals.Size     = new System.Drawing.Size(50, 50);
            this.equals.Text     = "=";
            this.equals.Click   += new System.EventHandler(this.equals_Click);

            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
            this.AutoScaleMode       = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize          = new System.Drawing.Size(800, 500);
            this.BackColor           = Color.GhostWhite;
            this.Name  = "Form1";
            this.Text  = "CALCULATOR made by Mustafa Desteci";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);

            //additions to the form for fixed size
            this.border.Location = new System.Drawing.Point(700, 300);
            this.border.Size     = new System.Drawing.Size(800, 500);
            this.Controls.Add(border);
            this.FormBorderStyle = FormBorderStyle.SizableToolWindow;

            //buttons and textbox additions to the form
            this.Controls.Add(this.TextBox);
            this.Controls.Add(this.zero);
            this.Controls.Add(this.one);
            this.Controls.Add(this.two);
            this.Controls.Add(this.three);
            this.Controls.Add(this.four);
            this.Controls.Add(this.five);
            this.Controls.Add(this.six);
            this.Controls.Add(this.seven);
            this.Controls.Add(this.eight);
            this.Controls.Add(this.nine);
            this.Controls.Add(this.add);
            this.Controls.Add(this.sub);
            this.Controls.Add(this.multiplion);
            this.Controls.Add(this.div);
            this.Controls.Add(this.clear);
            this.Controls.Add(this.dot);
            this.Controls.Add(this.equals);
        }
Пример #7
0
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.SuspendLayout();

            //Buttons
            this.LoginButton   = new System.Windows.Forms.Button();
            this.CancellButton = new System.Windows.Forms.Button();
            this.Clear1Button  = new System.Windows.Forms.Button();
            this.Clear2Button  = new System.Windows.Forms.Button();
            this.Clear3Button  = new System.Windows.Forms.Button();
            this.Clear4Button  = new System.Windows.Forms.Button();

            //Labels
            this.Username    = new System.Windows.Forms.Label();
            this.Password    = new System.Windows.Forms.Label();
            this.Phonenumber = new System.Windows.Forms.Label();
            this.location    = new System.Windows.Forms.Label();

            //Textboxes
            this.Tboxname    = new System.Windows.Forms.TextBox();
            this.Tboxpass    = new System.Windows.Forms.TextBox();
            this.Tboxpnumber = new System.Windows.Forms.TextBox();
            this.Tboxloc     = new System.Windows.Forms.TextBox();

            //
            //button Login
            //
            this.LoginButton.Location = new System.Drawing.Point(150, 255);
            this.LoginButton.Size     = new System.Drawing.Size(100, 50);
            this.LoginButton.Text     = " ✔ ";
            this.LoginButton.Click   += new System.EventHandler(this.LoginButton_Click);

            //
            //button Cancell
            //
            this.CancellButton.Location = new System.Drawing.Point(250, 255);
            this.CancellButton.Size     = new System.Drawing.Size(100, 50);
            this.CancellButton.Text     = " ❌ ";
            this.CancellButton.Click   += new System.EventHandler(this.CancellButton_Click);

            //
            //button Clear1
            //
            this.Clear1Button.Location = new System.Drawing.Point(350, 100);
            this.Clear1Button.Size     = new System.Drawing.Size(80, 30);
            this.Clear1Button.Text     = " ◁ ";
            this.Clear1Button.Click   += new System.EventHandler(this.Clear1_Click);

            //
            //button Clear2
            //
            this.Clear2Button.Location = new System.Drawing.Point(350, 140);
            this.Clear2Button.Size     = new System.Drawing.Size(80, 30);
            this.Clear2Button.Text     = " ◁ ";
            this.Clear2Button.Click   += new System.EventHandler(this.Clear2_Click);

            //
            //button Clear3
            //
            this.Clear3Button.Location = new System.Drawing.Point(350, 180);
            this.Clear3Button.Size     = new System.Drawing.Size(80, 30);
            this.Clear3Button.Text     = " ◁ ";
            this.Clear3Button.Click   += new System.EventHandler(this.Clear3_Click);

            //
            //button Clear4
            //
            this.Clear4Button.Location = new System.Drawing.Point(350, 220);
            this.Clear4Button.Size     = new System.Drawing.Size(80, 30);
            this.Clear4Button.Text     = " ◁ ";
            this.Clear4Button.Click   += new System.EventHandler(this.Clear4_Click);

            //
            //textbox username
            //
            this.Tboxname.Location  = new System.Drawing.Point(150, 100);
            this.Tboxname.Size      = new System.Drawing.Size(200, 30);
            this.Tboxname.Multiline = MultilineStringConverter.Equals(1, 1);
            this.Tboxname.Font      = new System.Drawing.Font("Courier New", 13F);

            //
            //textbox password
            //
            this.Tboxpass.Location  = new System.Drawing.Point(150, 140);
            this.Tboxpass.Size      = new System.Drawing.Size(200, 30);
            this.Tboxpass.Multiline = MultilineStringConverter.Equals(1, 1);
            this.Tboxpass.Font      = new System.Drawing.Font("Courier New", 13F);

            //
            //textbox phone number
            //
            this.Tboxpnumber.Location  = new System.Drawing.Point(150, 180);
            this.Tboxpnumber.Size      = new System.Drawing.Size(200, 30);
            this.Tboxpnumber.Multiline = MultilineStringConverter.Equals(1, 1);
            this.Tboxpnumber.Font      = new System.Drawing.Font("Courier New", 13F);

            //
            //textbox location
            //
            this.Tboxloc.Location  = new System.Drawing.Point(150, 220);
            this.Tboxloc.Size      = new System.Drawing.Size(200, 30);
            this.Tboxloc.Multiline = MultilineStringConverter.Equals(1, 1);
            this.Tboxloc.Font      = new System.Drawing.Font("Courier New", 13F);

            //
            //label username
            //
            this.Username.Location = new System.Drawing.Point(50, 105);
            this.Username.Size     = new System.Drawing.Size(100, 30);
            this.Username.Text     = "Username ";
            this.Username.Font     = new System.Drawing.Font("Courier New", 13F);

            //
            //label password
            //
            this.Password.Location = new System.Drawing.Point(50, 145);
            this.Password.Size     = new System.Drawing.Size(100, 30);
            this.Password.Text     = "Password";
            this.Password.Font     = new System.Drawing.Font("Courier New", 13F);

            //
            //label phone number
            //
            this.Phonenumber.Location = new System.Drawing.Point(50, 185);
            this.Phonenumber.Size     = new System.Drawing.Size(100, 30);
            this.Phonenumber.Text     = "P.Number";
            this.Phonenumber.Font     = new System.Drawing.Font("Courier New", 13F);

            //
            //label location
            //
            this.location.Location = new System.Drawing.Point(50, 225);
            this.location.Size     = new System.Drawing.Size(100, 30);
            this.location.Text     = "Location";
            this.location.Font     = new System.Drawing.Font("Courier New", 13F);

            //
            //LoginForm
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
            this.AutoScaleMode       = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize          = new System.Drawing.Size(800, 450);
            this.Name  = "LoginForm";
            this.Text  = "LoginForm";
            this.Load += new System.EventHandler(this.LoginForm_Load);
            this.ResumeLayout(false);
            this.ShowIcon = false;

            //buttons
            this.Controls.Add(this.LoginButton);
            this.Controls.Add(this.CancellButton);
            this.Controls.Add(this.Clear1Button);
            this.Controls.Add(this.Clear2Button);
            this.Controls.Add(this.Clear3Button);
            this.Controls.Add(this.Clear4Button);
            //labels
            this.Controls.Add(this.Username);
            this.Controls.Add(this.Password);
            this.Controls.Add(this.Phonenumber);
            this.Controls.Add(this.location);
            //textboxes
            this.Controls.Add(this.Tboxname);
            this.Controls.Add(this.Tboxpass);
            this.Controls.Add(this.Tboxpnumber);
            this.Controls.Add(this.Tboxloc);
        }