Question

In: Computer Science

Using C#: Create a Form that consists of a PictureBox and 3 radio buttons. Assign an...

Using C#: Create a Form that consists of a PictureBox and 3 radio buttons. Assign an image of your choice to the PictureBox. Each radio button should be associated with a specific PictureBox size mode. When the user clicks on a specific radio button, the PictureBox's size mode should be changed to reflect the selection.

Solutions

Expert Solution

Below is the aolution

using System;
using System.Drawing;
using System.Windows.Forms;

namespace ResizePictureBox
{
    public partial class frmMain : Form
    {
        public frmMain()
        {
            InitializeComponent();
        }
        //radio button size100 click event
        private void Size100(object sender, EventArgs e)
        {
            pictureBox1.Size = new Size(100, 100); //set the picturebox size
            pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage; //stretch image
            pictureBox1.BorderStyle = BorderStyle.Fixed3D; //border style 3d
        }
        //radio button size200 click event
        private void Size200(object sender, EventArgs e)
        {
            pictureBox1.Size = new Size(200, 200); //set the picturebox size
            pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage; //stretch image
            pictureBox1.BorderStyle = BorderStyle.Fixed3D; //border style 3d
        }
        //radio button size300 click event
        private void Size300(object sender, EventArgs e)
        {
            pictureBox1.Size = new Size(300, 300); //set the picturebox size
            pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage; //stretch image
            pictureBox1.BorderStyle = BorderStyle.Fixed3D; //border style 3d
        }

        private void frmMain_Load(object sender, EventArgs e)
        {
            CenterToScreen(); //window center on the window
        }
    }
}

sample image:


Related Solutions

Using C#: Create a Form that consists of 4 checkboxes, three radio buttons, a label and...
Using C#: Create a Form that consists of 4 checkboxes, three radio buttons, a label and a button. The 4 checkboxes represent pizza toppings. The three radiobuttons should represent three sizes of pizza, namely “small”, “medium” and “large”. When the user clicks the button you need to calculate the price of the pizza. The calculation should be done as follows: count up the cost of the selected ingredients (you may assign your own prices for the ingredients) and then multiply...
Create a Java Swing form that will have two Buttons: (1) the first linked to an...
Create a Java Swing form that will have two Buttons: (1) the first linked to an event handler to write data from two TextFields on the form to an output file; and (2) the other with an event handler to read data from the same file as input and write output to a binary ObjectOutputStream file.
Create your own data type using a C++ structure. Assign values to a variable of that...
Create your own data type using a C++ structure. Assign values to a variable of that data type. Retrieve values from the variable of that data type. Description: In this lab you will choose the statements to create a program that: Creates a brand new data type called "Monster". Once created, creates a variable of type Monster and assign values to the variable and then display the contents. This lab will again take the form of a guided multiple-choice quiz...
PYTHON PROGRAMMING Using tktinker, create a gui that surrounds the code below that has buttons and...
PYTHON PROGRAMMING Using tktinker, create a gui that surrounds the code below that has buttons and labels and an overall theme. # Meet the chatbot Eve print('Hi there! Welcome to the ChatBot station. I am going to ask you a series of questions and all you have to do is answer!') print(' ') print('Lets get started') #begin questions firstName = input('What is your first name?: ') lastName = input('What is your last name? ') print("Hi there, ", firstName + lastName,...
In C create an array of 4 integers. Assign a pointer to the array. Use the...
In C create an array of 4 integers. Assign a pointer to the array. Use the pointer to find the average value of the elements in the array and display the results on the screen.
This is in HTML and JavaScript So I have 2 radio buttons One called students and...
This is in HTML and JavaScript So I have 2 radio buttons One called students and one called teacher. If the user selects the student then a list of check boxes these should appear. These should not be visable if the user selects the teacher radio button. - buy text books - visit teachers website - attend class If the user selects the teacher radio button then all the text boxes above should be hidden From the user. Then these...
Write an application with three radio buttons labeled “Cyan”, “Magenta”, and “Orange” that changes the background...
Write an application with three radio buttons labeled “Cyan”, “Magenta”, and “Orange” that changes the background color of a panel in the center of the frame to CYAN, MAGENTA, or ORANGE. This is required to be programmed in Java.
Using C# Windows App Form Create a simple calculator using +,-,*,/ Please show code GUI Code...
Using C# Windows App Form Create a simple calculator using +,-,*,/ Please show code GUI Code for calculator menus radio button input text boxes
using xsd, Create a number guessing game You would need an input box and buttons Ask...
using xsd, Create a number guessing game You would need an input box and buttons Ask the user for a number Produce a random number from 1-50 Do the comparison ​a. Make sure to provide hints back to the user if the number enter is low or high ​​-this element should be automatically added ​b. Clear the value enter in the text ​c. Give them 3 tries Whether the user wins or loses, display all the guesses along with the...
using xml, Create a number guessing game You would need an input box and buttons Ask...
using xml, Create a number guessing game You would need an input box and buttons Ask the user for a number Produce a random number from 1-50 Do the comparison             a. Make sure to provide hints back to the user if the number enter is low or high                         -this element should be automatically added             b. Clear the value enter in the text             c. Give them 3 tries Whether the user wins or loses, display all the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT