تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
كيفيه التعامل مع MonthCalendar Class
#1
كاتب الموضوع : AhmedEssawy

مثال كامل مدعوم بعدد من خواص MonthCalendar Class .
اقرأ الكومنت (التعليق) بداخل الكود


vb.net

كود :
[color=blue]Imports[/color] System
[color=blue]Imports[/color] System.Drawing
[color=blue]Imports[/color] System.Windows.Forms

[color=blue]Public[/color] [color=blue]NotInheritable[/color] [color=blue]Class[/color] Form1
[color=blue]Inherits[/color] System.Windows.Forms.Form

[color=blue]Friend[/color] [color=blue]WithEvents[/color] MonthCalendar1 [color=blue]As[/color] System.Windows.Forms.MonthCalendar
[color=blue]Friend[/color] [color=blue]WithEvents[/color] TextBox1 [color=blue]As[/color] System.Windows.Forms.TextBox

<System.STAThread()> _
[color=blue]Public[/color] [color=blue]Shared[/color] [color=blue]Sub[/color] Main()
System.Windows.Forms.Application.Run([color=blue]New[/color] Form1)
[color=blue]End[/color] [color=blue]Sub[/color] [color=green]'Main[/color]

[color=blue]Public[/color] [color=blue]Sub[/color] [color=blue]New[/color]()
[color=blue]MyBase[/color].New()

[color=blue]Me[/color].TextBox1 = [color=blue]New[/color] System.Windows.Forms.TextBox
[color=blue]Me[/color].TextBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
[color=blue]Me[/color].TextBox1.Location = [color=blue]New[/color] System.Drawing.Point(48, 488)
[color=blue]Me[/color].TextBox1.Multiline = [color=blue]True[/color]
[color=blue]Me[/color].TextBox1.ReadOnly = [color=blue]True[/color]
[color=blue]Me[/color].TextBox1.Size = [color=blue]New[/color] System.Drawing.Size(824, 32)

[color=green]' Create the calendar.[/color]
[color=blue]Me[/color].MonthCalendar1 = [color=blue]New[/color] System.Windows.Forms.MonthCalendar

[color=green]' Set the calendar location.[/color]
[color=blue]Me[/color].MonthCalendar1.Location = [color=blue]New[/color] System.Drawing.Point(47, 16)

[color=green]' Change the color.[/color]
[color=blue]Me[/color].MonthCalendar1.BackColor = System.Drawing.SystemColors.Info
[color=blue]Me[/color].MonthCalendar1.ForeColor = System.Drawing.Color.FromArgb( _
CType(192, System.Byte), CType(0, System.Byte), CType(192, System.Byte))
[color=blue]Me[/color].MonthCalendar1.TitleBackColor = System.Drawing.Color.Purple
[color=blue]Me[/color].MonthCalendar1.TitleForeColor = System.Drawing.Color.Yellow
[color=blue]Me[/color].MonthCalendar1.TrailingForeColor = System.Drawing.Color.FromArgb( _
CType(192, System.Byte), CType(192, System.Byte), CType(0, System.Byte))

[color=green]' Add dates to the AnnuallyBoldedDates array.[/color]
[color=blue]Me[/color].MonthCalendar1.AnnuallyBoldedDates = [color=blue]New[/color] System.DateTime() _
{New System.DateTime(2002, 4, 20, 0, 0, 0, 0), _
[color=blue]New[/color] System.DateTime(2002, 4, 28, 0, 0, 0, 0), _
[color=blue]New[/color] System.DateTime(2002, 5, 5, 0, 0, 0, 0), _
[color=blue]New[/color] System.DateTime(2002, 7, 4, 0, 0, 0, 0), _
[color=blue]New[/color] System.DateTime(2002, 12, 15, 0, 0, 0, 0), _
[color=blue]New[/color] System.DateTime(2002, 12, 18, 0, 0, 0, 0)}

[color=green]' Add dates to BoldedDates array.[/color]
[color=blue]Me[/color].MonthCalendar1.BoldedDates = [color=blue]New[/color] System.DateTime() {New System.DateTime(2002, 9, 26, 0, 0, 0, 0)}

[color=green]' Add dates to MonthlyBoldedDates array.[/color]
[color=blue]Me[/color].MonthCalendar1.MonthlyBoldedDates = [color=blue]New[/color] System.DateTime() _
{New System.DateTime(2002, 1, 15, 0, 0, 0, 0), _
[color=blue]New[/color] System.DateTime(2002, 1, 30, 0, 0, 0, 0)}

[color=green]' Configure the calendar to display 3 rows by 4 columns of months.[/color]
[color=blue]Me[/color].MonthCalendar1.CalendarDimensions = [color=blue]New[/color] System.Drawing.Size(4, 3)

[color=green]' Set the week to begin on Monday.[/color]
[color=blue]Me[/color].MonthCalendar1.FirstDayOfWeek = System.Windows.Forms.Day.Monday

[color=green]' Sets the maximum visible date on the calendar to 12/31/2010.[/color]
[color=blue]Me[/color].MonthCalendar1.MaxDate = [color=blue]New[/color] System.DateTime(2010, 12, 31, 0, 0, 0, 0)

