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;
using System.IO;

namespace WindowsFormsApplication1
{
    public partial class binaryfile : Form
    {
        public binaryfile()
        {
            InitializeComponent();
        }
        BinaryWriter bw;
        FileStream fs;
        BinaryReader br;
        private void button1_Click(object sender, EventArgs e)
        {
         
            fs = new FileStream(@"E:\demo.data", FileMode.Create);
            bw = new BinaryWriter(fs);
            for (int i = 0; i < 5; i++)
            {
                bw.Write(i);
             
            }
            bw.Close();
            MessageBox.Show("Binary file created successfully");

        }

        private void button2_Click(object sender, EventArgs e)
        {
            fs = new FileStream(@"E:\demo.data", FileMode.Open);
            br = new BinaryReader(fs);
            int l = (int)fs.Length;
            for (int i = 0; i < l / 4; i++)
            {
                listBox1.Items.Add(br.ReadInt32());
            }
        }
    }
}
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;
using System.IO;

namespace WindowsFormsApplication1
{
    public partial class createaspx : Form
    {
        public createaspx()
        {
            InitializeComponent();
        }
        StreamWriter sw;

        private void create_Click(object sender, EventArgs e)
        {
            sw = File.CreateText(@"E:\hello.aspx");
            sw.WriteLine("<html>");
            sw.WriteLine("<form runat=\"server\">");
            sw.WriteLine("<asp:button text=\"hello\" runat=\"server\"></asp:button>");
            sw.WriteLine("</form>");
            sw.WriteLine("</html>");
            sw.Close();
            System.Diagnostics.Process.Start(@"E:\hello.aspx");
        }
    }
}
Class file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WindowsFormsApplication1
{
    class inheritanc
    {
        private int mibalance;
        public int balance
        {
            get
            {
                return mibalance;

            }
            set
            {
                mibalance = value;
            }
        }
    }

    class inher : inheritanc
    {
        public void deposit(int amt)
        {
            balance = balance + amt;
        }
        public void withdraw(int amt)
        {
            balance = balance - amt;
        }
    }
}

Windows form file
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 WindowsFormsApplication1
{
    public partial class inheritance : Form
    {
        public inheritance()
        {
            InitializeComponent();
        }

   

        private void inheritance_Load(object sender, EventArgs e)
        {
            inheritanc kk=new inheritanc();
            MessageBox.Show(kk.balance.ToString());
        }
    }
}
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;
using System.Drawing.Imaging;

namespace WindowsFormsApplication1
{
    public partial class imagecrop : Form
    {
        public imagecrop()
        {
            InitializeComponent();
        }

        private void btncrop_Click(object sender, EventArgs e)
        {
            Bitmap mybitmap;
            Bitmap mybitmapcropped;
            Graphics mygraphics;
            Rectangle rec = new Rectangle(0, 0, 250, 300);
            mybitmap=new Bitmap(@"E:\1.jpg");
            mybitmapcropped = new Bitmap(200, 200);
            mygraphics = Graphics.FromImage(mybitmapcropped);
            mygraphics.DrawImage(mybitmap, new Rectangle(0, 0, mybitmapcropped.Width, mybitmapcropped.Height),rec.Left,rec.Top,rec.Width,rec.Height,GraphicsUnit.Pixel);
            mybitmap.Dispose();
            mybitmapcropped.Save(@"E:\2.jpg",ImageFormat.Jpeg);




        }
    }
}
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 Examples
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        int iSec = 0;
        int iMin = 0;
        int iHr = 0;
        private void Form1_Paint(object sender, PaintEventArgs e)
        {

            Graphics g = e.Graphics;
            g.DrawPie(Pens.Blue,50,50,200,200,0,90);
            g.DrawPie(Pens.Blue, 50, 50, 200, 200, 90, 90);
            g.DrawPie(Pens.Blue, 50, 50, 200, 200, 180, 90);
            g.DrawPie(Pens.Blue, 50, 50, 200, 200, 270, 90);
            g.DrawPie(Pens.Green, 50, 50, 200, 200, 90, iSec);
            iSec += 4;

            if (iSec == 360)
            {
                iMin += 6;
                iSec = 0;
            }
            g.DrawPie(Pens.Red, 50, 50, 200, 200, 90, iMin);

            if (iMin == 360)
            {
                iHr += 6;
                iMin = 0;
            }

        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            Invalidate();
        }
    }
}