由于字体对象Font,所有的属性都是只读,如需修改一个字体的大小,就需要产生的一个新的实体,下面这个方法用于完全复制字体的属性,并设置新的大小!

     Public Shared Function ChangeFontSize(ByVal font As System.Drawing.Font, _
                                            ByVal newSize As Single) As System.Drawing.Font
            If Not font Is Nothing Then
                If Not font.Size = newSize Then
                    font = New System.Drawing.Font(font.Name, _
                                            newSize, font.Style, _
                                            font.Unit, font.GdiCharSet, _
                                            font.GdiVerticalFont)
                End If
            End If
            Return font
        End Function

相关文章:

  • 2021-04-08
  • 2021-10-17
  • 2021-07-02
  • 2021-11-27
  • 2021-10-02
  • 2021-12-02
  • 2022-01-07
猜你喜欢
  • 2021-08-04
  • 2021-04-13
  • 2021-11-10
  • 2021-07-06
  • 2021-05-16
  • 2021-08-15
  • 2022-02-08
相关资源
相似解决方案