TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Faisal Ansari
NA
451
830.4k
How to Fit image (stratch) with this functionality ???
Sep 4 2012 12:57 AM
i have an pictureBox with panning features, but i i want to add fit image feature like stratch image ,, how can i do this ???
code is here ..
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 PanningImageDemo
{
public partial class Form1 : Form
{
private Point startingPoint = Point.Empty;
private Point movingPoint = Point.Empty;
private bool panning = false;
Image img;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
img = Image.FromFile("D:\\Drawings\\dwg\\638.tif");
pictureBox1.Size = img.Size;
}
private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
{
panning = true;
startingPoint = new Point(e.Location.X - movingPoint.X, e.Location.Y - movingPoint.Y);
}
private void pictureBox1_MouseUp(object sender, MouseEventArgs e)
{
panning = false;
}
private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
{
if (panning)
{
movingPoint = new Point(e.Location.X - startingPoint.X, e.Location.Y - startingPoint.Y);
pictureBox1.Refresh();
//pictureBox1.Invalidate();
}
}
private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
e.Graphics.DrawImage(img, movingPoint);
}
}
}
Reply soon
Thanks
Reply
Answers (
0
)
Panning Image ???
Image Zoom in with draw rectangle ???