473,659 Members | 2,671 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

image update

I'm having problems on drawing an image inside a picturebox. The situation is
this:
I have a picturebox with an image.whenever i click the mouse right button,
another picturebox will appear on top of the first one an will zoom a part of
the image (200px width and 200 px height). It should create the efect of a
magnifying glass
the problem is that when i created the mousedown event, the image appeared
on the picturebox (but i don't know why, it only apeared the secound time the
button was clicked). When i had the picDraw_MouseUp event, the image stoped
apearing, because of the instruction:
picZoom.Visible = False
If i delete the picDraw_MouseUp and start using the picDraw_MouseMo ve event,
the same thing happens. Of course that my intention is to use all the events
listed here, but it seems that after a certain refresh is made to the
picturebox, the image stops apearing.
Does anyone know how to solve this situation? is there any explanation for
this? How can i solve it?
My thanks in advanced
Private Sub picDraw_MouseDo wn(ByVal sender As Object, ByVal e As
System.Windows. Forms.MouseEven tArgs) Handles picDraw.MouseDo wn
picZoom.Visible = True
picZoom.BringTo Front()
If e.X 100 Then
picZoom.Left = e.X - 100
Else
picZoom.Left = e.X
End If
If e.Y 100 Then
picZoom.Top = e.Y - 100
Else
picZoom.Top = e.Y
End If

picZoom.Width = 200
picZoom.Height = 200
picZoom.SizeMod e = PictureBoxSizeM ode.StretchImag e

Dim rectZoom As New Rectangle(picZo om.Left, picZoom.Top, 200, 200)
Dim rectDestino As New Rectangle(0, 0, 200, 200)
Dim grTmp As Graphics = picZoom.CreateG raphics()
Dim imgImagem As Image = picDraw.Image
grTmp.DrawImage (imgImagem, rectDestino, rectZoom, GraphicsUnit.Pi xel)

m_bolZoom = True
End Sub

Private Sub picDraw_MouseMo ve(ByVal sender As Object, ByVal e As
System.Windows. Forms.MouseEven tArgs) Handles picDraw.MouseMo ve
If e.Button.Right And m_bolZoom Then
Dim gt As Graphics = picZoom.CreateG raphics
Dim bmp As New Bitmap(picZoom. Width, picZoom.Height, gt)
If e.X 100 Then
picZoom.Left = e.X - 100
Else
picZoom.Left = e.X
End If
If e.Y 100 Then
picZoom.Top = e.Y - 100
Else
picZoom.Top = e.Y
End If
picZoom.Image = bmp
'picZoom.Refres h()
Debug.Print(pic Zoom.Image.Widt h)
Debug.Print(pic Zoom.Image.Heig ht)
Exit Sub
End If
End Sub
Private Sub picDraw_MouseUp (ByVal sender As Object, ByVal e As
System.Windows. Forms.MouseEven tArgs) Handles picDraw.MouseUp
If m_bolZoom Then
m_bolZoom = False
picZoom.Visible = False
End If
End Sub

Jan 23 '07 #1
0 996

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

Similar topics

3
11753
by: dave | last post by:
Hello there, I am at my wit's end ! I have used the following script succesfully to upload an image to my web space. But what I really want to be able to do is to update an existing record in a table in MySQL with the path & filename to the image. I have successfully uploaded and performed an update query on the database, but the problem I have is I cannot retain the primary key field in a variable which is then used in a SQL update...
5
2943
by: Roger Withnell | last post by:
I'm updating a record by opening a recordset, setting the fields and the updating it with objRS.Update. I need to set an image datatype to NULL. objRS("field") = NULL works for datatypes int and varchar but not for datatype image, although there is no error - the image field still contains the image! I'm using SQL server and running an UPDATE statement including image = NULL works.
2
21361
by: Tinius | last post by:
I am trying to update a field of type IMAGE. I am able to do this by deleting the record and then INSERTing a new record as shown below in the commented section. But I really want to do this with an UPDATE command as shown below in the un-commented code. I assume this is possible. The image is passed as a byte array called 'content'. I then want to update the column STREAM with the new 'CONTENT'.
1
2497
by: John Thompson | last post by:
We're sooo close. When we load the page to upload the image, all of the prms go through except the binary image data. Using SQL server with the data type set to "image". Please help! Thanks- John
7
11613
by: lgbjr | last post by:
Hello All, I¡¯m using a context menu associated with some pictureboxes to provide copy/paste functionality. Copying the image to the clipboard was easy. But pasting an image from the clipboard is proving to be more difficult. These pictureboxes are bound to an AccessDB. If the user wants to add an image, they select an image using an OpenFileDialog: Dim result As DialogResult = Pic_Sel.ShowDialog() If (result = DialogResult.OK) Then
3
2786
by: JpMaxMan | last post by:
Greetings - I have found very little definitive information on this. From what I can surmize at some point the ability to update an image in the gridview using the imagefield was removed from the final version of asp.net 2.0? If this is the case, does anyone have any work arounds for how to use a edit template to allow a user to browse and upload a replacement image when editing a row? If this is not the case, what is the trick to get...
4
6313
by: jens Jensen | last post by:
Hello, I have an image file name in a table that a let users modify via a GridView/DetailView pair. * The actual image file is saved in the image folder of the application. But the image is rendered in a templatefield 's <itemtemplate> on the detailsview. In the <edititemtemplate> i have a fileupload control . leting users upload a new picture and thus replace the old one.
9
1865
by: Mark Denardo | last post by:
This is related to another post I submitted, but I'll be more precise this time. I have a web page that contains an Image webcontrol that loads its image by: Image1.ImageUrl="<username>.jpg", and an option for the user to update the photo. If they click the update button, I then flip up a new panel, where I have a FileUpload control and corresponding Upload Button. If they load an image file and click the Upload button, my code uses...
1
1419
by: chuckylefrek | last post by:
I have a page that allows users to update their data. One of the items of data is an image. Therefore the update page includes an <input type="file"> field to allow them to choose a different image. The problem is, that if the user does not want to change the image and leaves this field blank, when they press the submit button, it updates the database and removes the name of the previous image the user had uploaded. There are 5 images...
0
1993
by: aris1234 | last post by:
hello.. How to upload image file in page update ..?? i have logic like this : if user upload new image then old image must delete and update DB used new name if user not upload new image then old image no delete. code form like this (i dontknow this code right or wrong, please correction if wrong) :
0
8751
jinu1996
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...
1
8535
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8629
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7360
agi2029
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...
1
6181
isladogs
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...
0
5650
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4338
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1982
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1739
bsmnconsultancy
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...

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.