We have a wierd issue here.
We have a win-form application. The application has a tabbed form with few textboxs, combo boxes and 3 bottons. The application runs fine in most machines but in 1 machine the buttons are not visible .
Rest all are working fine. Just the buttons are invisible. But the button is present as Iam able to fire the event using tab and enter.
We have checked the log.but cannot find any exceptions logged.
We have checked various resolution but didnt help.
Any help ?
Buttons are at the bottom of the screen just above the taksbar. Taskbar is visible.
We have checked the dotnet frame work .Its fine
Issue is found in a Vista Machine
Thanks in Advance
My guess would be that the one machine has a different DPI setting. Perhaps it's pushing the buttons more downwards than they're supposed to be and that causes the buttons to disappear beneath the border of the form?
Also, I'd check the buttons' Anchor property to see where they're anchored to and that they're not moved around by weird window size to behind something else.
It could be that the buttons are not included in a tab which is on top of the buttons. Try making tabs (or various other controls) invisible to make sure the buttons not being obscured.
Setting the WrapContents to false on the FlowLayouPanel we were using, fixed a very similar issue.
The Buttons were near the bottom edge of the dialog box and would disappear in certain monitors resolutions. I think the WrapContents=false clips the buttons than completely removing them.
In my case I had login Panel where the height of it was depending on Main Form size, For example the height was Form size * 0.1.
The fix was to make the Login Panel resize its size depending on its components by setting loginPanel.AutoSize = true;
Related
I have a Winform I want to resize. Not after launching; I want to resize it in the designer by dragging the edges.
I am aware that I can change the size manually in the form properties. This is not what I want to do. I want to quickly size the default size of the form with my mouse.
The problem appears to be that I cannot grab the edges of the form for some reason. I repeat, this is NOT DURING RUNTIME. It is not that I have disabled/enabled Autosize/Resizing.
It's almost like the edge grabs are a single pixel wide and I just can't hit it. I don't know. I've looked for accessibility settings. The last thing I want to do is reinstall MSVS. It's just maddening.
I've attached a photo. The little boxes on the bottom, right, and bottom-right corner are my targets.
you can try to click the form title before resizing. I think you may have a panel (or any container control) which is full docked in the form, that's why when you click the form body, you selected the panel instead of the form.
Another issue that I encountered was the windows font size was set to 120% (or more), so go to windows display setting and set the font size to 100%.
I'm using Windows 10, Visual Studio 2017 and writing a C# Windows Form Application.
I have a windows form application that I am writing (partly in an attempt to get better at writing such things). I have designed my form nicely, with everything spaced and sized properly, but when I press F5 to start the form to debug it, I find that it loads at about 75% the size of the one I see in the designer.
This resizing seems a bit hit and miss, with buttons that were previously aligned no longer being so, and text no longer fitting in its spaces (see pic - the top part shows the designer and the bottom shows the actual form being run).
I would like to have the designer accurately reflect the final look of the form - does anyone know what is going on or how to avoid the problem? Everything I have looked at on the web talks about choosing to resize the form, not this enforced resize!
Have you changed the whole form font size? By default WinForms designer set
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
try changing the AutoScaleMode and see what happens.
I've experienced similar WinForms designer issues when the default Font (in the form property) size is not 8,25pt. I dont't know why but seems related to desktop and/or screen configuration. Not sure but some weird behaviours could be bugs (WinForms is now quite old...).
AutoScaleMode.Font means that form scaling is based on font size. So trying changing different font settings can solve the problem.
hope this help
When designing the form, the form automatically sets the anchor points to Top Left. You will have to set the anchor points to your form.
The anchor style works like this. On a control if you set anchor points to:
Top/Right then the control stays in the Top Right.
Top/Left then the control stays in the Top Left. Bottom/Right then the control stays in bottom right. Bottom/Left then the control stays in bottom left.
Top then it stays at the top.
Bottom then it stays in the bottom.
Left then it stays in the Left.
Right then it stays in the right.
Top/bottom stretches top to bottom.
Left/Right stretches left to right.
Now when you anchor a control to any of those combinations they will stay in that location when form is maximized. Controls can anchor to each other as well.
I hope this helps.
Also here is a tutorial I did on this.:
https://youtu.be/wlZ6pt79v1E
accurately reflect the final look of the form
Your form's appearance is mostly decided by the end user. Font, size, colour, scale, contrast... all these things are under the users control, not yours.
Consider using split panels, and maybe some flow panels. Get used to 'randomly sizing' the form when you think you've finished designing, to see how it reacts to being the 'wrong size'. Someone will find a way to shrink or grow your form, and handling that gracefully is easier than enforcing a view.
I have a Form with height size bigger then screen, so the user can use the scrollbar to see the content. My problem is, I have alot of buttons and checkboxes, all the way up and down the form, and every time the user try to click some, the form automatic try to center the clicked button in the middle of screen.
I want the scrollbar to stay where the user put it. And not trying to automatic center at every btn or iten clicked.
Can someone help with this? Its winforms, visual studio 15.
I cannot reproduce your problem but have you tried overriding the ScrollToControl?
Stop form from scrolling when moving controls
I am developing a windows forms application with C#
My main form has a toolstrip with a ToolStripSplitButton which is aligned to the right. When the split button is clicked, its menu displays over the edge of the form, unless, the form is too close to the far right hand side of the screen.
I have played with various properties to try and solve this, but without much luck!
Is there anything (maybe even a DllImport), that can force the button's menu to always fold in and towards the form, and never exceed the forms bounds?
As worked out in the comments on the OP, if you don't use images in the sub-items of the ToolStripSplitButton, this is an easy solution:
1) Set the RightToLeft property of the ToolStripSplitButton itself to Yes
2) Set the RightToLeft property of all sub-items to No to align the text correctly.
I want to emulate modal dialog in XAML Metro App.
So I was going to set .IsEnabled = false on all controls apart from the one which will pose as a modal dialog.
Apparently IsEnabled not in Grid not in Panel not in FrameworkElement. How to disable it not making a user control out of it?
I guess Sinofsky cut so many corners that the whole thing is now more like an Escher staircases. I am loosing my faith. Please help
Sorry, I am a little late to the party...
Here is how I created a modal popup - I used a popup dialog where the top and bottom portions are transparent so that anything behind it will show through. When the popup is opened, I set its size to cover the entire screen.
The top and bottom portions of the popup also are set to autosize (height = *), so that they fill up the entire top and bottom of the screen. This prevents any input from going into the grid underneath.
Here is a screen shot of my popup in Visual Studio:
The popup is a grid with 5 rows, 3 for the dialog itself and 2 for the transparent top and bottom.
Here is how the popup looks in my app. Obviously the grid shows through the transparent top and bottom. Since the popup fills the entire screen, any input (keyboard or mouse) goes to it rather than the grid underneath, making the popup act like a modal dialog.
Be warned though that with this strategy, you have to handle these events:
Screen resizes (full screen, snapped view, filled view) - you need to resize the popup to fit within each of the view states
Screen rotation - again, you have to handle resizing here
Keyboard popup - you need to shift the popup up so that the onscreen keyboard does not interfere with it.
Set IsHitTestVisible = false on the background content.
Additionally you could set focus to something in your modal layer root and set TabNavigation to Cycle on the modal layer root to make sure that users can't tab/shift+tab out of it. Also make sure the modal layer is all hit test-solid - e.g. Transparent or has some other fill so users can't click through it.
Also make sure no Popups show while your modal layer is visible.
Unfortunately no one seems to know (except Mr Skakun who gave wrong answer and never bothered to revise it).
Hence my solution (the simplest) is to make the element in question Hidden - I cant find any other ways to 'disable' a grid.
If I wanted to disable it correctly I would have to write a recursive function to find all FrameworkElements in the grid children and set IsEnabled = false though.