i am using a picturebox in my application when i will scan a image it will comes to pictuebox. my poblem is how to zoom in zoom out that image or picturebox
5 28075
Hi Kumar,
below is a sample code on howto zoom-in and zoom-out.. hope it's useful to you.. good luck my fren.. :) -
There may be a way to this with a stretched image control, but this
-
seems to work OK. New project, 2 picture boxes, 2 command buttons:
-
-
Option Explicit
-
Private Const HALFTONE As Long = 4
-
Private Declare Function StretchBlt Lib "gdi32" (ByVal hdc As Long, _
-
ByVal x As Long, _
-
ByVal y As Long, _
-
ByVal nWidth As Long, _
-
ByVal nHeight As Long, _
-
ByVal hSrcDC As Long, _
-
ByVal xSrc As Long, _
-
ByVal ySrc As Long, _
-
ByVal nSrcWidth As Long, _
-
ByVal nSrcHeight As Long, _
-
ByVal dwRop As Long) As Long
-
Private Declare Function SetStretchBltMode Lib "gdi32" (ByVal hdc As Long, _
-
ByVal nStretchMode As Long) As Long
-
Private Sub Form_Load()
-
With Picture2 'source
-
.AutoRedraw = True
-
.ScaleMode = vbPixels
-
.Visible = False
-
' .AutoSize = True 'use if loading a graphic
-
Picture2.Print "Some Picture Box Text"
-
'or .Picture = LoadPicture("c:\somefolder\somegraphic.bmp")
-
End With
-
With Picture1 'dest
-
'I've heard this improves quality
-
SetStretchBltMode .hdc, HALFTONE
-
.AutoRedraw = True
-
.ScaleMode = vbPixels
-
.Move 0, 0, Picture2.Width, Picture2.Height
-
.Picture = Picture2.Picture
-
End With
-
Command1.Caption = "Zoom &In"
-
Command2.Caption = "Zoom &Out"
-
End Sub
-
Private Sub Command1_Click()
-
'zoom in by 20%
-
With Picture1
-
.Move 0, 0, .Width * 1.2, .Height * 1.2
-
.Cls
-
StretchBlt .hdc, 0, 0, .ScaleWidth, .ScaleHeight, Picture2.hdc, 0, 0,
-
Picture2.ScaleWidth, Picture2.ScaleHeight, vbSrcCopy
-
End With 'Picture1
-
End Sub
-
Private Sub Command2_Click()
-
'zoom out by 20%
-
With Picture1
-
.Move 0, 0, .Width * 0.8, .Height * 0.8
-
.Cls
-
StretchBlt .hdc, 0, 0, .ScaleWidth, .ScaleHeight, Picture2.hdc, 0, 0,
-
Picture2.ScaleWidth, Picture2.ScaleHeight, vbSrcCopy
-
End With 'Picture1
-
End Sub
-
Hi, I am new to this site and am having the same problem. i want to zoom in to my mandelbrot image but am having trouble on what the heck to do. I have one button to load the madelbrot and was hoping to click on the picturebox to zoom. please help.
Hi, I am new to this site and am having the same problem. i want to zoom in to my mandelbrot image but am having trouble on what the heck to do. I have one button to load the madelbrot and was hoping to click on the picturebox to zoom. please help.
One fairly simple technique is to place an Image control inside a picturebox control. Set the Stretch property of the Image control to True. Then load your picture into it, and just change the size of the Image control.
You can set up scroll bars and based on their values, MOVE the Image control around (remember you can move to locations lower than zero) to scroll, as well as zoom.
Have fun!
Hi, I am new to this site and am having the same problem. i want to zoom in to my mandelbrot image but am having trouble on what the heck to do. I have one button to load the madelbrot and was hoping to click on the picturebox to zoom. please help.
hi, i want to modify this code a bit and get the picture zoom within picture box please help me out.
hi, i want to modify this code a bit and get the picture zoom within picture box please help me out.
I believe you can do that by simply changing the size of the imagebox control which is displaying the image. As long as the Stretch property is True, the image will change size with it.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Francis Parsons |
last post by:
Hi! I'm doubtful there's a workaround for this problem, but it's
worth a shot. I'm using IE's (css) "zoom" property to zoom the body
of a document (in conjunction with persistance so the...
|
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
...
|
by: Mo Ade via .NET 247 |
last post by:
How do I write code to include a zoom feature in my project so that when my Vb Form loads an image I can click in my main menu zoom in or zoom out?
--------------------------------
From: Mo Ade
...
|
by: muisjepiep |
last post by:
hey
this code works in IE but not in FF
function ZoomFrames(obj)
{
if (isVisibleObject(document.getElementById("FRHEAD").style))
{...
|
by: Yoshitha |
last post by:
I'm developing windows application using c#.net (vs 2003), i've placed
several images (picture boxes) in panel control and i want to zoom the
panel control so that the images and text which...
|
by: jnag |
last post by:
I am trying to implement font changer, where I have links on the
banner of the site and when the user clicks on the links, the font
size of the page has to change. I tried...
|
by: murry19830507 |
last post by:
i want creat an web application(c#.net),which contains an image and one radiobutton list with 3 radiobuttons(zoom in ,zoom out ,zoom window)
when user checked on zoom in
imge has to be zoom
inthe...
|
by: sarika |
last post by:
Hi
I urgently need a script in php and ajax to pan and zoomin and zoomout
an image
plz help
|
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,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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
|
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...
|
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...
|
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,...
|
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,...
| |