2014-09-03 8 views
0

아래 루틴을 사용하여 화면 해상도에 따라 런타임에 컨트롤과 텍스트의 크기를 조정합니다. "Wingdings 3"과 같은 글꼴을 제외하고는 제대로 작동합니다. "Wingdings 3"은 "왼쪽 화살표"대신 실제 문자 "Å"을 나타냅니다. 이유가 무엇입니까?특수 글꼴 크기 조절

public void ResizeControls(Control objCtl) 
    { 
     foreach (Control cChildren in objCtl.Controls) 
     { 
      if (cChildren.HasChildren) 
      { 
       ResizeControls(cChildren); 
      } 
      else 
      { 
       cChildren.Size = new Size(Screen.PrimaryScreen.Bounds.Width * cChildren.Width/DesignWidth, Screen.PrimaryScreen.Bounds.Height * cChildren.Height/DesignHeight); 
       cChildren.Location = new Point(Screen.PrimaryScreen.Bounds.Width * cChildren.Left/DesignWidth, Screen.PrimaryScreen.Bounds.Height * cChildren.Top/DesignHeight); 

       if ((cChildren.GetType() == typeof(System.Windows.Forms.Label) | (cChildren.GetType() == typeof(System.Windows.Forms.Button)))) 
        cChildren.Font = new Font(cChildren.Font.FontFamily.Name, Screen.PrimaryScreen.Bounds.Height * cChildren.Font.Size/DesignHeight, cChildren.Font.Style, cChildren.Font.Unit, ((byte)(0))); // <-- HERE RESIZING A CONTROLS FONT PROPERTY 
      } 
     } 
     objCtl.Size = new Size(Screen.PrimaryScreen.Bounds.Width * objCtl.Width/DesignWidth, Screen.PrimaryScreen.Bounds.Height * objCtl.Height/DesignHeight); 
     objCtl.Location = new Point(Screen.PrimaryScreen.Bounds.Width * objCtl.Left/DesignWidth, Screen.PrimaryScreen.Bounds.Height * objCtl.Top/DesignHeight); 

     if ((objCtl.GetType() == typeof(System.Windows.Forms.Label)) | (objCtl.GetType() == typeof(System.Windows.Forms.Button))) 
      objCtl.Font = new Font(objCtl.Font.FontFamily, Screen.PrimaryScreen.Bounds.Height * objCtl.Font.Size/DesignHeight, objCtl.Font.Style, objCtl.Font.Unit, ((byte)(0))); // <-- HERE RESIZING A CONTROLS FONT PROPERTY 
    } 

답변

1

알 수 있습니다. 원래 GDI 문자 집합 글꼴을 복사하는 대신 GDI 문자 집합을 0으로 설정했습니다.

"objCtl.Font.GdiCharSet"