- Let calendarobjvariable=new MonthCalendar()
- Let calendar=new MonthCalendar()
1. Click Start>All Programs>Microsoft Visual Studio 2008>Microsoft Visual Studio 2008.
2. Click File>New>Project>Select Visual F# in the project types>Select F# application in the Visual Studio installed templates category.
3. Click the Project menu>Add reference>Click the .Net tab>Locate then double-click System.Windows.Forms.Do step 3 again and this time, select System.Drawing.
4. Enter the following code after the line “// Learn more about F# at http://fsharp.net “:
- //use the F# standard library
- open System
- open System.Drawing
- open System.Windows.Forms
- //sets the font face and font style of our calendar
- let myfont=new Font("Arial",11.0f,FontStyle.Regular, GraphicsUnit.Point)
- //create a form
- let calendarform=new Form(Text="Use MonthCalendar",StartPosition=FormStartPosition.CenterScreen,AutoScaleMode=AutoScaleMode.Font)
- //create a calendar object named calendar
- //sets its minimum date to jan 1 1999
- //set the maximum date displayed to it to Jan 1,8013
- let calendar=new MonthCalendar(MinDate=Convert.ToDateTime("1 Jan,1999"),MaxDate=Convert.ToDateTime("1 Jan,8013"),Location=new System.Drawing.Point(30,10))
- //change the title backcolor to crimson
- calendar.TitleBackColor<-Color.Crimson
- //applies the font to our calendar
- calendar.Font<-myfont
- //change the calendar backcolor to Bisque
- calendar.BackColor<-Color.Bisque
- //adds the calendar control to our form
- calendarform.Controls.Add(calendar)
- calendarform.Show()
- //executes our application
- Application.Run(calendarform)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.