Sunday, August 04, 2013


In the following example, when the user hovers the mouse over the button, the form expands in y direction. When the user clicks on the button, the text on the button changes. 

        int size1 = 400;
        int adder = 50;

        public Form1()
        {
            InitializeComponent();
            this.button1.Text = " Change Item ";
            this.button1.Dock = DockStyle.Bottom;
            this.button1.Click +=button1_Click;
            this.button1.MouseHover += button1_Click_F2;

            this.Controls.Add(this.button1);


            this.dataGridView1.Dock = DockStyle.Top;
            this.Controls.Add(dataGridView1);
            this.Size = new Size(400, 200);

        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.button1.Text = " Button1 Click is called ";
        }

        private void button1_Click_F2(object sender, EventArgs e)
        {
            
            this.Size = new Size(400, size1);
            size1 = size1 + adder;
        }

Posted on 9:18 AM by Erdem

No comments

Saturday, August 03, 2013

I found this article helpful to understand the concept of the client with encapsulation

Basically, the client is the object that uses or inherits methods and fields from another object. For the ideal encapsulation case, the client should not have access to the fields that are used in the methods of the object. Therefore, the interface must be designed in a way to prevent direct access to dynamic content of the inherited object or interface.

http://www.stanford.edu/class/cs108/handouts122/10OOPEncapsulation.pdf



Posted on 5:13 PM by Erdem

No comments