Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Drawing;
- using System.Windows.Forms;
- namespace R808ImagenVistaReducida
- {
- public partial class Principal : Form
- {
- private Image imagenVistaRedida;
- public Principal()
- {
- InitializeComponent();
- }
- private void Principal_Load(object sender, EventArgs e)
- {
- using (Image imagen = Image.FromFile(@"Resources\VisualStudio-Logo.jpg"))
- {
- int anchoVistaReducida = 0;
- int altoVistaReducida = 0;
- if (imagen.Width > imagen.Height)
- {
- anchoVistaReducida = 200;
- altoVistaReducida = Convert.ToInt32(((200F / imagen.Width) * imagen.Height));
- }
- else
- {
- altoVistaReducida = 200;
- anchoVistaReducida = Convert.ToInt32(((200F / imagen.Height) * imagen.Width));
- }
- imagenVistaRedida = imagen.GetThumbnailImage(anchoVistaReducida, altoVistaReducida, null, IntPtr.Zero);
- }
- }
- private void Principal_Paint(object sender, PaintEventArgs e)
- {
- e.Graphics.DrawImage(imagenVistaRedida, 10, 10);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement