Archived
1
0
This repository has been archived on 2026-03-24. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
SomeLab/CS/lab15/15_3/Form1.cs
2026-03-19 19:39:01 +08:00

53 lines
1.4 KiB
C#

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 _15_3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Open_Click(object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.InitialDirectory = @"C:\Users\BI\Pictures\Screenshots";
ofd.Filter = "Image Files|*.bmp;*.jpg;*.png;*.gif;*.jpeg";
ofd.RestoreDirectory = true;
if (ofd.ShowDialog() == DialogResult.OK)
{
pictureBox1.Load(ofd.FileName);
}
}
private void Center_Click(object sender, EventArgs e)
{
pictureBox1.SizeMode = PictureBoxSizeMode.CenterImage;
}
private void Stretch_Click(object sender, EventArgs e)
{
pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
}
private void Zoom_Click(object sender, EventArgs e)
{
pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
}
private void AutoSize_Click(object sender, EventArgs e)
{
pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize;
}
}
}