[color=green]' Set the minimum visible date on the calendar to 12/31/2010.[/color]
[color=blue]Me[/color].MonthCalendar1.MinDate = [color=blue]New[/color] System.DateTime(1999, 1, 1, 0, 0, 0, 0)

[color=green]' Only allow 21 days to be selected at the same time.[/color]
[color=blue]Me[/color].MonthCalendar1.MaxSelectionCount = 21

[color=green]' Set the calendar to move one month at a time when navigating using the arrows.[/color]
[color=blue]Me[/color].MonthCalendar1.ScrollChange = 1

[color=green]' Do not show the "Today" banner.[/color]
[color=blue]Me[/color].MonthCalendar1.ShowToday = [color=blue]False[/color]

[color=green]' Do not circle today's date.[/color]
[color=blue]Me[/color].MonthCalendar1.ShowTodayCircle = [color=blue]False[/color]

[color=green]' Show the week numbers to the left of each week.[/color]
[color=blue]Me[/color].MonthCalendar1.ShowWeekNumbers = [color=blue]True[/color]

[color=green]' Set up how the form should be displayed and add the controls to the form.[/color]
[color=blue]Me[/color].ClientSize = [color=blue]New[/color] System.Drawing.Size(920, 566)
[color=blue]Me[/color].Controls.AddRange([color=blue]New[/color] System.Windows.Forms.Control() {Me.TextBox1, [color=blue]Me[/color].MonthCalendar1})
[color=blue]Me[/color].Text = [color=maroon]"Month Calendar Example"[/color]

[color=blue]End[/color] [color=blue]Sub[/color]

[color=blue]Private[/color] [color=blue]Sub[/color] monthCalendar1_DateSelected([color=blue]ByVal[/color] sender [color=blue]As[/color] [color=blue]Object[/color], _
[color=blue]ByVal[/color] e [color=blue]As[/color] System.Windows.Forms.DateRangeEventArgs) [color=blue]Handles[/color] MonthCalendar1.DateSelected

[color=green]' Show the start and end dates in the text box.[/color]
[color=blue]Me[/color].TextBox1.Text = [color=maroon]"Date Selected: Start = "[/color] + _
e.Start.ToShortDateString() + [color=maroon]" : End = "[/color] + e.End.ToShortDateString()
[color=blue]End[/color] [color=blue]Sub[/color]

[color=blue]Private[/color] [color=blue]Sub[/color] monthCalendar1_DateChanged([color=blue]ByVal[/color] sender [color=blue]As[/color] [color=blue]Object[/color], _
[color=blue]ByVal[/color] e [color=blue]As[/color] System.Windows.Forms.DateRangeEventArgs) [color=blue]Handles[/color] MonthCalendar1.DateChanged

[color=green]' Show the start and end dates in the text box.[/color]
[color=blue]Me[/color].TextBox1.Text = [color=maroon]"Date Changed: Start = "[/color] + _
e.Start.ToShortDateString() + [color=maroon]" : End = "[/color] + e.End.ToShortDateString()
[color=blue]End[/color] [color=blue]Sub[/color]
[color=blue]End[/color] [color=blue]Class[/color]
}}}}
تم الشكر بواسطة:


المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
  احتراف التعامل مع ( ملفات التهية ini ) باسهل الطرق مكتبه كاملة من صنعى : اصدار 1.0.1 ali.alfoly 0 706 21-08-13, 08:34 AM
آخر رد: ali.alfoly
  احتراف التعامل مع ( ملفات التهية ini ) باسهل الطرق مكتبه كاملة من صنعى : اصدار 1.0.0 ali.alfoly 9 1,724 20-08-13, 12:53 AM
آخر رد: ali.alfoly
  التعامل مع الملفات RaggiTech 0 447 17-10-12, 09:16 PM
آخر رد: RaggiTech
  التعامل مع المجلدات RaggiTech 0 397 17-10-12, 09:11 PM
آخر رد: RaggiTech
  (لعبة الذاكرة Memory Game) لتفهم التعامل مع مصفوفة الادوات RaggiTech 0 562 17-10-12, 09:05 PM
آخر رد: RaggiTech
  مثال رائع من مايكروسوفت يوضح اكواد التعامل مع الملفات و بتصميم ممتاز(80ك ب) RaggiTech 0 415 17-10-12, 07:19 PM
آخر رد: RaggiTech
  التعامل مع البرامج والتطبيقات الخارجية RaggiTech 0 397 17-10-12, 06:54 PM
آخر رد: RaggiTech
  لعمل نسخة من Class دون استعمال الكلمة new RaggiTech 0 291 17-10-12, 06:14 PM
آخر رد: RaggiTech
  لانشاء قاعده بيانات و التعامل معها من خلال الكود RaggiTech 0 517 17-10-12, 05:24 PM
آخر رد: RaggiTech
  كيفيه عمل اسطر مرقمه لل RichTextBox RaggiTech 0 259 17-10-12, 05:20 PM
آخر رد: RaggiTech

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم