473,387 Members | 1,603 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

GDI+ move scroll zoom

Dear all,
I need a picturebox on which I can with GDI+ draw rectangles. The scroll and
zoom should be supported. Do I have to manually resize rectangles,when zoom
button clicked and change position when scroll done and redraw with new
coordinates? Is there some standard procedure for that? Any link or advice
is greatly appreciated.
Thanks,
Boni
Nov 21 '05 #1
3 3299
Boni, this should get you started.

Dim zoom As Integer = 1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
zoom += 1
PictureBox1.Invalidate()
End Sub

Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint
Dim rect As New Rectangle(10, 10, 50 * zoom, 50 * zoom)
e.Graphics.DrawRectangle(Pens.Blue, rect)
End Sub
"Boni" <oilia@nospam> wrote in message
news:uG**************@tk2msftngp13.phx.gbl...
Dear all,
I need a picturebox on which I can with GDI+ draw rectangles. The scroll
and zoom should be supported. Do I have to manually resize rectangles,when
zoom button clicked and change position when scroll done and redraw with
new coordinates? Is there some standard procedure for that? Any link or
advice is greatly appreciated.
Thanks,
Boni

Nov 21 '05 #2
Boni,

If the size of the image in width and height is not important and it is only
for showing you can use the picturebox.

If you want to keep things as they are, have than a look at the image sample
in VB 101 samples
http://msdn.microsoft.com/vbasic/dow...de/101samples/

I did not look in it however looking at the date is this the standard set
not especially for 2005

I hope this helps,

Cor
Nov 21 '05 #3
Ah, it is exactely what I would like to avoid.
With this approach I have to calculate zoom and scroll for each object
explicitely.
I thougth, that using transform matrix and working in absolute coordinates
would be better approach.
"Some Guy" <no*****@nowhere.com> schrieb im Newsbeitrag
news:eN**************@tk2msftngp13.phx.gbl...
Boni, this should get you started.

Dim zoom As Integer = 1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
zoom += 1
PictureBox1.Invalidate()
End Sub

Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint
Dim rect As New Rectangle(10, 10, 50 * zoom, 50 * zoom)
e.Graphics.DrawRectangle(Pens.Blue, rect)
End Sub
"Boni" <oilia@nospam> wrote in message
news:uG**************@tk2msftngp13.phx.gbl...
Dear all,
I need a picturebox on which I can with GDI+ draw rectangles. The scroll
and zoom should be supported. Do I have to manually resize
rectangles,when zoom button clicked and change position when scroll done
and redraw with new coordinates? Is there some standard procedure for
that? Any link or advice is greatly appreciated.
Thanks,
Boni


Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: black tractor | last post by:
HI there.. l was just wondering, if l place a "table" in the "editable region" of my template, will the text, graphics placed inside the this "table" MOVE BY ITSELF?? l mean, recently l had a...
12
by: Charles Law | last post by:
If I draw a rectangle, 6 inches by 2 inches, on a user control with a PageUnit of Inches, I get a rectangle of 7 by 2.2 inches. Is this what people would expect? I would have hoped that it was at...
12
by: NewSun | last post by:
I draw a grid on a panel.And panel1' property AutoScroll is set true.When HScroollBar is Scroolling,the grid is error. I have rewritten the mathod of WndProc.But the effect is unexpected. How can...
15
by: Wiktor Zychla | last post by:
today we've found a critical issue regarding the ListView from Windows.Forms. it was confirmed on several machines with Win2K and XP. here's the problem: create a ListView with about 50000 rows....
3
by: Just Me | last post by:
Using a Richtextbox I use EM_SETZOOM to set a zoom factor. If I set it to 2 the image on the screen increase but not exactly by 2. I've coded a ruler above the Richtextbox which does scale by...
1
by: johannblake | last post by:
I want to create a scrollable window using GDI+ where the origin is located in the bottom-left corner rather than the default top-left corner. Currently I have found several examples on how to...
0
by: davide rocchelli | last post by:
I have found a probable bug when you draw with GDI. Look this simple code Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint ...
1
by: Bishman | last post by:
Hi, I have been trying to get text to scroll smoothly accross a windows form using GDI+ and a timer. Changing the position of the text by a configurable amount and calling invalidate to force a...
0
by: johot | last post by:
I am currently creating a little photo application. In this application the user is able to zoom in the image and after zooming panning around inside the zoomed image with the mouse. The strange...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
Oralloy
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.