问题描述
管理员发布一个活动,比如日期是2012年6月1日的。能把活动的标题在日历上6月1日中显示出来
解决方案
解决方案二:
那还是自己去实现一个日历吧,或者找第三方的日程控件
解决方案三:
设置个背景图片,然后上面的要求通过画绘实现。
#region方法区///<summary>///返回一个克隆的对象///</summary>///<returns></returns>publicCustomRectangleClone(){returnnewCustomRectangle(x,y,width,height);}///<summary>///转化为Rectangle对象///</summary>///<returns></returns>publicRectangleToRectangle(){returnnewRectangle((int)x,(int)y,(int)width,(int)height);}///<summary>///转化为RectangleF对象///</summary>///<returns></returns>publicRectangleFToRectangleF(){returnnewRectangleF(x,y,width,height);}///<summary>///返回一个左上角坐标点///</summary>///<returns></returns>publicPointToPoint(){returnnewPoint((int)x,(int)y);}///<summary>///返回一个左上角坐标点///</summary>///<returns></returns>publicPointFToPointF(){returnnewPointF(x,y);}///<summary>///判断指定坐标的点是否在矩形内部///</summary>///<paramname="ptX">X坐标</param>///<paramname="ptY">Y坐标</param>///<returns></returns>publicboolIsPointInRectangle(intptX,intptY){return(ptX>=x&&ptX<=(x+width)&&ptY>=y&&ptY<=(y+height));}///<summary>///判断指定坐标的点是否在矩形内部///</summary>///<paramname="ptX">X坐标</param>///<paramname="ptY">Y坐标</param>///<returns></returns>publicboolIsPointFInRectangle(floatptX,floatptY){return(ptX>=x&&ptX<=(x+width)&&ptY>=y&&ptY<=(y+height));}publicstaticCustomRectangleToCustomRectangle(RectangleFre){CustomRectanglecus=newCustomRectangle();cus.X=re.X;cus.Y=re.Y;cus.Width=re.Width;cus.Height=re.Height;returncus;}///<summary>///根据Rectangle产生一个CustomRectangle对象///</summary>///<paramname="rect"></param>///<returns></returns>publicstaticCustomRectangleFromRectangle(Rectanglerect){returnnewCustomRectangle(rect.Left,rect.Top,rect.Width,rect.Height);}///<summary>///根据RectangleF产生一个CustomRectangle对象///</summary>///<paramname="rect"></param>///<returns></returns>publicstaticCustomRectangleFromRectangleF(RectangleFrect){returnnewCustomRectangle(rect.Left,rect.Top,rect.Width,rect.Height);}///<summary>///获取边框的圆角矩形路径(用于绘图)///</summary>///<returns></returns>publicGraphicsPathGetRoundRectBorderPath(floatradus){GraphicsPathpath=newGraphicsPath();path.AddArc(x,y,radus*2,radus*2,180,90);path.AddArc(Right-radus*2,y,radus*2,radus*2,270,90);path.AddArc(Right-radus*2,Bottom-radus*2,radus*2,radus*2,0,90);path.AddArc(x,Bottom-radus*2,radus*2,radus*2,90,90);path.CloseFigure();returnpath;}///<summary>///获取六边形绘图路径///</summary>///<returns></returns>publicGraphicsPathGetHexagonBorderPath(){GraphicsPathpath=newGraphicsPath();List<PointF>pts=newList<PointF>();pts.Add(newPointF(x+width/2f,y));pts.Add(newPointF(Right,y+height/4f));pts.Add(newPointF(Right,y+height*3f/4f));pts.Add(newPointF(x+width/2f,Bottom));pts.Add(newPointF(x,y+height*3f/4f));pts.Add(newPointF(x,y+height/4f));path.AddPolygon(pts.ToArray());returnpath;}///<summary>///获取倒三角形路径///</summary>///<returns></returns>publicGraphicsPathGetTrianglePath(){GraphicsPathpath=newGraphicsPath();List<PointF>pts=newList<PointF>();pts.Add(newPointF(x,y));pts.Add(newPointF(Right,y));pts.Add(newPointF(x+width/2f,Bottom));path.AddPolygon(pts.ToArray());returnpath;}///<summary>///根据鼠标位置确定高亮区域,1、2、3、4表示中间4个区域,其他为-1///</summary>///<paramname="pt"></param>///<returns></returns>publicintGetHotPosition(Pointpt){Pointpt1,pt2,pt3,pt4,pt0;pt1=newPoint((int)(x+width/6),(int)(y+height/6));pt2=newPoint((int)(Right-width/6),(int)(y+height/6));pt3=newPoint((int)(Right-width/6),(int)(Bottom-height/6));pt4=newPoint((int)(x+width/6),(int)(Bottom-height/6));pt0=CenterPoint.ToPoint();GraphicsPathpath1=newGraphicsPath();path1.AddPolygon(newPoint[]{pt1,pt2,pt0});if(path1.IsVisible(pt))return1;GraphicsPathpath2=newGraphicsPath();path2.AddPolygon(newPoint[]{pt2,pt3,pt0});if(path2.IsVisible(pt))return2;GraphicsPathpath3=newGraphicsPath();path3.AddPolygon(newPoint[]{pt3,pt4,pt0});if(path3.IsVisible(pt))return3;GraphicsPathpath4=newGraphicsPath();path4.AddPolygon(newPoint[]{pt4,pt1,pt0});if(path4.IsVisible(pt))return4;return-1;}///<summary>///获取高亮矩形区域///</summary>///<paramname="hotPosition">1,2,3,4;0表示全选</param>///<returns></returns>publicRectangleGetSubRectangle(inthotPosition){if(hotPosition==1)returnnewRectangle((int)x,(int)y,(int)width,(int)(height/2));elseif(hotPosition==2)returnnewRectangle((int)(x+width/2),(int)y,(int)(width/2),(int)height);elseif(hotPosition==3)returnnewRectangle((int)x,(int)(y+height/2),(int)width,(int)(height/2));elseif(hotPosition==4)returnnewRectangle((int)x,(int)y,(int)(width/2),(int)height);elsereturnToRectangle();}#endregion}}
解决方案四:
日程控件