Reputation: 199
I'm developing a windows forms application. In my application I have anchored controls to forms such that forms can be maximized and controls will get arranged accordingly. This application should support different DPI values.
I have set the anchors of some controls to bottom, right, and bottom-right. The AutoScroll property of the forms is set to true. When the DPI value is on default (96) controls work as expected. But the problem is if the screen loads in higher DPI (like 120), even though form scroll bars enabled, controls which are anchored to bottom and bottom-right cannot be seen.
Could anybody please advise me on this issue?
regards, Eranga
Upvotes: 19
Views: 138626
Reputation: 141
Create a Panel
called panel1
, then do the following:
panel1.AutoScroll = true;
panel1.BorderStyle = BorderStyle.FixedSingle;
Use this method to set scroll width and height:
panel1.SetAutoScrollMargin(int x, int y);
Upvotes: 14
Reputation: 556
1. From "Form" properties 👉 Set AutoScroll = True:
2. Move any control to the lower right corner:
Upvotes: 0
Reputation: 11
I was reading through this page and i can say it provides an exact and easy solution to your problem!
I tested it and it worked well for me.
Instruction:
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" >
<asmv3:application>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<dpiAware>true</dpiAware>
</asmv3:windowsSettings>
</asmv3:application>
</assembly>
InitializeComponent();
)[DllImport("shcore.dll")]
static extern int SetProcessDpiAwareness(_Process_DPI_Awareness value);
enum _Process_DPI_Awareness
{
Process_DPI_Unaware = 0,
Process_System_DPI_Aware = 1,
Process_Per_Monitor_DPI_Aware = 2
}
InitializeComponent();
)SetProcessDpiAwareness(_Process_DPI_Awareness.Process_DPI_Unaware);
Upvotes: 0
Reputation: 1932
It's an old post but the issue is ongoing and related posts just keep on arriving on SO
!
I'm doing the necro thing here rather than addressing a more recent question only because it comes top of my google search
The question is simple: "why won't the damn scrollbars appear on my ScrollableControl
?"
But there can be no specific, definitive answer. Because the causes are legion. Because whether or not scrollbars appear on a control depends:
It's easy to fall into the trap of randomly twiddling prop-values until the cows come home. Or go on the i/webs &hope to find some SO
foos. But oh dear. Here is a handful of related SO
posts with an outstanding variety of proposed resolutions:
Horizontal Scrollbar is not visible on DataGridView
Horizontal scrollbar not showing on my textbox
How to set scroll bar in Windows form
How to make scrollbars appear in a resizable panel when the contained control is too big for it?
Scrollable Form in c#, AutoScroll=true doesn't work
How to get scrollbar in Panel in VB.Net?
There are screen-shots of VS-designer
property pages (like here) & even some extreme code-based solutions... my favourites:
Add vertical scroll bar to panel in .NET
how to add Vscroll control to form in Visualbasic.net?
/sighs/
..in the form of a minimal github solution in order to explore some of the .NET scrollbar voodoos:
https://github.com/violet313/TestWinForms/tree/Test1-Body-Panel
It's a Visual Studio 2015
solution using the .NET4.52 framework
.
In the solution i am trying to create a form that responds to some dynamic text data that is to be displayed. here's the basic lay-out i am ultimately seeking:
--------------------------------------------------
| fixed-size form header | |
------------------------------------| side |
| | panel |
| dynamic content panel | stuff |
| | |
--------------------------------------------------
| fixed-size form trailer |
--------------------------------------------------
I want the form to:
respond to the dynamic content by:
Grab it, go thro each of the (only 9 starting from 95dccc5)commits and then test your requirements in a sane & incremental fashion. be sure to branch whenever you make a dubious state-change.
Irl: maybe i'm a thicky but it took me over an hour reading the MSDNs trying (&failing) to figure-out the .NET forms control property contingencies. doing structured trial-and-error this way took me only 20mins to get what i wanted.
y~bwc
i know this here is a yeaz ~but who cares? but i had to get if off my chest. heh :
grrr. having to unlurk &answer this question arises out of my need to profitably take on Microsoft contract work. paymasters can be relatively (from a developer pov) non-technical and, having read lots of stuff including the words: quick, simple, straight-forward, secure, etc, come away with the impression that things .NETish is a stroll in the park. My issue with this is that i would then have difficulty trying to reasonably explain why they might need to pay me for n-day's worth of work in order to get a simple scroll-bar to appear on a responsive form.
On this occasion, i never got that far. lol. i spent a few hours wading thro the MSDN blahs trying to make it happen. and then yawned, gave up, &moved on with a pragmatic implementation. which was accepted. but it's now the w/end and i am an ocd fool who cannot let things be.
Upvotes: 10