Enable scroll bars in windows forms

后端 未结 4 1300
执笔经年
执笔经年 2021-01-04 02:41

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.

4条回答
  •  [愿得一人]
    2021-01-04 03:16

    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:

    1. Add a manifest file to your project (Project --> New Item --> Select the manifest type)
    2. Add the following XML into your app.manifest (may be another name):
    
       
            
                 true
            
       
    
    
    1. Add the following C# code into the class where you call the component initialize (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
    }
    
    1. Now just add this code line above your initialize component method (by default InitializeComponent();)
    SetProcessDpiAwareness(_Process_DPI_Awareness.Process_DPI_Unaware);
    

提交回复
热议问题