public KryptonRibbonGroupDateTimePicker() { // Default fields _visible = true; _itemSizeCurrent = GroupItemSize.Medium; _shortcutKeys = Keys.None; _keyTip = "X"; // Create the actual date time picker control and set initial settings _dateTimePicker = new KryptonDateTimePicker(); _dateTimePicker.InputControlStyle = InputControlStyle.Ribbon; _dateTimePicker.AlwaysActive = false; _dateTimePicker.MinimumSize = new Size(180, 0); _dateTimePicker.MaximumSize = new Size(180, 0); _dateTimePicker.TabStop = false; // Hook into events to expose via this container _dateTimePicker.ValueChanged += new EventHandler(OnDateTimePickerValueChanged); _dateTimePicker.ValueNullableChanged += new EventHandler(OnDateTimePickerValueNullableChanged); _dateTimePicker.DropDown += new EventHandler<DateTimePickerDropArgs>(OnDateTimePickerDropDown); _dateTimePicker.CloseUp += new EventHandler<DateTimePickerCloseArgs>(OnDateTimePickerCloseUp); _dateTimePicker.CheckedChanged += new EventHandler(OnDateTimePickerCheckedChanged); _dateTimePicker.FormatChanged += new EventHandler(OnDateTimePickerFormatChanged); _dateTimePicker.GotFocus += new EventHandler(OnDateTimePickerGotFocus); _dateTimePicker.LostFocus += new EventHandler(OnDateTimePickerLostFocus); _dateTimePicker.KeyDown += new KeyEventHandler(OnDateTimePickerKeyDown); _dateTimePicker.KeyUp += new KeyEventHandler(OnDateTimePickerKeyUp); _dateTimePicker.KeyPress += new KeyPressEventHandler(OnDateTimePickerKeyPress); _dateTimePicker.PreviewKeyDown += new PreviewKeyDownEventHandler(OnDateTimePickerKeyDown); // Ensure we can track mouse events on the date time picker MonitorControl(_dateTimePicker); }
/// <summary> /// Initialize a new instance of the KryptonDateTimePickerActionList class. /// </summary> /// <param name="owner">Designer that owns this action list instance.</param> public KryptonDateTimePickerActionList(KryptonDateTimePickerDesigner owner) : base(owner.Component) { // Remember the bread crumb control instance _dateTimePicker = owner.Component as KryptonDateTimePicker; // Cache service used to notify when a property has changed _service = (IComponentChangeService)GetService(typeof(IComponentChangeService)); }
/// <summary> /// Initialize a new instance of the ViewDrawButton class. /// </summary> /// <param name="dateTimePicker">Owning control.</param> /// <param name="paletteState">Palette source for states.</param> /// <param name="paletteMetric">Palette source for metric values.</param> /// <param name="buttonValues">Source for content values.</param> /// <param name="glyph">Glyph to be drawn.</param> /// <param name="needPaintHandler">Delegate for requests repainting.</param> /// <param name="repeat">Should button repeat.</param> public ViewDrawDateTimeButton(KryptonDateTimePicker dateTimePicker, IPaletteTriple paletteState, IPaletteMetric paletteMetric, IContentValues buttonValues, DrawDateTimeGlyph glyph, NeedPaintHandler needPaintHandler, bool repeat) : base(paletteState, paletteState, paletteState, paletteState, paletteMetric, buttonValues, VisualOrientation.Top, false) { _dateTimePicker = dateTimePicker; _glyph = glyph; // Assign a controller to handle visual interaction _controller = new ButtonController(this, needPaintHandler); _controller.BecomesFixed = !repeat; _controller.Click += new MouseEventHandler(OnButtonClick); _controller.MouseSelect += new MouseEventHandler(OnButtonMouseSelect); _controller.Repeat = repeat; _controller.ClickOnDown = true; MouseController = _controller; }
/// <summary> /// Initialize a new instance of the ViewDrawButton class. /// </summary> /// <param name="dateTimePicker">Owning control.</param> /// <param name="paletteState">Palette source for states.</param> /// <param name="paletteMetric">Palette source for metric values.</param> /// <param name="buttonValues">Source for content values.</param> /// <param name="glyph">Glyph to be drawn.</param> /// <param name="needPaintHandler">Delegate for requests repainting.</param> /// <param name="repeat">Should button repeat.</param> public ViewDrawDateTimeButton(KryptonDateTimePicker dateTimePicker, IPaletteTriple paletteState, IPaletteMetric paletteMetric, IContentValues buttonValues, DrawDateTimeGlyph glyph, NeedPaintHandler needPaintHandler, bool repeat) : base(paletteState, paletteState, paletteState, paletteState, paletteMetric, buttonValues, VisualOrientation.Top, false) { _dateTimePicker = dateTimePicker; _glyph = glyph; // Assign a controller to handle visual interaction _controller = new ButtonController(this, needPaintHandler) { BecomesFixed = !repeat }; _controller.Click += OnButtonClick; _controller.MouseSelect += OnButtonMouseSelect; _controller.Repeat = repeat; _controller.ClickOnDown = true; MouseController = _controller; }
private void InitializeComponent() { this.kryptonPanel1 = new ComponentFactory.Krypton.Toolkit.KryptonPanel(); this.txtKey = new ComponentFactory.Krypton.Toolkit.KryptonTextBox(); this.label5 = new ComponentFactory.Krypton.Toolkit.KryptonLabel(); this.txtColour = new ComponentFactory.Krypton.Toolkit.KryptonTextBox(); this.tentativeCheckBox = new ComponentFactory.Krypton.Toolkit.KryptonCheckBox(); this.descriptionTextBox = new ComponentFactory.Krypton.Toolkit.KryptonTextBox(); this.addItem = new ComponentFactory.Krypton.Toolkit.KryptonButton(); this.endMinute = new ComponentFactory.Krypton.Toolkit.KryptonComboBox(); this.endHour = new ComponentFactory.Krypton.Toolkit.KryptonNumericUpDown(); this.startMinute = new ComponentFactory.Krypton.Toolkit.KryptonComboBox(); this.startHour = new ComponentFactory.Krypton.Toolkit.KryptonNumericUpDown(); this.label1 = new ComponentFactory.Krypton.Toolkit.KryptonLabel(); this.label2 = new ComponentFactory.Krypton.Toolkit.KryptonLabel(); this.lblDescription = new ComponentFactory.Krypton.Toolkit.KryptonLabel(); this.datePicker = new ComponentFactory.Krypton.Toolkit.KryptonDateTimePicker(); this.lblDate = new ComponentFactory.Krypton.Toolkit.KryptonLabel(); this.kryptonLabel1 = new ComponentFactory.Krypton.Toolkit.KryptonLabel(); ((System.ComponentModel.ISupportInitialize)(this.kryptonPanel1)).BeginInit(); this.kryptonPanel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.endMinute)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.startMinute)).BeginInit(); this.SuspendLayout(); // // kryptonPanel1 // this.kryptonPanel1.Controls.Add(this.txtKey); this.kryptonPanel1.Controls.Add(this.label5); this.kryptonPanel1.Controls.Add(this.txtColour); this.kryptonPanel1.Controls.Add(this.tentativeCheckBox); this.kryptonPanel1.Controls.Add(this.descriptionTextBox); this.kryptonPanel1.Controls.Add(this.addItem); this.kryptonPanel1.Controls.Add(this.endMinute); this.kryptonPanel1.Controls.Add(this.endHour); this.kryptonPanel1.Controls.Add(this.startMinute); this.kryptonPanel1.Controls.Add(this.startHour); this.kryptonPanel1.Controls.Add(this.label1); this.kryptonPanel1.Controls.Add(this.label2); this.kryptonPanel1.Controls.Add(this.lblDescription); this.kryptonPanel1.Controls.Add(this.datePicker); this.kryptonPanel1.Controls.Add(this.lblDate); this.kryptonPanel1.Controls.Add(this.kryptonLabel1); this.kryptonPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.kryptonPanel1.Location = new System.Drawing.Point(0, 0); this.kryptonPanel1.Name = "kryptonPanel1"; this.kryptonPanel1.Size = new System.Drawing.Size(776, 150); this.kryptonPanel1.TabIndex = 0; // // txtKey // this.txtKey.Location = new System.Drawing.Point(456, 109); this.txtKey.Name = "txtKey"; this.txtKey.Size = new System.Drawing.Size(189, 29); this.txtKey.StateCommon.Content.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.txtKey.TabIndex = 51; // // label5 // this.label5.Location = new System.Drawing.Point(405, 112); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(45, 26); this.label5.StateCommon.ShortText.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label5.TabIndex = 50; this.label5.Values.Text = "Key:"; // // txtColour // this.txtColour.Location = new System.Drawing.Point(197, 109); this.txtColour.Name = "txtColour"; this.txtColour.Size = new System.Drawing.Size(202, 29); this.txtColour.StateCommon.Content.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.txtColour.TabIndex = 49; // // tentativeCheckBox // this.tentativeCheckBox.Location = new System.Drawing.Point(12, 112); this.tentativeCheckBox.Name = "tentativeCheckBox"; this.tentativeCheckBox.Size = new System.Drawing.Size(99, 26); this.tentativeCheckBox.StateCommon.ShortText.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.tentativeCheckBox.TabIndex = 35; this.tentativeCheckBox.Values.Text = "Tentative?"; // // descriptionTextBox // this.descriptionTextBox.Location = new System.Drawing.Point(123, 65); this.descriptionTextBox.Name = "descriptionTextBox"; this.descriptionTextBox.Size = new System.Drawing.Size(522, 29); this.descriptionTextBox.StateCommon.Content.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.descriptionTextBox.TabIndex = 48; // // addItem // this.addItem.Location = new System.Drawing.Point(651, 12); this.addItem.Name = "addItem"; this.addItem.Size = new System.Drawing.Size(113, 126); this.addItem.StateCommon.Content.ShortText.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.addItem.TabIndex = 30; this.addItem.Values.Text = "Add Item"; this.addItem.Click += new System.EventHandler(this.addItem_Click); // // endMinute // this.endMinute.DropDownWidth = 40; this.endMinute.FormattingEnabled = true; this.endMinute.Items.AddRange(new object[] { "00", "30" }); this.endMinute.Location = new System.Drawing.Point(586, 12); this.endMinute.Name = "endMinute"; this.endMinute.Size = new System.Drawing.Size(59, 27); this.endMinute.StateCommon.ComboBox.Content.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.endMinute.TabIndex = 47; this.endMinute.Text = "00"; // // endHour // this.endHour.Location = new System.Drawing.Point(534, 12); this.endHour.Maximum = new decimal(new int[] { 23, 0, 0, 0 }); this.endHour.Name = "endHour"; this.endHour.Size = new System.Drawing.Size(46, 28); this.endHour.StateCommon.Content.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.endHour.TabIndex = 46; // // startMinute // this.startMinute.DropDownWidth = 40; this.startMinute.FormattingEnabled = true; this.startMinute.Items.AddRange(new object[] { "00", "30" }); this.startMinute.Location = new System.Drawing.Point(375, 12); this.startMinute.Name = "startMinute"; this.startMinute.Size = new System.Drawing.Size(59, 27); this.startMinute.StateCommon.ComboBox.Content.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.startMinute.StateCommon.Item.Content.ShortText.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.startMinute.TabIndex = 45; this.startMinute.Text = "00"; this.startMinute.TextChanged += new System.EventHandler(this.startMinute_TextChanged); // // startHour // this.startHour.Location = new System.Drawing.Point(323, 12); this.startHour.Maximum = new decimal(new int[] { 23, 0, 0, 0 }); this.startHour.Name = "startHour"; this.startHour.Size = new System.Drawing.Size(46, 28); this.startHour.StateCommon.Content.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.startHour.TabIndex = 31; this.startHour.ValueChanged += new System.EventHandler(this.startHour_ValueChanged); // // label1 // this.label1.Location = new System.Drawing.Point(220, 12); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(97, 26); this.label1.StateCommon.ShortText.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label1.TabIndex = 44; this.label1.Values.Text = "Start Time:"; // // label2 // this.label2.Location = new System.Drawing.Point(440, 12); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(88, 26); this.label2.StateCommon.ShortText.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label2.TabIndex = 43; this.label2.Values.Text = "End Time:"; // // lblDescription // this.lblDescription.Location = new System.Drawing.Point(12, 65); this.lblDescription.Name = "lblDescription"; this.lblDescription.Size = new System.Drawing.Size(105, 26); this.lblDescription.StateCommon.ShortText.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lblDescription.TabIndex = 42; this.lblDescription.Values.Text = "Description:"; // // datePicker // this.datePicker.Format = System.Windows.Forms.DateTimePickerFormat.Short; this.datePicker.Location = new System.Drawing.Point(71, 12); this.datePicker.Name = "datePicker"; this.datePicker.Size = new System.Drawing.Size(143, 27); this.datePicker.StateCommon.Content.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.datePicker.TabIndex = 41; // // lblDate // this.lblDate.Location = new System.Drawing.Point(12, 12); this.lblDate.Name = "lblDate"; this.lblDate.Size = new System.Drawing.Size(53, 26); this.lblDate.StateCommon.ShortText.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lblDate.TabIndex = 40; this.lblDate.Values.Text = "Date:"; // // kryptonLabel1 // this.kryptonLabel1.Location = new System.Drawing.Point(123, 112); this.kryptonLabel1.Name = "kryptonLabel1"; this.kryptonLabel1.Size = new System.Drawing.Size(68, 26); this.kryptonLabel1.StateCommon.ShortText.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.kryptonLabel1.TabIndex = 38; this.kryptonLabel1.Values.Text = "Colour:"; // // AddAppointment // this.ClientSize = new System.Drawing.Size(776, 150); this.Controls.Add(this.kryptonPanel1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D; this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "AddAppointment"; this.ShowIcon = false; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Add New Appointment"; this.Load += new System.EventHandler(this.AddAppointment_Load); ((System.ComponentModel.ISupportInitialize)(this.kryptonPanel1)).EndInit(); this.kryptonPanel1.ResumeLayout(false); this.kryptonPanel1.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.endMinute)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.startMinute)).EndInit(); this.ResumeLayout(false); }
public KryptonDateTimePickerProxy(KryptonDateTimePicker dateTimePicker) { _dateTimePicker = dateTimePicker; }
private void UnmonitorControl(KryptonDateTimePicker c) { c.MouseEnter -= new EventHandler(OnControlEnter); c.MouseLeave -= new EventHandler(OnControlLeave); }
/// <summary> /// Initializes the designer with the specified component. /// </summary> /// <param name="component">The IComponent to associate the designer with.</param> public override void Initialize(IComponent component) { // Let base class do standard stuff base.Initialize(component); // The resizing handles around the control need to change depending on the // value of the AutoSize and AutoSizeMode properties. When in AutoSize you // do not get the resizing handles, otherwise you do. AutoResizeHandles = true; // Cast to correct type _dateTimePicker = component as KryptonDateTimePicker; if (_dateTimePicker != null) { // Hook into date time picker events _dateTimePicker.GetViewManager().MouseUpProcessed += new MouseEventHandler(OnDateTimePickerMouseUp); _dateTimePicker.GetViewManager().DoubleClickProcessed += new PointHandler(OnDateTimePickerDoubleClick); } // Acquire service interfaces _designerHost = (IDesignerHost)GetService(typeof(IDesignerHost)); _changeService = (IComponentChangeService)GetService(typeof(IComponentChangeService)); _selectionService = (ISelectionService)GetService(typeof(ISelectionService)); // We need to know when we are being removed _changeService.ComponentRemoving += new ComponentEventHandler(OnComponentRemoving); }
/// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing) { if (_dateTimePicker != null) { UnmonitorControl(_dateTimePicker); _dateTimePicker.Dispose(); _dateTimePicker = null; } } base.Dispose(disposing); }
protected override Control InitialControl() { if (IsScoped) { Panel ctl = new Panel(); ctl.BackColor = Color.Transparent; KryptonDateTimePicker begin = new KryptonDateTimePicker(); KryptonDateTimePicker end = new KryptonDateTimePicker(); KryptonLabel lbl = new KryptonLabel(); begin.Width = Width / 2 - 7; begin.Dock = DockStyle.Left; begin.Format = DateTimePickerFormat.Custom; begin.CustomFormat = DateTimeFormat; end.Width = Width / 2 - 7; end.Dock = DockStyle.Right; end.Format = DateTimePickerFormat.Custom; end.CustomFormat = DateTimeFormat; lbl.Text = "-"; lbl.Dock = DockStyle.Fill; lbl.LabelStyle = LabelStyle.NormalPanel; ctl.Controls.Add(lbl); ctl.Controls.Add(begin); ctl.Controls.Add(end); ctl.Height = begin.Height; return ctl; } else { KryptonDateTimePicker ctl = new KryptonDateTimePicker(); ctl.Format = DateTimePickerFormat.Custom; ctl.CustomFormat = DateTimeFormat; return ctl; } }
protected void SaveData() { this.Data.Objects.ClearData(this.obj); foreach (Control ctrl in this.controls) { Field field = (Field)ctrl.Tag; switch (field.FieldType) { case FieldType.Boolean: KryptonCheckBox check = (KryptonCheckBox)ctrl; this.obj[field] = check.Checked; break; case FieldType.Date: KryptonDateTimePicker date = (KryptonDateTimePicker)ctrl; if (date.Checked) { this.obj[field] = date.Value; } else { this.obj[field] = DateTime.MinValue; } break; case FieldType.Image: if (ctrl is ImageSelectBase) { this.obj[field] = ((ImageSelectBase)ctrl).CreateImageData(); } break; case FieldType.List: ListData ld = (ListData)this.obj[field]; foreach (ObjectData od in ((ListBoxControl)ctrl).ListData) { ld.Objects.Add(od); } break; case FieldType.Memo: KryptonTextBox memo = (KryptonTextBox)ctrl; this.obj[field] = memo.Text; break; case FieldType.Number: TextBoxNumber num = (TextBoxNumber)ctrl; this.obj[field] = num.Value; break; case FieldType.Rating: TextBoxNumber raiting = (TextBoxNumber)ctrl; this.obj[field] = raiting.Value; break; case FieldType.Reference: KryptonComboBox box = (KryptonComboBox)ctrl; if (box.SelectedIndex == -1) { this.obj[field] = 0; } else { this.obj[field] = (ObjectData)box.SelectedItem; } break; case FieldType.Select: KryptonComboBox selectBox = ctrl as KryptonComboBox; this.obj[field] = selectBox.SelectedIndex; break; case FieldType.Text: KryptonTextBox text = ctrl as KryptonTextBox; this.obj[field] = text.Text; break; case FieldType.Url: KryptonTextBox url = ctrl as KryptonTextBox; this.obj[field] = url.Text; break; case FieldType.Table: this.obj[field] = ((TableControl)ctrl).CreateTableData(); break; } } foreach (Field f in this.updatedFields.Keys) { this.obj[f] = this.updatedFields[f]; } if (obj.IsNew) { database.Objects.Add(this.obj); } else { database.Objects.Update(this.obj); } }