0

Any help would be greatly appreciated. I have a pictureBox housed in a Panel. I'm overlapping the pictureBox with dynamic textBox's created by the user upon button click(ie. MouseEvent)

So far, I can do a few cool things, such as...drag the textBox(s) around within the pictureBox etc. (Here's where the problem comes in...PictureBox, Zooming In and Out when textBox(s) have been placed) Note: I'm using the Scroll Wheel for the Zooming.

I'm having a difficult time getting the textBox(s) size to proportionally change with the change in size of the pictureBox. Also, as the size of the pictureBox change, I'm sure the textBox location will also change. I'm guessing the textBox LocationEvent will play a part.

Any help would be great. Thanks all.

Federico Berasategui
  • 43,562
  • 11
  • 100
  • 154
  • Are you using winforms or wpf? Please add more information about your project as this will influence the answer. – Marko Oct 07 '13 at 17:36
  • 1
    @Marko there's no "PictureBox" in WPF. this is winforms. – Federico Berasategui Oct 07 '13 at 17:40
  • Hard to make sense of this. Why would the user enter *more* text when the image is zoomed? Just make the textbox a child of the PB and anchor it to the right so it is automatic. – Hans Passant Oct 07 '13 at 17:53
  • I'm using WinForms.... – Marine_Elite Oct 07 '13 at 18:43
  • So you zoom the picture and you want the TextBox to grow too? As if it were part of the image? – DonBoitnott Oct 07 '13 at 18:47
  • I'm using WinForms.... @Hans I'll try to clarify the reason...The user will have the ability to click anywhere on the image to place data(that's why I've chosen to create a dynamic textBoxs wherever user clicks). The image viewed is part of a system that has various weights. I will be providing real-time data to any of these dynamically created textBoxs. The user will be zooming in/out on parts of the system to insert weights where necessary. – Marine_Elite Oct 07 '13 at 18:55
  • @DonBoitnott yes, that is correct. Because If I zoom in/out. The textBox remains the same size and in the same location. So, I believe it isn't just the size that should change...but also the textBox location. – Marine_Elite Oct 07 '13 at 18:56
  • Then first, you'll have to be drawing it. So you need to inherit your own class from TextBox and take over all the drawing. This is going to be a mess. You have to scale it, draw it cleanly, and deal with font scaling while you're at it. You might want to rethink the approach...I doubt this goes well for you. – DonBoitnott Oct 07 '13 at 18:59
  • Dang...I thought it would be a simpler approach...@DonBoitnott for the feedback – Marine_Elite Oct 07 '13 at 19:07
  • I thought a proportion calculation between the picturBox and textBox(s), as well as the use of the textBox(s) LocationEvent would somehow solve my problem. – Marine_Elite Oct 07 '13 at 19:12
  • @marine_elite you might be interested in [My Example](http://stackoverflow.com/a/16947081/643085) of a similar thing using current, relevant .Net Windows UI technologies. – Federico Berasategui Oct 07 '13 at 20:51
  • @HighCore thanks for the reference. Later tonight or tomorrow I'm going to look at your example more closely. It def. looks like it could solve or come pretty close to solving my problem. Thanks a bunch! – Marine_Elite Oct 08 '13 at 00:51
  • Thanks again all. Not enough time in the day..I'll be working on this over the weekend... – Marine_Elite Oct 11 '13 at 05:52

0 Answers0