/// <summary> /// Initialize a new instance of the KryptonMonthCalendarActionList class. /// </summary> /// <param name="owner">Designer that owns this action list instance.</param> public KryptonMonthCalendarActionList(KryptonMonthCalendarDesigner owner) : base(owner.Component) { // Remember the bread crumb control instance _monthCalendar = owner.Component as KryptonMonthCalendar; // Cache service used to notify when a property has changed _service = (IComponentChangeService)GetService(typeof(IComponentChangeService)); }
/// <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) { // Validate the parameter reference if (component == null) throw new ArgumentNullException("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 _monthCalendar = component as KryptonMonthCalendar; if (_monthCalendar != null) { // Hook into header event _monthCalendar.GetViewManager().MouseUpProcessed += new MouseEventHandler(OnCalendarMouseUp); _monthCalendar.GetViewManager().DoubleClickProcessed += new PointHandler(OnCalendarDoubleClick); } // 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); }
public void PopulateHolidayAndWeekOffViews() { btnDeleteHoliday.Visible = true; ServiceHolidayAndWeekOffs _service = new ServiceHolidayAndWeekOffs(); try { tbl_Acct_Financial_Year model = (new ServiceMASTERS()).GetFinancialYearDbRecordByID(this.SelectedFYID); if (model != null) { this.SuspendLayout(); monthViewControl = new ComponentFactory.Krypton.Toolkit.KryptonMonthCalendar(); //monthViewControl.MaxDate = DateTime.Now; //monthViewControl.MinDate = DateTime.Now; monthViewControl.MinDate = (DateTime)model.FromDate; monthViewControl.MaxDate = (DateTime)model.ToDate; monthViewControl.DateChanged += _Calender_DateChanged; //_Calender.DayStyle = ButtonStyle.Standalone; //_Calender.OverrideBolded.Day.Back.Color1 = System.Drawing.Color.Red; //_Calender.HeaderStyle = HeaderStyle.Primary; monthViewControl.SelectionStart = (DateTime)model.FromDate; monthViewControl.SelectionEnd = (DateTime)model.FromDate; monthViewControl.MaxSelectionCount = 1; monthViewControl.ShowToday = false; monthViewControl.ShowTodayCircle = false; List <TBL_MP_HR_HolidaysAndWeekOff> lstHolidays = _service.GetAllHolidaysForTheFinYear(this.SelectedFYID); _HolidayAndWeekOffList = new BindingList <SelectListItem>(); foreach (TBL_MP_HR_HolidaysAndWeekOff item in lstHolidays) { monthViewControl.AddBoldedDate(item.HolidayDate); _HolidayAndWeekOffList.Add(new SelectListItem() { ID = item.PK_HolidayID, Code = item.HolidayDate.ToString("dd MMM yyyy"), Description = item.Remarks }); } gridHolidaysAndWeekOffs.DataSource = _HolidayAndWeekOffList; //make these columns hidden PK_HolidayID, FK_YearID, HolidayType gridHolidaysAndWeekOffs.Columns["ID"].Visible = gridHolidaysAndWeekOffs.Columns["DescriptionToUpper"].Visible = gridHolidaysAndWeekOffs.Columns["IsActive"].Visible = false; this.monthViewControl.CalendarDimensions = new System.Drawing.Size(4, 3); this.monthViewControl.DayOfWeekStyle = ComponentFactory.Krypton.Toolkit.ButtonStyle.Alternate; this.monthViewControl.DayStyle = ComponentFactory.Krypton.Toolkit.ButtonStyle.Standalone; this.monthViewControl.Dock = System.Windows.Forms.DockStyle.Fill; this.monthViewControl.Location = new System.Drawing.Point(0, 0); this.monthViewControl.OverrideBolded.Day.Back.Color1 = System.Drawing.Color.Yellow; this.monthViewControl.OverrideBolded.Day.Back.Color2 = System.Drawing.Color.Red; this.monthViewControl.OverrideBolded.Day.Back.ColorStyle = ComponentFactory.Krypton.Toolkit.PaletteColorStyle.Solid; //this._Calender.OverrideBolded.Day.Border.Color1 = System.Drawing.Color.Lime; //this._Calender.OverrideBolded.Day.Border.ColorStyle = ComponentFactory.Krypton.Toolkit.PaletteColorStyle.Solid; //this._Calender.OverrideBolded.Day.Border.DrawBorders = ((ComponentFactory.Krypton.Toolkit.PaletteDrawBorders)((((ComponentFactory.Krypton.Toolkit.PaletteDrawBorders.Top | ComponentFactory.Krypton.Toolkit.PaletteDrawBorders.Bottom) //| ComponentFactory.Krypton.Toolkit.PaletteDrawBorders.Left) //| ComponentFactory.Krypton.Toolkit.PaletteDrawBorders.Right))); //this._Calender.OverrideBolded.Day.Border.Width = 1; this.monthViewControl.OverrideBolded.Day.Content.ShortText.Color1 = System.Drawing.Color.Red; this.monthViewControl.OverrideBolded.Day.Content.LongText.Color2 = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(64)))), ((int)(((byte)(0))))); this.monthViewControl.OverrideBolded.Day.Content.ShortText.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.monthViewControl.OverrideBolded.Day.Content.ShortText.TextH = ComponentFactory.Krypton.Toolkit.PaletteRelativeAlign.Center; this.monthViewControl.OverrideBolded.Day.Content.ShortText.TextV = ComponentFactory.Krypton.Toolkit.PaletteRelativeAlign.Center; headerGroupCalendarView.Panel.Controls.Clear(); headerGroupCalendarView.Panel.Controls.Add(monthViewControl); monthViewControl.Show(); this.ResumeLayout(false); //monthViewControl.Dock = DockStyle.Fill; headerGroupRight.ValuesPrimary.Heading = string.Format("FA: {0} till {1}", model.FromDate.ToString("dd MMMM yyyy"), model.ToDate.ToString("dd MMMM yyyy ")); headerGroupRight.ValuesPrimary.Description = string.Format("Holidays: {0} Week-offs: {1}", _service.GetHolidayCountForYear(this.SelectedFYID), _service.GetWeekOffCountForYear(this.SelectedFYID)); } } catch (Exception ex) { string errMessage = ex.Message; if (ex.InnerException != null) { errMessage += string.Format("\n{0}", ex.InnerException.Message); } MessageBox.Show(errMessage, "PageHolidayAndWeekOffs::PopulateHolidayAndWeekOffViews", MessageBoxButtons.OK, MessageBoxIcon.Error); } }