Click here to Skip to main content
15,918,624 members
Home / Discussions / C#
   

C#

 
QuestionBolt hscrollbar to a picturebox Pin
pcjd6320-Jan-09 6:15
pcjd6320-Jan-09 6:15 
AnswerRe: Bolt hscrollbar to a picturebox Pin
Dave Kreskowiak20-Jan-09 6:27
mveDave Kreskowiak20-Jan-09 6:27 
GeneralRe: Bolt hscrollbar to a picturebox Pin
pcjd6320-Jan-09 7:40
pcjd6320-Jan-09 7:40 
GeneralRe: Bolt hscrollbar to a picturebox Pin
Dave Kreskowiak20-Jan-09 8:09
mveDave Kreskowiak20-Jan-09 8:09 
GeneralRe: Bolt hscrollbar to a picturebox Pin
pcjd6320-Jan-09 8:21
pcjd6320-Jan-09 8:21 
GeneralRe: Bolt hscrollbar to a picturebox Pin
Dave Kreskowiak20-Jan-09 9:58
mveDave Kreskowiak20-Jan-09 9:58 
GeneralRe: Bolt hscrollbar to a picturebox Pin
pcjd6320-Jan-09 10:34
pcjd6320-Jan-09 10:34 
GeneralRe: Bolt hscrollbar to a picturebox Pin
Dave Kreskowiak20-Jan-09 11:04
mveDave Kreskowiak20-Jan-09 11:04 
pcjd63 wrote:
outer panel1 has Autosize = true,


Useless as you set the absolute size of the panel. Did you actually mean to say you set the AutoScroll property to true?


pcjd63 wrote:
the inner panel to 2000 (which is enough for all images).


You would normally set this inner panel to the same size as the image itself when you set it's background image property to the image.


pcjd63 wrote:
I click on a specific point on the right of the image I get the cursor position as 650,446. If I then scroll the image, but still keeping this point in view, clicking on it gives a cursor position of 340,446 (the point has visually moved to the left). The absolute value should be 650 + (scroll offset), not 340. Hope I'm making myself clear.


It would appear that you're handling the click event of the wrong panel. You need to handle the click of the INNER panel, not the outer one.

I've done this myself, creating a UserControl that does exactly this, and a lot more. Whenever you click on the image being viewed, it fires off an ImageClick event with the coordinates of the mouse click relative to the image, not the outer panel, and all I did was raise the new ImageClick event, reusing the MouseEventArgs.Location property given by the inner panel's Click event.


A guide to posting questions on CodeProject[^]



Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic
     2006, 2007, 2008




GeneralRe: Bolt hscrollbar to a picturebox Pin
pcjd6320-Jan-09 11:22
pcjd6320-Jan-09 11:22 
GeneralRe: Bolt hscrollbar to a picturebox Pin
Dave Kreskowiak20-Jan-09 13:40
mveDave Kreskowiak20-Jan-09 13:40 
GeneralRe: Bolt hscrollbar to a picturebox Pin
pcjd6321-Jan-09 2:37
pcjd6321-Jan-09 2:37 
QuestionSQL image to pdf in c# Pin
Saamir20-Jan-09 5:50
Saamir20-Jan-09 5:50 
AnswerRe: SQL image to pdf in c# Pin
Dave Kreskowiak20-Jan-09 6:31
mveDave Kreskowiak20-Jan-09 6:31 
GeneralRe: SQL image to pdf in c# Pin
Saamir21-Jan-09 3:39
Saamir21-Jan-09 3:39 
GeneralRe: SQL image to pdf in c# Pin
Dave Kreskowiak21-Jan-09 12:11
mveDave Kreskowiak21-Jan-09 12:11 
AnswerRe: SQL image to pdf in c# Pin
Giorgi Dalakishvili20-Jan-09 6:41
mentorGiorgi Dalakishvili20-Jan-09 6:41 
GeneralRe: SQL image to pdf in c# Pin
Saamir21-Jan-09 3:38
Saamir21-Jan-09 3:38 
GeneralRe: SQL image to pdf in c# Pin
Giorgi Dalakishvili21-Jan-09 4:48
mentorGiorgi Dalakishvili21-Jan-09 4:48 
Question[newbie] generating a new GUID Pin
jon-8020-Jan-09 5:41
professionaljon-8020-Jan-09 5:41 
AnswerRe: [newbie] generating a new GUID Pin
musefan20-Jan-09 5:49
musefan20-Jan-09 5:49 
AnswerRe: [newbie] generating a new GUID Pin
Ennis Ray Lynch, Jr.20-Jan-09 9:56
Ennis Ray Lynch, Jr.20-Jan-09 9:56 
GeneralRe: [newbie] generating a new GUID Pin
jon-8020-Jan-09 10:05
professionaljon-8020-Jan-09 10:05 
GeneralRe: [newbie] generating a new GUID Pin
Guffa20-Jan-09 11:06
Guffa20-Jan-09 11:06 
GeneralRe: [newbie] generating a new GUID Pin
PIEBALDconsult21-Jan-09 5:51
mvePIEBALDconsult21-Jan-09 5:51 
QuestionIConfigurationSectionHandler Pin
Patrick Skelton20-Jan-09 5:22
Patrick Skelton20-Jan-09 5:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.