how can i do Zooming of a particular area using OnMouseWheel (that is zooming a mouse wheel point that should come into view with zoom ) using C#
Regards,
ALGATES
4 8556
What have you tried so far. We can help you help yourself, but we can't do your work for you.
MODERATOR
Dear Moderator(INSERT ALIAS)
This is the concept I am trying but i want scroll bar in that .how can acheive it .? http://www.codeproject.com/KB/graphics/PanZoom2.aspx?msg=2672101#xx2672101xx 01xx
I tried the concept of Autoscrollminsize and autoscrollposition but output is not working.
Please help me .If any thing which i done wrong in the previous post please forgive me.
Regards,
ALGATES
You can download the working source code from the top of the page that you linked. Try to download the source, study it, see if you can't figure out what you are doing differently, and then let us know.
You can download the working source code from the top of the page that you linked. Try to download the source, study it, see if you can't figure out what you are doing differently, and then let us know.
- using System;
-
using System.Collections.Generic;
-
using System.ComponentModel;
-
using System.Data;
-
using System.Drawing;
-
using System.Text;
-
using System.Windows.Forms;
-
-
namespace zoom_aug12
-
{
-
public partial class Form1 : Form
-
{
-
private Bitmap bmp;
-
Graphics grfbmp;
-
public Form1()
-
{
-
InitializeComponent();
-
-
bmp = new Bitmap(1000, 1000);
-
grfbmp = Graphics.FromImage(bmp);
-
Zoom =3F;
-
}
-
float _zoom = 1F;
-
public float Zoom
-
{
-
get
-
{
-
return _zoom;
-
}
-
set
-
{
-
_zoom = value;
-
UPDA();
-
}
-
}
-
public void UPDA()
-
{
-
this.AutoScrollMinSize = new Size((int)(bmp.Width*Zoom),(int)(bmp.Height*Zoom));
-
Refresh();
-
}
-
protected override void OnLoad(EventArgs e)
-
{
-
Rectangle rect = new Rectangle(0, 0, 999, 999);
-
Pen penblue = new Pen(Color.Blue);
-
grfbmp.DrawRectangle(penblue,rect);
-
base.OnLoad(e);
-
}
-
private Rectangle _drawrect = new Rectangle(0, 0, 1000, 1000);
-
public Rectangle DRAWRECT
-
{
-
get
-
{
-
return _drawrect;
-
}
-
set
-
{
-
_drawrect = value;
-
Refresh();
-
}
-
}
-
private PointF _viewportcenter;
-
PointF ViewPortCenter
-
{
-
get
-
{
-
return _viewportcenter;
-
}
-
set
-
{
-
_viewportcenter = value;
-
}
-
}
-
protected override void OnMouseWheel(MouseEventArgs e)
-
{
-
-
-
Zoom += Zoom * (e.Delta / 1200.0f);
-
if (e.Delta > 0)
-
-
ViewPortCenter = new PointF(ViewPortCenter.X + ((e.X - (Width / 2)) / (2 * Zoom)), ViewPortCenter.Y + ((e.Y - (Height / 2)) / (2 * Zoom)));
-
// DRAWRECT = new Rectangle((int)ViewPortCenter.X,(int)(ViewPortCenter.Y),(int)(Width/Zoom),(int)(Height/Zoom));
-
-
-
//base.OnMouseWheel(e);
-
}
-
protected override void OnScroll(ScrollEventArgs se)
-
{
-
DRAWRECT = new Rectangle(0, 0, 1000, 1000);
-
base.OnScroll(se);
-
}
-
protected override void OnPaint(PaintEventArgs e)
-
{
-
Graphics g = e.Graphics;
-
g.DrawImage(bmp, this.DisplayRectangle, DRAWRECT, GraphicsUnit.Pixel);
-
base.OnPaint(e);
-
}
-
}
-
}
I studied well and i am trying with autoScrollminsize ,but scroll bar is not coming accurately.please help me.
Regards,
ALGATES.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: AccessWhiz |
last post by:
I have been trying desperately for the past few days to figure out why
the MouseWheel solution that I retrieved from the Lebans website won't
work. The access database included with the solution...
|
by: Jack |
last post by:
Gday everyone,
I'm dearly hoping Stephen Lebans is going to update his masterpeice to
stop the mouse wheel scrolling to work on subforms *he has indicated
this to me but of course beggers can't...
|
by: jv |
last post by:
I have quite a few of continuous form and subform where I do allow
scroll bars. I run into problems with the mouse wheel whenever the
data on the form does not take up the whole page. In this...
|
by: CaptainWillard |
last post by:
I am having a problem with Access 2000 for which I can't find an
answer. My project opens a form with a new record, and one of the
controls on the form is a combo box. If a user tries to navigate...
|
by: Nathan |
last post by:
Hi,
Can someone lead me to info on detecting and using the mouse button? All I
can find in the MSDN docs is that you use e.Delta, but it doesn't explain in
how. I tried detecting the roll of...
| |
by: ML |
last post by:
I am trying to use the mouse wheel event on a numeric input box to allow the
use to scroll to inc/dec the value by 1. The issue I am having is that the
delta value returned seems to be off. From...
|
by: Martijn Mulder |
last post by:
When the mouse is over a picture, the user can grow or shrink it by rolling
the central mouse wheel. What behavior is typical when the user rolls the
wheel away. Will the picture grow or shrink...
|
by: sandeepshetty |
last post by:
hi all..
Can anybody help me out on how zooming can be done on images in web applications but only by using mouse wheel and scroll bars.. thank u..
...
|
by: West55 |
last post by:
I have an Access 2003 database I developed for one of my departments. I have been using Stephen Lebans' MouseWheelOnOff system to turn off the Mouse Wheel without any issues since I developed the...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |