Position of PictureBoxes in form design window do not correspond to their position during runtime - vb.net

EDIT: I realized that I didn't tag this properly - I should have included vb.net as a tag, on the grounds that there could be a code based solution. Note, that no changes to the resolution are made in my source code.
UPDATE: When the program starts execution, the left coordinate for each PictureBox is multiplied by ~0.376, whilst the top coordinate for each PictureBox.Top is multiplied by ~0.418 . This "down-scaling" applies to all picture boxes. The source code I have is incredibly rudimentary and cannot be responsible for this. I also looked at another project and I still face the same error. A simple but poor fix would be to divide each coordinate by the corresponding values mentioned above.
In order to show you the issue I'm facing, please look at the images below. Compare this image, where each PictureBox (i.e. a snake, set of arrows, etc.) has been placed so that they line up with a feature of the background image:
To this image, where the PictureBox elements are bunched together. Their positions have been "down-scaled" closer to the origin of the form (note that all the elements are transforming horizontally during runtime, which is why the elements are in the top right corner):
In the solution I was given (developed in VS 2010 I believe), the position of each PictureBox goes beyond the background image as shown:
It is clear that each picture box has been placed in an organized fashion. During execution, each PictureBox goes to it's intended position (i.e. lines up appropriately with the background image).
Obviously, the original developer of the solution I was given would have not faced the problem I am. The fact that the solution works properly during runtime indicates some kind of error with my instance(s) of VB. Does anyone know of any solutions?
I've came across this question which asks how to change the default resolution for a Windows 8 App and this question which asks why some applications appear differently on different machines, but they pose no clear solutions. I would appreciate any help, since it's holding me back from critical work I must do. Thank you in advance!

I feel a little silly now - I started carrying out a bit more research on VB forms and came came across this Microsoft documentation on form scaling. Realizing that my issue may have been caused by having this scaling automatically carried out, I then found the AutoScaleMode property of my form and changed it from Font to None, which resolved my problem.

Related

How to create "menu grid" in kotlin

I have searched google/stackoverflow etc. for answer to my question, but I didn't quite manage to find the right one. I believe I just don't know, how to set the question properly, and thus I cannot find solution.
Is there any way, how to create grid like I drawed in following image (with red colour):
I need to add this red grid to several images, which look very simmilar. The grid field (the one selected) have rolling menu, prescribed position, and a field for additional text. Black lines in background are image in background, and the red supposed to be grid above the image. I thought of creating a lot of buttons alined to each other, but i think that is very bad way to do so.
I would like a pop-up menu from selected field, but opening new activity with same fields is usable aswell. Is there any "simple" solution for creating such grid/menu ?
Btw, I am not programmer with many experience with coding, let's say, I know basics only.
Thanks in advance.

Working Area showing incorrectly in VB.net

So I am trying to get the screen size without the taskbar, and through reading around I found that the only reliable way was to get the "working area" of the screen (Especially since I might be using multiple screens.), then subtract it from the screen size
Now, my issue is that the working area I am getting is equal to the screen size, which means it is not showing my the actual working area. I have tried some different solutions, and the codes are straight forward.
Dim workingArea = My.Computer.Screen.WorkingArea
This would give me back 1920x1080 which is the same as my resolution. I am not using an auto hide taskbar, and I am not sure what's the issue with this, and/or if there is a better way to do what I am trying to do.
Edit: I have tried to use the DPI aware as per the last comment (following the steps in Using SetWindowPos with multiple monitors)
I am quite confused why I am not getting the correct number here, any feedback is appreciated.
Edit2:I have tested this code itself in another PC and it was a similar result, I will attempt to install an older version/newer version of visual studio or another .net version, however the issue is still illogical, and no solutions seem to be working (with one or more screens having the exact same feedback.)
Edit3: The task bar does not hide, testing the numbers still shows the same regardless of the number of screens, different resolutions were the same as well.

Bypass/replace event/handler for a VB.NET Windows Forms control I didn't create?

I'm working on a project that has needed a TreeView control with multiple columns. After research looked like a custom control was necessary, and to my luck I found a good one on CodeProject: https://www.codeproject.com/Articles/26849/The-TreeListView-To-End-All-TreeListViews
I've been leaning on this control heavily but have run into a few bugs that have been very challenging to work around given that I can't actually access the source code in the project files the developer was kind enough to share. The main issue I'm dealing with is a crash that pops up when the control is resized almost to the point to where a horizontal scrollbar would need to appear. I noticed that when resizing there is a deadzone of about 10 pixels where this control would show the horizontal scrollbar slightly before you'd need to, likely because of weirdness in measuring the indenting widths of child tree nodes. In this state the scrollbar appears, the scroll box fills the entire bar and won't allow you to scroll left or right.
This doesn't bother me other than the fact that if you use your mouse scroll wheel in this state it throws an ArgumentOutOfRange exception and pulls my application down:
Value of '-1' is not valid for 'Value'. 'Value' should be between
'minimum' and 'maximum'.
I'd love to be able to handle this exception but I'm quite new to VB.NET and Windows Forms and am still learning how events are handled. If there is a straightforward way to override the OnMouseWheel event or otherwise handle errors that may be triggered from it that would be fantastic. That or any other suggestions the community may have would be greatly appreciated.
If helpful, here is the top part of the error's StackTrace:
System.Windows.Forms.ScrollBar.set_Value(Int32 value)
WinControls.ListView.ContainerListView.OnMouseWheel(MouseEventArgs e)
The ListTreeView control (one I'm using) inherits from ContainerListView. ContainerListView's OnMouseWheel event is protected. Does this mean that I won't be able to override it?
Thanks, and happy to provide any other information that is needed.

How to add scrolling option on component parameter GUI?

I'm using Dymola but I expect OpenModelica might very well be the same (or at least similar).
For a given component model sometimes it makes more sense to have lots of parameters shown on one "tab" of the parameter GUI. This can lead to an excessively long GUI which, for many reasons including for psychological reasons in relation to how humans process information, is not a appropriate solution.
To solve this I would like to add a vertical scroll bar on the parameter GUI. I believe I saw it once though I cannot recall exactly where.
For illustrative purposes look to the right side of your web browser window. That gray bar that goes up and down is the scrollbar :). I know, obvious but you never know.
I assume I need to put some command in an annotation somewhere though where and what command I am not sure. For example, I found some reference to a verticalScrollBarPolicy but alas, I can not find any documentation on this.
Anyone know how to do this?
EDIT #1:
Dymola (and Adrian indicated OpenModelica as well) will automatically create the scroll bar when the GUI gets larger than the screen. Unfortunately (at least in Dymola) there is little margin so if you GUI is a fraction smaller than the window the "OK" button will be covered by the ribbon on the bottom of the screen and the GUI will be needed to made slightly larger to make the scroll bar appear automatically. This is a reason why a manual option for a scrollbar would come in handy.
I think additional "tabs" might help?
As far as I know in OpenModelica we have a scroll bar for that dialog windows if the window would expand out of the screen.
As of this posting my understanding based on feedback on this forum, my own experience, and from additional discussions with others there is no current manual control of the GUI (i.e., size, scrollbars, etc.).
Your best bet if you come across issues (e.g., you have a super small 2nd monitor) is to use lots of tabs and keep descriptions very short (which is probably appropriate for most applications anyways).
This is a Dymola and OpenModelica issue not a modelica issue as it is not contained in the modelica specification (as I understand it).
If this changes and I find out about it I'll remove or update this post.

BitBlting with Windows Aero

For months now, I have been trying to solve a problem regarding rendering images properly onto Aero glass. From what I have gathered so far, to do this you need to render the graphics object as a bitmap, because the Aero requires an alpha channel. To be more specific, what I am trying to do is make a perfect, non-flicker text box ( and other controls). I do not want to fall back to rendering part of the form aero, as I may want more than one text box. Also, the DrawToBitmap function works, but is far too slow, which is why I want to accomplish this with BitBlt.
What I have right now, is the Graphics control of a TextBox, stored as a IntPtr. How do I take this graphics control, load it into a Bitmap, and draw that Bitmap with BitBlt? (or as the link suggests, fixing the alpha value of the Graphics object)
So my question is, is there anyway to do this with Visual Basic 2010 .NET?
If anyone can answer this question, provide input, or a equivalent alternative, I'd be very grateful.
Here is a link to a previous thread I have made, which describes the problem in much more detail:
http://social.msdn.microsoft.com/Forums/en-US/Vsexpressvb/thread/f0e9fa0c-9535-4cdb-826f-673ef58c408a
Best regards,
Jake M.
P. S.
This link has helped greatly, and addresses my problem. However the solution on the very last post seems to be what I am looking for, however I have no idea how to convert that into visual basic.
Aero: How to draw solid (opaque) colors on glass?