以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助]月历非空日期字体加粗显示如何设置? (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=181008) |
-- 作者:chouyou -- 发布时间:2022/10/22 11:21:00 -- [求助]月历非空日期字体加粗显示如何设置? 请教老师,月历非空日期字体加粗显示如何设置? |
-- 作者:有点蓝 -- 发布时间:2022/10/22 11:22:00 -- 什么是“非空日期”? |
-- 作者:chouyou -- 发布时间:2022/10/22 21:48:00 -- 就是双击月历的日期,可筛选出该日期的表的所有记录。 我的想法是:该日期如果有表记录,那么该日期在月历上显示为粗字体,如果该日期没有表记录,该日期在月历上显示为常规字体。这样的好处是月历字体粗细可以显示哪天有记录,哪天没有记录。
|
-- 作者:chouyou -- 发布时间:2022/10/23 0:47:00 -- Dim Cal As WinForm.Calendar = Forms("主窗口").Controls("Calendar1") Dim y As Integer = Year(Cal.Value) Dim m As Integer = Month(Cal.Value) Dim dt1 As New Date(y, m, 1) Dim dt2 As New Date(y, m, Date.DaysInMonth(y, m)) \'获取该月的最后一天 Dim ds As New List(Of String) ds = DataTables("tblIntervOper").SQLGetValues("日期", "日期 >= #" & dt1 & "# and 日期<=#" & dt2 & "#") Dim str As String Dim i As Integer For i = 0 To ds.Count - 1 str += "CDate(""" & ds(i) & """)," Next \'output.Show(str.Trim(",")) Forms("主窗口").Controls("Calendar1").BaseControl.BoldedDates = {str.Trim(",")} 上述代码执行后出现错误,如下图: 不知道哪里错了?
|
-- 作者:chouyou -- 发布时间:2022/10/23 9:42:00 -- 用以下代码解决问题了 Dim Cal As WinForm.Calendar = Forms("主窗口").Controls("Calendar1") Dim y As Integer = Year(Cal.Value) Dim m As Integer = Month(Cal.Value) Dim dt1 As New Date(y, m, 1) Dim dt2 As New Date(y, m, Date.DaysInMonth(y, m)) \'获取该月的最后一天 Dim ds As New List(Of String) ds = DataTables("tblIntervOper").SQLGetValues("日期", "日期 >= #" & dt1 & "# and 日期<=#" & dt2 & "#") Dim dts As New List(Of Date) For Each d As String In ds dts.Add(CDate(d)) Next Forms("主窗口").Controls("Calendar1").BaseControl.BoldedDates = dts.ToArray
|