Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace WindowsFormsApp8
- {
- public partial class Form1 : Form
- {
- Button button1;
- Bitmap image1;
- PictureBox pictureBox1;
- public Form1()
- {
- InitializeComponent();
- // Указываем размеры и заголовок окна
- this.Text = "Rotate img";
- this.Size = new Size(700, 700);
- // Добавляем на форму кнопку
- button1 = new Button();
- button1.Text = "Rotate img";
- button1.Location = new Point(0, 0);
- button1.Size = new Size(70, 40);
- button1.Click += new System.EventHandler(button1_Click);
- this.Controls.Add(button1);
- // Добавляем элемент PictureBox на форму
- pictureBox1 = new PictureBox();
- pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
- pictureBox1.BorderStyle = BorderStyle.Fixed3D;
- pictureBox1.ClientSize = new Size(700, 700);
- // Добавляем изображение в элемент PictureBox
- image1 = new Bitmap("C://Users//arian//Desktop//4.jpg");
- pictureBox1.Image = (Image)image1;
- // Добавляем на форму элемент PictureBox
- this.Controls.Add(pictureBox1);
- }
- // Обработчик события, срабатывающий при нажатии кнопки
- void button1_Click(object sender, EventArgs e)
- {
- image1.RotateFlip(RotateFlipType.RotateNoneFlipX);
- // Повторно вставляем изображение в элемент PictureBox
- pictureBox1.Image = (Image)image1;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement