public void SetEngine(CalendarLayoutEngine engine)
        {
            if (layoutEngine == engine)
            {
                return;
            }

            layoutEngine = engine;
            font         = new Font("Arial", engine.FontSize);
            fontFamily   = new FontFamily("Arial");
            BackColor    = Color.FromArgb(unchecked ((int)0xffdee6ce));

            PrevMonthBtn.Location = engine.PrevMonthBtnPosition
                                    - new Size(PrevMonthBtn.Width >> 1, PrevMonthBtn.Height >> 1);
            NextMonthBtn.Location = engine.NextMonthBtnPosition
                                    - new Size(NextMonthBtn.Width >> 1, NextMonthBtn.Height >> 1);
            PrevYearBtn.Location = engine.PrevYearBtnPosition
                                   - new Size(PrevYearBtn.Width >> 1, PrevYearBtn.Height >> 1);
            NextYearBtn.Location = engine.NextYearBtnPosition
                                   - new Size(NextYearBtn.Width >> 1, NextYearBtn.Height >> 1);
            SetDayBtn.Location = engine.SetDayBtnPosition
                                 - new Size(SetDayBtn.Width >> 1, SetDayBtn.Height >> 1);
            CloseBtn.Location = engine.CloseBtnPosition
                                - new Size(CloseBtn.Width >> 1, CloseBtn.Height >> 1);
        }
Ejemplo n.º 2
0
 private void InitializeLayoutEngine()
 {
     try
     {
         Assembly dll    = Assembly.LoadFrom("./Plugin/Anniversary/CalendarFlatLayout.dll");
         Type     leType = dll.GetType("CalendarLayout.CalendarFlatLayout", true);
         layoutEngine = Activator.CreateInstance(leType, null) as CalendarLayoutEngine;
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message, "Anniversary", MessageBoxButtons.OK, MessageBoxIcon.Error);
         //For single layout engine DLL
         //If has other vailed DLL , we should choose another one , not throw the exeption
         throw new ApplicationException("Layout Engine Error", e);
     }
 }