Rss & SiteMap
Foxtable(狐表) http://www.foxtable.com
在窗口中增加一个按钮,代码:
Dim dlg As new windows.forms.fontdialog
If dlg.showdialog = DialogResult.Ok Then
Tables("颜色表").Font = dlg.Font
End If
重新设置字体样式,请问如何保存设置?
下载信息 [文件大小: 下载次数: ] | |
![]() |
写个代码,将字体名称、大小、是否加粗等属性保存在用户设置、注册表、数据表、文本文件等任何一个可以保存设置的地方。
需要的时候从中读取即可。
Dim fnt As New Font("黑体",12,FontStyle.Bold Or FontStyle.Underline)
Output.Show(fnt.Name)
Output.Show(fnt.Size)
Output.Show(fnt.Style)
得到:
黑体
12
5
如果字体样式有多个值,请问如何提取?(如:FontStyle.Bold Or FontStyle.Underline)
一个值:fnt.Style,就包括所有字体属性了
定义全局变量: Public zt As Font
项目属性BeforeCloseProject: zt = Tables("颜色表").Font
项目属性AfterOpenProject: Tables("颜色表").Font = zt
上面的代码可以保存字体设置,如果希望把颜色表的字体属性各个值保存到数据表中,如果提取的各个值是:
"黑体"
12
5
请问如何重新合成字体设置?(Dim fnt As New Font("宋体",12,5) 不能通过测试)
Dim fnt As New Font("黑体",12,FontStyle.Bold Or FontStyle.Underline)
output.show(fnt.style)
得到5
也就是没办法查看Style的值(得到的只是数字)
定义全局变量: Public zt As Font
项目属性BeforeCloseProject: zt = Tables("颜色表").Font
项目属性AfterOpenProject: Tables("颜色表").Font = zt
上面这段代码虽然能保存字体设置,但是当打开系统字体设置窗口时,窗口各选项不会与当前表设置相对应,请问应该如何设置?
Dim dlg As new windows.forms.fontdialog
dlg.Font = Tables("颜色表").Font
If dlg.showdialog = DialogResult.Ok Then
Tables("颜色表").Font = dlg.Font
End If
谢谢!
字体加载:
Dim d1 As String = DataTables("系统设置").DataRows(0)("字体名称")
Dim d2 As Integer = DataTables("系统设置").DataRows(0)("字体大小")
Dim d3 As FontStyle = DataTables("系统设置").DataRows(0)("字体样式")
Dim s As new font(d1,d2,d3)
Tables("表A").Font = s