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 8563
What have you tried so far. We can help you help yourself, but we can't do your work for you.
MODERATOR
Dear Moderator(INSER T 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?m sg=2672101#xx26 72101xx 01xx
I tried the concept of Autoscrollminsi ze and autoscrollposit ion 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 autoScrollminsi ze ,but scroll bar is not coming accurately.plea se 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 responds to the
the wheel regardless of the button. In my application I get an error
message when I try to set the class. I'm hoping that I can get some
help (cause I feel really stupid right now).
Before we go too much further, I am using a...
|
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 be choosers here so I have no
idea when this would be done*. I'm just wondering if anyone has gotten
around the problem some other way?
--Original Thread---
|
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 instance,
whenever a user uses the mouse wheel to scroll down, the first record
disappears off the screen and they can't get it back unless they click
on the Refresh button or Page Up. The mouse wheel never scroll back up
to the first record. ...
|
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 the
combo box choices using the mouse wheel, the wheel mouse scrolls
through all the records in the table the form is bound to. The combo
box is still open, but the user ends up thinking all the data on the
main form has changed. Is there any...
|
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 the wheel in the frm.MouseDown, but it
didn't detect it.
Thank for the help.
| |
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 my understanding the delta is
the number of detents the mouse has moved. The standard detent is
supposedly 120 for one notch of the wheel, however when I turn the wheel 1
click I get 240. Is there someway to determine the actual detent setting...
|
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 then?
|
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..
sandeep.
|
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 database. Recently my IT department replaced all the PCs and now I am having issues with the Mouse Wheel Off.
If one of the radio buttons has focus, the mouse wheel works and scrolls to the next record. If one of the text boxes has focus, the mouse...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
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 we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |