Example #1
0
        // ------------------------------------------------------------------------

        public DayViewPreferencesDlg(Translator trans, Font font)
        {
            m_Trans = trans;

            InitializeComponent();

            DialogUtils.SetFont(this, font);
            m_Trans.Translate(this);

            // Build 'slot minutes' combo
            var slotMins = new int[] { 5, 10, 15, 20, 30, 60 };

            foreach (var mins in slotMins)
            {
                m_SlotMinuteCombo.Items.Add(new SlotMinutesItem(mins, m_Trans));
            }

            // Build 'slot height' combo
            var slotHeights = new int[] { 5, 10, 15, 20, 25 };

            foreach (var height in slotHeights)
            {
                m_MinSlotHeightCombo.Items.Add(height);
            }
        }
Example #2
0
        protected override void PreShowDialog(Form dialog)
        {
            base.PreShowDialog(dialog);

            // Operations that change dialog size
            DialogUtils.SetFont(dialog, m_ControlsFont);
            m_Trans.Translate(dialog);

            // Centre dialogs over our client area
            dialog.StartPosition = FormStartPosition.Manual;

            Rectangle parentPos    = RectangleToScreen(Bounds);
            Point     parentCentre = new Point((parentPos.Right + parentPos.Left) / 2, (parentPos.Bottom + parentPos.Top) / 2);

            int dialogLeft = (parentCentre.X - (dialog.Width / 2));
            int dialogTop  = (parentCentre.Y - (dialog.Height / 2));

            // but keep within screen
            Rectangle screenArea = Screen.FromControl(this).WorkingArea;

            dialogLeft = Math.Max(screenArea.Left, dialogLeft);
            dialogLeft = Math.Min(screenArea.Right - dialog.Width, dialogLeft);

            dialogTop = Math.Max(screenArea.Top, dialogTop);
            dialogTop = Math.Min(screenArea.Bottom - dialog.Height, dialogTop);

            dialog.Location = new Point(dialogLeft, dialogTop);

            // Add icon for identification
            dialog.ShowIcon = true;
            dialog.Icon     = HTMLContentControlCore.html;

            // Per dialog customisations
            if (dialog is MSDN.Html.Editor.EnterHrefForm)
            {
                var urlDialog = (dialog as MSDN.Html.Editor.EnterHrefForm);

                urlDialog.EnforceHrefTarget(MSDN.Html.Editor.NavigateActionOption.Default);
                urlDialog.LastBrowsedFolder = LastBrowsedFileFolder;
            }
            else if (dialog is MSDN.Html.Editor.EnterImageForm)
            {
                var imageDialog = (dialog as MSDN.Html.Editor.EnterImageForm);

                imageDialog.LastBrowsedFolder = LastBrowsedImageFolder;
            }
        }