Question

Q1. Create a Windows Form or MFC Dialog-based application that reads and displays an image, and...

Q1. Create a Windows Form or MFC Dialog-based application that reads and displays an image, and then uses a slider to resize it from 0 to 100% size (zoom out but at different levels)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Following is the C# code for a windows form that loads a image and resizes it according to a slider. Screenshots of successful execution are included at the end for better understanding.

C# CODE:

using System;
using System.Drawing;
using System.Windows.Forms;
 
namespace ImageForm1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
 
        private void Form1_Load(object sender, EventArgs e)
        {
 
        }
 
        private void pictureBox1_Click(object sender, EventArgs e)
        {
 
        }
 
        /*Resizes Image*/
        private void trackBar1_Scroll(object sender, EventArgs e)
        {
            pictureBox1.Size = new Size(trackBar1.Value, trackBar1.Value);
        }
 
        /*Loads Image*/
        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog op = new OpenFileDialog();
 
            if (op.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                pictureBox1.ImageLocation = op.FileName;
            }
        }
    }
}

SCREENSHOT:

1. PictureBox : Properties

2. TrackBar : Properties

Note: Since my Screen Resolution is 720 pixels I Have set the Maximum value to 720.

3.Different states with different Sizes

Image at 100%:

Image at 0%:

Feel free to ask doubts related to this answer in the comments section below, and do leave a thumbs up if this helps.

Add a comment
Know the answer?
Add Answer to:
Q1. Create a Windows Form or MFC Dialog-based application that reads and displays an image, and...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Integer Math- Console based---uses Windows Form in Visual Basic   Create an application that uses random integers...

    Integer Math- Console based---uses Windows Form in Visual Basic   Create an application that uses random integers to test the user’s knowledge of arithmetic. Let the user choose from addition, subtraction, multiplication, and division. The integers used in the problems should range from 20 to 120. When giving feedback, use color to differentiate between a correct answer response, versus an incorrect answer response. Also check for non-integer input. Preparing division problems requires special consideration because the quotient must be an integer....

  • Using Windows Form App create an application that determines if an entry from the user is...

    Using Windows Form App create an application that determines if an entry from the user is a palindrome. A palindrome is a series of numbers that can be read from left to right or right to left. Examples of palindromes are 22222, 12321 and 89298. A palindrome must be 5 digits long. Using modulus and division evaluate digits one at a time from right to left. The user should enter their palindrome into the palindrome checker application using a text...

  • Create an application in Visual Studios 2015 that displays the result of dividing the larger of...

    Create an application in Visual Studios 2015 that displays the result of dividing the larger of two numbers entered by the user by the smaller one. You can not label entries of one must the larger on the user interface. You must use your known logic to determine which number is larger of the two entered by the user to perform your calculations. ¢ If the smaller number is 0, the application should display the message "Cannot divide by 0"...

  • Create a windows form application in c# The form must look like a calculator and do...

    Create a windows form application in c# The form must look like a calculator and do the following. Add, subtract, multiply, and divide. Account for division by zero. Show at least two decimal places. Retain the last number on the window so that, when the user opens the calculator the next time, the number that was in the window at the last close appears. Have a memory, so that users can store values and recall them. Operate with a mouse...

  • **This program is to be created using Visual Studio C#**Create as a Windows Form application** 1....

    **This program is to be created using Visual Studio C#**Create as a Windows Form application** 1. Output a header in the console: "Program 1" 2. Next you will ask the user to enter three floats and read the values into variables. 3. Perform addition, multiplication, and division examples with the numbers entered. 4. Implicitly cast the floats into doubles. 5. Explicitly cast the floats into ints. 6. Use conversion methods to convert the floats into strings. 7. Ask the user...

  • For this week's assignment , please create an application following directions in the attached document.(windows form...

    For this week's assignment , please create an application following directions in the attached document.(windows form application) Create a base class named Account and derived classes named SavingsAccount and CheckingAccount that inherit from class Account. Base class Account should include one private instance variable of type decimal to represent the account balance. The class should provide a constructor that receives an initial balance and uses it to initialize the instance variable with a public property. The property should validate the...

  • C# Windows Form Application (CALCULATOR): (This is the instruction below): Windows Calculator that will going to...

    C# Windows Form Application (CALCULATOR): (This is the instruction below): Windows Calculator that will going to create a Windows Form Application that will mimics a calculator. This is the screenshot how it shouldl look like. Calculator It should have a textbox and the following buttons: + Addition - Subtraction * Multiplication / Division = Equals (Will perform the final calculation) C Clear (Will clear the text box) There will be no maximize or minimize buttons. The rules are these: 2...

  • Image Class: Computer Vision (Allegro Application)                        (10 marks) Computer Vision is the process of analyzing input...

    Image Class: Computer Vision (Allegro Application)                        (10 marks) Computer Vision is the process of analyzing input images to detect, track, recognize, and react to objects. Edge Detection is a common task in computer vision where the program detects the boundary of an object. This boundary is then used to identify the shape of the object and eventually recognize the object. Consider the Imager class in Module 3. Create a new class based on Imager called Imager2 with three new functions:...

  • I started this with a windows form, however, based on the answer to this post yesterday,...

    I started this with a windows form, however, based on the answer to this post yesterday, they started it out differently than I did, is it with a console app? In need of direction as the small detail can make a big difference.   " //--------- Annuity.cs ---------- using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; [Missing] Using System.Windows.Forms; ** namespace assignment { public class Annuity { private double annuityNumber; private double depositAmount; private double term; private double currentBalanace;...

  • You are to create a new application that will execute on your Arduino platform based upon...

    You are to create a new application that will execute on your Arduino platform based upon the Blink example that is available in the Arduino Examples folder that you downloaded as part of the IDE. Your application will use a toggle switch to interface with the user. The application will operate by controlling the LEDs based upon the position of the toggle switch. If the user moves the LEDs until new user input is provided. When the user moves the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT