2017-04-19 23 views
-1

嗨,大家好,我有一个问题,我在屏幕分辨率为1600x900的环境中设计了一个程序,问题是当我尝试在其他分辨率中执行程序时1366x768我的所有按钮,面板等都是由窗口裁剪的,这里以1600x900 Example和这里的1366x768 Example为例,我使用了锚和填充属性,但它不起作用,你知道任何属性或解决方案来解决这个问题,我会很感激如何在WinForms中创建屏幕分辨率感知程序

+0

可以解决这个问题。请参阅此链接[Anchor Property MSDN](https://msdn.microsoft.com/en-us/library/system.windows.forms.control.anchor(v = vs.110).aspx) –

+0

@ P.Pat So基本上他说他试过了? – john

+0

@john OP说他试过锚和填充。我建议阅读锚点和码头的属性,这将指导OP来解决问题。 –

回答

0

核心属性还尝试使用分割容器它会自动调整你的形式,每

分辨率

尝试,使用T他的形式负载代码

public void abrunden(object was, int x, int y, int width, int height, int radius) 
{ 

    System.Drawing.Drawing2D.GraphicsPath gp = new System.Drawing.Drawing2D.GraphicsPath(); 

    gp.AddLine(x + radius, y, x + width - radius, y); 
    gp.AddArc(x + width - radius, y, radius, radius, 270, 90); 
    gp.AddLine(x + width, y + radius, x + width, y + height - radius); 
    gp.AddArc(x + width - radius, y + height - radius, radius, radius, 0, 90); 
    gp.AddLine(x + width - radius, y + height, x + radius, y + height); 
    gp.AddArc(x, y + height - radius, radius, radius, 90, 90); 
    gp.AddLine(x, y + height - radius, x, y + radius); 
    gp.AddArc(x, y, radius, radius, 180, 90); 
    gp.CloseFigure(); 

    was.region = new System.Drawing.Region(gp); 
    gp.Dispose(); 
} 

调用此使用以下

  1. 使用形式船坞一个面板这与形式

  2. 通面板名称宽度和高度的方法

abrunden(panWarten,0,0,_with1。宽度,_with1.Height,20);

这将使形式通过的WinForms打交道时读锚和码头响应特性按照屏幕