zoukankan      html  css  js  c++  java
  • 向Blog加入日历

    1.下载日历页面
    http://scottonwriting.net/sowBlog/CodeProjectFiles/cal.zip
    2.修改界面:
    <%@ Control language="c#" Inherits="Dottext.Web.UI.Controls.Calendar" %>
    <asp:Calendar id="entryCal" runat="server" SelectionMode="None" Width="220px"

    DayNameFormat="FirstLetter"
     Height="200px" BorderWidth="1px" ShowGridLines="False" CssClass="Cal">
     <TodayDayStyle CssClass="CalTodayDay"></TodayDayStyle>
     <SelectorStyle CssClass="CalSelector"></SelectorStyle>
     <NextPrevStyle CssClass="CalNextPrev"></NextPrevStyle>
     <DayHeaderStyle CssClass="CalDayHeader"></DayHeaderStyle>
     <SelectedDayStyle CssClass="CalSelectedDay"></SelectedDayStyle>
     <TitleStyle CssClass="CalTitle "></TitleStyle>
     <WeekendDayStyle CssClass="CalWeekendDay"></WeekendDayStyle>
     <OtherMonthDayStyle CssClass="CalOtherMonthDay"></OtherMonthDayStyle>
    </asp:Calendar>

    3.修改CS文件:
    (1)域名空间改为:namespace Dottext.Web.UI.Controls
    (2)控件从UserControl继承改为从BaseControl继承
    (3)增加using:
    using System.Threading;
    using System.Globalization;
    using Dottext.Framework.Configuration;
    (3)加入<定制日历控件显示的星期文字>功能:
    private void entryCal_PreRender(object sender, System.EventArgs e)
    {
     Thread t=Thread.CurrentThread;
     CultureInfo oldCulture=t.CurrentCulture;
     CultureInfo newci=(CultureInfo)oldCulture.Clone();
     newci.DateTimeFormat.DayNames=new string[]{"日","一","二","三","四","五","六"};
     newci.DateTimeFormat.FirstDayOfWeek=DayOfWeek.Sunday;
     t.CurrentCulture=newci;
     //注:不要忘了设置DayNameFormat="Full"。
    }
    (4)在InitializeComponent中加入一行:
    this.entryCal.PreRender += new System.EventHandler(this.entryCal_PreRender);

    (5)选择数据库的修改...(未完成)

    4.修改CSS文件(一般是skins/??/style.css):
    .Cal
    {
         border : 1px solid #999999;
         100%;
         font-family:Arial;
         font-size: 12px;
         margin-top:10px;
         margin-bottom:10px;
         height:180px;
         background-color:#EEEEEE;
    }

    .CalTitle
    {
         background-color : #B6B6B6;
         border-color:#ADF;
         font-family:Arial;
         font-size: 13px;
         color : #000;
         margin-left : 0px;
         padding : 0px;
         height:100%;
         font-weight:bold;
    }

    .CalOtherMonthDay
    {
         color:#808080;
    }

    .CalSelector
    {
        
    }

    .CalNextPrev
    {
        
    }

    .CalDayHeader
    {
         background-color:#CCCCCC;
    }
     
    .CalSelectedDay
    {
        
    }
     
    .CalWeekendDay
    {
        
    }
     
    .CalTodayDay
    {
         background-color:#CCCCCC;
    }
    5.页面放到skins/??/controls下,CS文件放在UI/controls下
    6.如果想更好地使用CSS,可以看 Daniel Cazzulino的文章“style free calendar control”
    http://weblogs.asp.net/cazzu/archive/2004/02/02/66130.aspx

    7.参考文件:
    Giving .Text a Calendar View
    http://scottonwriting.net/sowblog/posts/708.aspx

    Calendar Control
    http://scottwater.com/blog/archive/2004/02/13/CalendarControl.aspx

    DUDU的BLOG:
    如何修改日历的CSS
    http://www.cnblogs.com/dudu/archive/2004/02/19/1400.aspx

    如何定制日历控件显示的星期文字
    http://www.cnblogs.com/dudu/archive/2004/02/18/1360.aspx

  • 相关阅读:
    Linux下C编程入门(1)
    Git 常用命令速查表
    Git Cheat Sheet 中文版
    Linux 在一个命令行上执行多个命令
    一个奇怪的错误的警示
    模块化编程实例(一)
    含有指针变量的结构体的指针的应用
    iOS 开发加密做法
    关于设置shadowPath的重要性
    关于设置shadowPath的重要性
  • 原文地址:https://www.cnblogs.com/huqingyu/p/15832.html
Copyright © 2011-2022 走看看