I’ve been transfering my Desktop App using vb to the Wisej platform to develop a web app. I’ve found some anomalies. My first discovery was the unreliability of some of the Application.Session global variables. Some seem to work fine but others seem to lose their value. I learned that cookies are more reliable, but that begs the question of how many cookies can I load for a session, minor issue. My question is regarding the behavior of the picture box in a browser; the picturebox.width, and .height, plus the e.x and e.y coordinates from the mouse move event handler in particular. The problem may be with the session variables I use but it more likely is with the way the Picturebox is handled in the browser. Multiple functions for various purposes use the mouse coordinates so they need to be stored in global variables. The problem is that the e.x and e.y coordinates don’t translate into the proper result with reference to the picturebox. My process:
Using Drawing.Graphics I draw a cross pattern of light blue lines (vertical and horizontal) that are scaled to be 1 foot apart on a bitmap and load it to the picture box. My first inkling of a problem was that, using the Picturebox.width and .height attributes the lines don’t fully fill the picture box as they do on my desktop version; same code. The next issue is that using the mousemove handler I track the position of the cursor and display it in text boxes for the scaled x and y positions. Once the mouse move handler is called the background on the picture box (blue lines) shift. Can’t explain that since the code to draw and load the blue lines is reused as it was the first time. The mousmove event calls the draw function which loads the bitmap again and updates the position boxes. There is an origin point drawn on the bitmap line pattern which should indicate the mouse cursor is at a 0-x, 0-y position but there is an error. Again this works perfectly in the desktop version and I’ve used this drawing code in several apps.
So, short of sharing my code (which I am willing to do) there may be a known behavior using a picture box in a browser that I need to understand. It seems to me that there is a disjoint between the picture box attributes in a browser versus the way it works on a windows form. My code allows the user to mouse over the picture and see the relative coordinates, but more importantly there are items that are to be drawn to scale and positioned as well.
It would be great if there were a resource to understand how to use a picturebox’s dimensions inside of the browser. My inkling is that the shift I mentioned is something I could anticipate and correct for but I don’t have any metrics for that.
Thanks very much!
Gerry
I think I’ve found the issue. Thanks for your help!
Gerry
Thanks for the prompt response. I guess I should have added the possibility of pilot error to my problem :). I can’t seem to upload a zip version of the Solution. I tried to make it smaller by removing the wisej dll from the bin folder but your site still says forbidden. Please let me know how I can send this to you.
I very much appreciate your help on this!
Gerry
The size and coordinates of the PictureBox are exactly what Location and Size report in pixels. There is no difference.
Application.Session variables are 100% reliable. Cookies are a completely different thing.
This is an example of a winforms complex drawing app running in Wisej: https://watch.screencastify.com/v/uHQa3FLHAgtXKaure51E
If you send a small runnable sample we may be able to help further.
Please login first to submit.