Exemplo n.º 1
0
        public override System.Windows.Forms.Control ShowControl(Rectangle valueRect, PropertyEnumerator propEnum)
        {
            PropInPlaceMaskedTextbox edit;

            if (mInPlaceCtrl == null)
            {
                edit         = new PropInPlaceMaskedTextbox();
                edit.Visible = false;
                edit.Parent  = mParentWnd;
                mInPlaceCtrl = edit;
            }
            else
            {
                edit = (PropInPlaceMaskedTextbox)mInPlaceCtrl;
            }

            NotifyInPlaceControlCreated(propEnum);

            if (propEnum.Property.Value.Look is PropertyMaskedEditLook)
            {
                edit.Mask       = (propEnum.Property.Value.Look as PropertyMaskedEditLook).Mask;
                edit.PromptChar = (propEnum.Property.Value.Look as PropertyMaskedEditLook).PromptChar;
            }

            edit.OwnerPropertyEnumerator = propEnum;
            edit.Font = propEnum.Property.Value.Font;

            MoveControl(valueRect, propEnum);

            /*
             * if (edit.Focused == false)		// are we already being editing ? If yes, don't touch the edit content
             *  {
             *  if (edit.Text != propEnum.Property.Value.DisplayString)
             *      edit.Text = propEnum.Property.Value.DisplayString;
             * }
             */
            base.ShowControl(valueRect, propEnum);

            // This one + the one in PropInPlaceMaskedTextbox.OnGotFocus are necessary so that when the
            // user clicks for the first time in the MaskedTextox, it doesn't scroll oddly to the right of the box.
            // I guess this is a bug of the .NET framework since this doesn't occur with a regular TextBox.
//            edit.Select(0, 0);

            return(edit);
        }
Exemplo n.º 2
0
        public override System.Windows.Forms.Control ShowControl(Rectangle valueRect, PropertyEnumerator propEnum)
        {
            PropInPlaceMaskedTextbox edit;

	        if (mInPlaceCtrl == null)
	        {
                edit = new PropInPlaceMaskedTextbox();
                edit.Visible = false;
                edit.Parent = mParentWnd;
                mInPlaceCtrl = edit;
            }
	        else
                edit = (PropInPlaceMaskedTextbox)mInPlaceCtrl;

            NotifyInPlaceControlCreated(propEnum);

            if (propEnum.Property.Value.Look is PropertyMaskedEditLook)
            {
                edit.Mask = (propEnum.Property.Value.Look as PropertyMaskedEditLook).Mask;
                edit.PromptChar = (propEnum.Property.Value.Look as PropertyMaskedEditLook).PromptChar;
            }

	        edit.OwnerPropertyEnumerator = propEnum;
            edit.Font = propEnum.Property.Value.Font;

            MoveControl(valueRect, propEnum);
            /*
            if (edit.Focused == false)		// are we already being editing ? If yes, don't touch the edit content
	        {
                if (edit.Text != propEnum.Property.Value.DisplayString)
                    edit.Text = propEnum.Property.Value.DisplayString;
            }
            */
            base.ShowControl(valueRect, propEnum);

            // This one + the one in PropInPlaceMaskedTextbox.OnGotFocus are necessary so that when the
            // user clicks for the first time in the MaskedTextox, it doesn't scroll oddly to the right of the box.
            // I guess this is a bug of the .NET framework since this doesn't occur with a regular TextBox.
//            edit.Select(0, 0);

            return edit;
        }