當前位置: 首頁>>代碼示例>>VB.NET>>正文


VB.NET DateTimePicker.CalendarFont屬性代碼示例

本文整理匯總了VB.NET中System.Windows.Forms.DateTimePicker.CalendarFont屬性的典型用法代碼示例。如果您正苦於以下問題:VB.NET DateTimePicker.CalendarFont屬性的具體用法?VB.NET DateTimePicker.CalendarFont怎麽用?VB.NET DateTimePicker.CalendarFont使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在System.Windows.Forms.DateTimePicker的用法示例。


在下文中一共展示了DateTimePicker.CalendarFont屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。

示例1: New

Public Sub New()
   ' Create a new DateTimePicker.
   Dim dateTimePicker1 As New DateTimePicker()
   Controls.AddRange(New Control() {dateTimePicker1})
   dateTimePicker1.CalendarFont = New Font("Courier New", 8.25F, FontStyle.Italic, GraphicsUnit.Point, CType(0, [Byte]))
End Sub
開發者ID:VB.NET開發者,項目名稱:System.Windows.Forms,代碼行數:6,代碼來源:DateTimePicker.CalendarFont

示例2: New

Option Strict On
imports System
imports System.Drawing
imports System.Windows.Forms

public class DTPicker : inherits Form

  dim dtp as DateTimePicker

  public sub New()
    Size = new Size(400,300)
    AddHandler me.Load, AddressOf me_Load

    dtp = new DateTimePicker()
    dtp.Parent = me
    dtp.Location = new Point(20,20)
    dtp.Size = new Size(ClientSize.Width - 40, dtp.PreferredHeight)
    dtp.Anchor = AnchorStyles.Top or AnchorStyles.Left or AnchorStyles.Right
    dim fnt as new Font("Times New Roman", 16)
    dtp.CalendarFont = new Font(fnt, FontStyle.Bold or FontStyle.Italic)
    dtp.CalendarForeColor = Color.Red
    dtp.CalendarMonthBackground = Color.Yellow
    dtp.CalendarTitleBackColor = Color.Lime
    dtp.CalendarTitleForeColor = Color.Blue
    dtp.CalendarTrailingForeColor = Color.FromArgb(255,192,192)
    dtp.CustomFormat = "dddd,MMMM d, yyyy 'at' h:mm:ss tt"
    dtp.Format = DateTimePickerFormat.Custom
    dtp.DropDownAlign = LeftRightAlignment.Right
    dtp.ShowUpDown = false      ' default
    AddHandler dtp.ValueChanged, AddressOf dtp_ValueChanged

  end sub

  public shared sub Main() 
    Application.Run(new DTPicker())
  end sub

  private sub UpdateLabels()
    Console.WriteLine(dtp.Value.ToString())
    Console.WriteLine(dtp.Value.ToLongDateString())
    Console.WriteLine(dtp.Value.ToLongTimeString())
    Console.WriteLine(dtp.Value.ToShortDateString())
    Console.WriteLine(dtp.Value.ToShortTimeString())
  end sub

  private sub me_Load(ByVal sender as object,ByVal e as EventArgs)
    UpdateLabels()
  end sub

  private sub dtp_ValueChanged(ByVal sender as object,ByVal e as EventArgs)
    UpdateLabels()
  end sub

  private sub txtCustomString_TextChanged(ByVal sender as object,ByVal e as EventArgs)
    UpdateLabels()
  end sub
end class
開發者ID:VB程序員,項目名稱:System.Windows.Forms,代碼行數:57,代碼來源:DateTimePicker.CalendarFont


注:本文中的System.Windows.Forms.DateTimePicker.CalendarFont屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。