Sunday, 13 November 2016

computer graphics and types of computer graphics

computer graphics refers to creation, storage and manipulation of pictures and drawing using a computer .
graphics enhances the communication between user and computer. A major application of computer graphics is designing.

Application of computer graphics.

1.CAD
2.CAM
3.Entertainment.
4.training.
5.Graphical user interface.

Computer graphics are of two types .

1.interactive
2.non-interactive.

Interactive computer graphics

Interactive computer graphics involves a two way communication between user and computer graphics.
The user give some control over images by providing him an input devise.
ex; video game

Non interactive computer graphics.

In this type of computer graphics user have no control over images .. so it is called passive computer graphics.
ex; screen saver.


Monday, 1 February 2016

UPLOADING IMAGE IN WINDOWS USING C#


UPLOADING IMAGE IN WINDOWS C#


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

namespace stream
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
BROWSE IMAGE CODE
        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog open = new OpenFileDialog();
            open.Filter = "Image Files(*.jpg; *.jpeg; *.gif; *.bmp)|*.jpg; *.jpeg; *.gif; *.bmp";
            if (open.ShowDialog() == DialogResult.OK)
            {
                // display image in picture box
                //pictureBox1.Image = new Bitmap(open.FileName);
                // image file path
              textBox3.Text = open.FileName;
            }
         
        }
UPLOADING IMAGE IN DATABASE
        private void button2_Click(object sender, EventArgs e)
        {
            FileStream fs = new FileStream(textBox3.Text,FileMode.Open);
            Byte[] arr = new Byte[fs.Length];
            fs.Read(arr, 0, Convert.ToInt32(fs.Length));
            SqlConnection con = new SqlConnection("Data Source=INDIA;Initial Catalog=directory;Integrated Security=True");
            SqlCommand cmd = new SqlCommand("insert into imagetable  values(@id,@image)", con);
            cmd.Parameters.AddWithValue("@id", Convert.ToInt32(textBox1.Text));
            cmd.Parameters.AddWithValue("@image", arr);
            con.Open();
            cmd.ExecuteNonQuery();
         
            con.Close();
            MessageBox.Show("data saved");
       
         
        }
    }
}
designed image of uploading image in window application .

Thursday, 28 January 2016

COPYING FILE USING FILE HANDLING

FILE HANDLING 

STREAM

STREAM IS A CONCEPT BY WHICH WE CAN CONNECT DIFFERENT DEVICES LIKE CONSOLE,HDD,PENDRIVE ETC AND ALSO USE READ AND WRITE OPERATIONS.  

TYPES OF STREAM

  • FILE ORIENTED STREAM.
  • CHARACTER ORIENTED STREAM.

EXAMPLE OF FILE STREAM

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 FileHandling
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        
        private void copyingfi_Click(object sender, EventArgs e)
        {
            FileStream source = new FileStream("C:\\sachin.ini", FileMode.Open);
            FileStream destination = new FileStream("D:\\sachin.ini", FileMode.Create);
            source.CopyTo(destination);

            while (true)
            {
                int i = source.ReadByte();
                if (i == -1)
                {
                    break;
                    destination.WriteByte(Convert.ToByte(i));
                  

                }
                
                destination.Close();
                
            }
        }
    }
}

Thursday, 21 January 2016

racing numbers using multithreading in c#.

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.Threading;

namespace MultiThreading
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private bool check = true;
        public void race1()
        {
            for (int i = 0; i <=5000; i++)
            {
                if(check)
                {
                    textBox1.Text = i.ToString();
                }
                else
                    break;
            }
            check = false;
        }
        public void race2()
        {
            for (int i = 0; i <=5000; i++)
            {
                if (check)
                {

                    textBox2.Text = i.ToString();
                }
                else
                    break;
            }
            check = false;
        }
        private void button1_Click(object sender, EventArgs e)
        {
            Thread th1 = new Thread(race1);
            th1.Name = "thread1";
            Thread th2 = new Thread(race2);
            th2.Name = "thread2";
            th1.Start();
            th2.Start();
        }

 private void btnsuspend_Click(object sender, EventArgs e)
        {

            Thread th1 = new Thread(race1);
           
            Thread th2 = new Thread(race2);
          
            th1.Suspend();
            th2.Suspend();
        }

        private void btnresume_Click(object sender, EventArgs e)
        {
            Thread th1 = new Thread(race1);

            Thread th2 = new Thread(race2);

            th1.Resume();
            th2.Resume();
        }

        private void btnabort_Click(object sender, EventArgs e)
        {
             Thread th1 = new Thread(race1);

            Thread th2 = new Thread(race2);

            th1.Abort();
            th2.Abort();
        } private void btnsuspend_Click(object sender, EventArgs e)
        {

            Thread th1 = new Thread(race1);
           
            Thread th2 = new Thread(race2);
          
            th1.Suspend();
            th2.Suspend();
        }

        private void btnresume_Click(object sender, EventArgs e)
        {
            Thread th1 = new Thread(race1);

            Thread th2 = new Thread(race2);

            th1.Resume();
            th2.Resume();
        }

        private void btnabort_Click(object sender, EventArgs e)
        {
             Thread th1 = new Thread(race1);

            Thread th2 = new Thread(race2);

            th1.Abort();
            th2.Abort();
        } private void btnsuspend_Click(object sender, EventArgs e)
        {

            Thread th1 = new Thread(race1);
           
            Thread th2 = new Thread(race2);
          
            th1.Suspend();
            th2.Suspend();
        }

        private void btnresume_Click(object sender, EventArgs e)
        {
            Thread th1 = new Thread(race1);

            Thread th2 = new Thread(race2);

            th1.Resume();
            th2.Resume();
        }

        private void btnabort_Click(object sender, EventArgs e)
        {
             Thread th1 = new Thread(race1);

            Thread th2 = new Thread(race2);

            th1.Abort();
            th2.Abort();
        }


 {  
        private void Form1_Load(object sender, EventArgs e)
        {
            Control.CheckForIllegalCrossThreadCalls = false;
        }
    }
}

   


Monday, 18 January 2016

Introduction of ASP.NET

                        About asp.net

Asp.net is a wep applications framework developed and marked by Microsoft to allow programmers to build dynamic websites.

                  Definition of asp.net

Asp.net is a web development platform which provides a programming model, a comprehensive software infrastructure and various services required to build up robust web applications PC as well as mobile device. Asp.net works on top of the http command's and policies to set a browser to server bilateral communication and cooperation. Asp.net is a part of Microsoft .net platforms
ASP.NET is great for building standards-based websites with HTML5, CSS3, and JavaScript. ASP.NET supports three approaches for making web sites. ASP.NET Web Forms uses controls and an event-model for component-based development. ASP.NET MVC values separation of concerns and enables easier test-driven development. ASP.NET Web Pages prefers a single page model that mixes code and HTML markup. You can mix and match these techniques within one application depending on your needs - it's all One ASP.NET.

Thursday, 14 January 2016

stored procedure and multiple query in a single procedure.

Monday, 4 January 2016

reversing string and count string in c#.net


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 reversing_of_string
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        string str, revstring;
            int length;

        private void button1_Click(object sender, EventArgs e)
        {
          //  string sac;
            str = txtrev.Text;
            length = str.Length - 1;

            while (length>=0)
            {
               // sac = length + 1.ToString();
                revstring = revstring + str[length];
                length--;
             
            }
            MessageBox.Show(revstring);
        }
        private int getcount(string text)
        {
            int wordcount=text.Split(' ').Length;
            return wordcount;

        }

        private void button2_Click(object sender, EventArgs e)
        {
            int mm = getcount(txtrev.Text);
            MessageBox.Show(mm.ToString());

        }
    }
}