在月历中填充大胆日期的颜色 [英] Fill Back Color of Bold Dates in Month Calendar

查看:133
本文介绍了在月历中填充大胆日期的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在一个月的日历中填写大胆日期的颜色。从sql server表读取的日期在月历中已加粗。现在我希望它们有不同的颜色。我怎样才能做到这一点?我在月历中反映大胆日期的代码为
folows。

I want to fill back color of the bold dates in a month calendar. Dates read from sql server table have been bold in the month calendar. Now I want them to be in a different color. How can I do this? my codes to reflect bold dates in month calendar is as folows.

Imports System.Data.SqlClient

Public Class Operations
    Private ConnectionString As String = "Data Source=MyPC;Initial Catalog=MonthCalendarTest;Integrated Security=True"
    Public Function LoadDates(ByVal MyId As Integer) As DateTime()
        Dim dateList As New List(Of DateTime)

        Using cn As New SqlConnection With {.ConnectionString = ConnectionString}

            Using cmd As New SqlCommand With {.Connection = cn}
                cmd.CommandText = "SELECT e.EventDate FROM dbo.tblEvents AS e where EventID=" & MyId

                cn.Open()

                Dim reader As SqlDataReader = cmd.ExecuteReader
                While reader.Read
                    dateList.Add(reader.GetDateTime(0))
                End While

            End Using
        End Using
        Return dateList.ToArray
    End Function


Private Sub Form2_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim ops As New Operations
        ' MonthCalendar1.AnnuallyBoldedDates = ops.LoadDates


        MonthCalendar1.BoldedDates = ops.LoadDates(3)

End sub






End Class




推荐答案

您好,

标准月份日历没有开箱即用的功能。您需要一个自定义日历,其中大多数可以执行此操作的日历都在C#中,但它将与VB.NET一起使用(哎呀,所有.NET核心代码都是用您在VB中使用的C#编写的。 NET)。

The standard month calendar does not have the ability out of the box to do this. You would need a custom calendar where the majority of the ones that can do this are in C# yet will work with VB.NET (heck, all of the .NET core code is written in C# that you use in VB.NET).

请参阅以下链接中的列表。

See the list in the link below.

https://stackoverflow.com/questions/5048872/how-can-i-change-the-color - 月份日期控制中的确定日期


这篇关于在月历中填充大胆日期的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