Want to become a Vibe Coder? Join Vibe Coding Training here
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Crop Image
WhatsApp
Prashant Nimbare
12y
5.8
k
0
0
25
Blog
cropeImage.rar
CROP IMAGE
First design your form in like Following form
drag 1 picture box and button from ToolBox
on click event button write following Code
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public static Image GetThumbnailImage(string path, int width, int height)
{
using (Image image = Image.FromFile(path))
{
Image.GetThumbnailImageAbort myCallback = new Image.GetThumbnailImageAbort(ThumbnailCall);
return image.GetThumbnailImage(width, height, myCallback, IntPtr.Zero);
}
}
private static bool ThumbnailCall()
{
return false;
}
private void button1_Click(object sender, EventArgs e)
{
pictureBox1.Image = GetThumbnailImage(@"C:\Users\Administrator\Desktop\roger.jpg", 200, 200);
}
}
}
run your application ., click on load button
you will get following output..
Crop Image
People also reading
Membership not found