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.
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...
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
Create an ASP.Net Website using Visual Studio with C#: Create a simple calculator that has 3...
Create an ASP.Net Website using Visual Studio with C#: Create a simple calculator that has 3 text boxes: 2 of them to enter numbers, the 3rd one displays the results Create 4 buttons to add, subtract, multiply, and divide Prevent the user from entering text in the number fields Display a message indicating “cannot divide by” when the user click “/” and there is a zero the in the second box Create two additional buttons: - One to store data...
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...
b. An investor wants to create a portfolio of three stocks form a set that consists...
b. An investor wants to create a portfolio of three stocks form a set that consists of 5 defense companies, 4 transportation companies and 6 healthcare companies. If the investor picks the three stocks at random, what is the probability that all three stocks will be from different industries. c. In part (b), what is the probability that at least two out of the three stocks picked will be from different industries?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT