How To Make A Simple Magnifier In C#

Today we are going to make a simple magnifier in visual c# so let's continue. If you don't know what is a magnifier?.
A screen magnifier is software that interfaces with a computer's graphical output to present enlarged screen content. It is a type of assistive technology suitable for visually impaired people with some functional vision; visually impaired people with little or no functional vision usually use a screen reader. Wikipedia
Actually we are going to make a screen magnifier not just a magnifier the word magnifier refers to a scientific instrument.


You have a magnifier in your windows : go to this directory C:\Windows\system32\Magnify.exe or else you can go to start > all programs > accessories > ease of access > magnifier

Now we are going to create something which looks like the below image.


Drag and drop a picturebox into the form and set it to the form after that put a timer and change the enabled property to true and set the interval to 100 .

Time to codings and just double click your form and put the codes in //
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;

//Author : Mohamed Shimran
//Blog : http://www.ultimateprogrammingtutorials.blogspot.com

namespace Magnifier
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        Graphics g;
        Bitmap bmp;
        private void Timer1_Tick(object sender, EventArgs e)
        {
        bmp = new Bitmap(250, 200);
        g = this.CreateGraphics();
        g = Graphics.FromImage(bmp);
        g.CopyFromScreen(MousePosition.X - 100, MousePosition.Y - 10, 0, 0, new Size(300, 300));
        PictureBox1.Image = bmp;
        }

        
    }
}
Now debug and check whether it's working or not.

Post a Comment

Note: Only a member of this blog may post a comment.