如何在Web应用程序中更改Calander的颜色? 请帮助我,先生.....
How to change the Colour of a Calander in Web Application? please help me sir.....
推荐答案类似 something like Protected Sub Calendar1_DayRender(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DayRenderEventArgs) Handles Calendar1.DayRender Dim onmouseoverStyle As String = "this.style.backgroundColor='#D4EDFF'" Dim onmouseoutStyle As String = "this.style.backgroundColor='@BackColor'" Dim rowBackColor As String = String.Empty e.Cell.Attributes.Add("onmouseover", onmouseoverStyle) e.Cell.Attributes.Add("onmouseout", onmouseoutStyle.Replace("@BackColor", rowBackColor)) End Sub
有关日历控件的更多提示,请参见以下链接: weblogs.sqlteam. com/jhermiz/archive/2007/12/10/Cool-Tricks-With-The-ASP-Calendar.aspx [ ^ ]
see the following link for more tips on calendar control: weblogs.sqlteam/jhermiz/archive/2007/12/10/Cool-Tricks-With-The-ASP-Calendar.aspx[^]
只需签出这段代码,非常有帮助! 关于我的背景颜色发生变化并且不会再出现"的评论,这是我所做的事情: Just checked out this code, very helpful ! Concerning the "My background color changes and doesn''t come back" comment, here is what I did : Protected Sub Main_Calendar_DayRender(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DayRenderEventArgs) Handles Main_Calendar.DayRender Dim onmouseoverStyle As String = "this.style.backgroundColor='#D4EDFF'" Dim DayColor As String = "this.style.backgroundColor='#99CCCC'" Dim BackColor As String = "this.style.backgroundColor='White'" If e.Cell.BackColor = Drawing.Color.FromArgb(153, 204, 204) Then If Not e.Day.IsWeekend Then e.Cell.Attributes.Add("onmouseover", onmouseoverStyle) e.Cell.Attributes.Add("onmouseout", DayColor) End If Else If Not e.Day.IsWeekend Then e.Cell.Attributes.Add("onmouseover", onmouseoverStyle) e.Cell.Attributes.Add("onmouseout", BackColor) End If End If End Sub
我在日历上创建了与不同颜色一样多的变量. 然后,使用"if"语句检查当天的颜色.如果它是蓝色,则在"mouseout"上将再次变为蓝色,否则将变为白色. 希望对您有所帮助.
I created as many variables as different colors on the calendar. Then, with an "if" statement, I check the color of the day. If it''s blue, it will become blue again on "mouseout", or white otherwise. Hope this helped.
更多推荐
如何在Web应用程序中更改Calander的颜色?
发布评论