Home > Net >  How to solve the c # winform in small screen on a computer screen display is not complete.
How to solve the c # winform in small screen on a computer screen display is not complete.

Time:11-18

C # winform procedure,
On the desktop can display properly, there is no problem, the interface is as follows:

But on a laptop display is not complete, see below:

Notebook now display with the scroll bar, but it is not convenient, want to ask is there any method to set interface in different size on the screen of automatic scaling down or amplifier? Thank you,

CodePudding user response:

-> Layout in the layout control:
TableLayoutPanel: divide the area of rows and columns, set the Anchor to Top | | Bottom Left | Right after, as the size of the window automatically adjust the cell size,
FlowLayoutPanel: from left to right, from top to bottom in the order of row example controls, set the Anchor, will change as the window size to layout,
-> 2. Use Anchor attribute to determine the control way of positioning control, can make the control and the positioning of the window a boundary or automatically adjust size
-> 3. The control of the Dock property can make child controls close to window borders or full of window,


Setup interface in different size on the screen of automatic scaling down or enlarge
- "for WPF to interface layout, ViewBox controls completely is enough,

CodePudding user response:

The
refer to the original poster zg80fj response:
c # winform procedure,
On the desktop can display properly, there is no problem, the interface is as follows:

But on a laptop display is not complete, see below:

Notebook now display with the scroll bar, but it is not convenient, want to ask is there any method to set interface in different size on the screen of automatic scaling down or amplifier? Thank you,

Moderator say is the practice of slow
A fast:
All elements of this interface traversal, their high wide left four attributes can be multiplied by the result of the current design/resolution, remember the ratio in the middle of the results with double or can't see,

CodePudding user response:

 
Private void setfrom (Control. ControlCollection IControls)
{
Foreach (Control item in IControls)
{
Item. The Top=(int) (item. Top * 0.8);
Item. Left=(int) (item. Left * 0.8);
Item. Width=(int) (item. Width * 0.8);
Item. Height=(int) (item. Height * 0.8);
If (item. The HasChildren)
{
Setfrom (item. Controls);
}
}
}


This is down to 80% of the way, you can write their own made narrow specify multiple parameters,

CodePudding user response:

The
reference 3 floor xomix response:
 
Private void setfrom (Control. ControlCollection IControls)
{
Foreach (Control item in IControls)
{
Item. The Top=(int) (item. Top * 0.8);
Item. Left=(int) (item. Left * 0.8);
Item. Width=(int) (item. Width * 0.8);
Item. Height=(int) (item. Height * 0.8);
If (item. The HasChildren)
{
Setfrom (item. Controls);
}
}
}


This is down to 80% of the way, you can write their own made narrow specify multiple parameters,


Hello, you this kind of method to zoom with the center of each control?
Can you set the control fixed to the top left corner of the zoom?

CodePudding user response:

reference 4 floor zg80fj response:
Quote: reference xomix reply: 3/f

 
Private void setfrom (Control. ControlCollection IControls)
{
Foreach (Control item in IControls)
{
Item. The Top=(int) (item. Top * 0.8);
Item. Left=(int) (item. Left * 0.8);
Item. Width=(int) (item. Width * 0.8);
Item. Height=(int) (item. Height * 0.8);
If (item. The HasChildren)
{
Setfrom (item. Controls);
}
}
}


This is down to 80% of the way, you can write their own made narrow specify multiple parameters,


Hello, you this kind of method to zoom with the center of each control?
Can you set the control fixed to the top left corner of the zoom?

Can not also,
Position yourself according to the control logic and intervals to make a left can achieve top left hand corner,
But I think you to ask must be don't know how to make the control logic,

Then let me put it simple:

Control 1 | control 2
Their left are respectively 0 zhongguo kuangye daxue, for example,
By this time the physical location is logic 0 and 55, location is 0, controls the width of 1 + two controls spacing,
If you zoom is used when the physical location, looks to be the center in the space scale, of course, but when you use logical location you will find this is in accordance with the vertex (top left) scale,
But logical position of making these still need some time to:
1, all controls the relationship,
Control 2, when the window is initialized directly using the logical position * proportional way to specify four parameters,

CodePudding user response:

reference 5 floor xomix reply:
Quote: refer to 4th floor zg80fj response:

Quote: refer to the third floor xomix response:

 
Private void setfrom (Control. ControlCollection IControls)
{
Foreach (Control item in IControls)
{
Item. The Top=(int) (item. Top * 0.8);
Item. Left=(int) (item. Left * 0.8);
Item. Width=(int) (item. Width * 0.8);
Item. Height=(int) (item. Height * 0.8);
If (item. The HasChildren)
{
Setfrom (item. Controls);
}
}
}


This is down to 80% of the way, you can write their own made narrow specify multiple parameters,


Hello, you this kind of method to zoom with the center of each control?
Can you set the control fixed to the top left corner of the zoom?

Can not also,
Position yourself according to the control logic and intervals to make a left can achieve top left hand corner,
But I think you to ask must be don't know how to make the control logic,

Then let me put it simple:

Control 1 | control 2
Their left are respectively 0 zhongguo kuangye daxue, for example,
By this time the physical location is logic 0 and 55, location is 0, controls the width of 1 + two controls spacing,
If you zoom is used when the physical location, looks to be the center in the space scale, of course, but when you use logical location you will find this is in accordance with the vertex (top left) scale,
But logical position of making these still need some time to:
1, all controls the relationship,
Control 2, when the window is initialized directly using the logical position * proportional way to specify four parameters,

Seems only to specify the location, I was doing with the benchmark method. Such as in the upper left corner controls a certain location, and then the back of the control position=ctrler_base. X + control interval between coefficient of (*). Of course you can also specify between

CodePudding user response:

refer to 6th floor u010848611 response:
Quote: refer to the fifth floor xomix reply:

Quote: refer to 4th floor zg80fj response:

Quote: refer to the third floor xomix response:

nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  •  Tags:  
  • C#
  • Related