예제 #1
0
        private void InternalConstruct(ImageList imageList,
                                       int imageIndexEnabled,
                                       int imageIndexDisabled,
                                       ImageAttributes imageAttr)
        {
            // NAG processing
            NAG.NAG_Start();

            // Remember parameters
            _imageList          = imageList;
            _imageIndexEnabled  = imageIndexEnabled;
            _imageIndexDisabled = imageIndexDisabled;
            _imageAttr          = imageAttr;

            // Set initial state
            _borderWidth  = 2;
            _mouseOver    = false;
            _mouseCapture = false;
            _popupStyle   = true;
            _mouseButton  = MouseButtons.None;

            // Prevent drawing flicker by blitting from memory in WM_PAINT
            SetStyle(ControlStyles.DoubleBuffer |
                     ControlStyles.AllPaintingInWmPaint |
                     ControlStyles.UserPaint, true);

            // Prevent base class from trying to generate double click events and
            // so testing clicks against the double click time and rectangle. Getting
            // rid of this allows the user to press then button very quickly.
            SetStyle(ControlStyles.StandardDoubleClick, false);

            // Should not be allowed to select this control
            SetStyle(ControlStyles.Selectable, false);
        }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the ButtonWithStyle class.
        /// </summary>
        public ButtonWithStyle()
        {
            // NAG processing
            NAG.NAG_Start();

            // Prevent drawing flicker by blitting from memory in WM_PAINT
            SetStyle(ControlStyles.DoubleBuffer |
                     ControlStyles.AllPaintingInWmPaint |
                     ControlStyles.UserPaint |
                     ControlStyles.ResizeRedraw, true);

            // Prevent base class from trying to generate double click events and
            // so testing clicks against the double click time and rectangle. Getting
            // rid of this allows the user to press then button very quickly.
            SetStyle(ControlStyles.StandardDoubleClick, false);

            // Should not be allowed to select this control
            SetStyle(ControlStyles.Selectable, false);

            // We do not want a mouse up to always cause a click, we decide that
            SetStyle(ControlStyles.StandardClick, false);

            // We are happy to allow a transparent background color
            SetStyle(ControlStyles.SupportsTransparentBackColor, true);

            // Set initial state
            _image        = new CommandImage();
            _mouseOver    = false;
            _staticIDE    = false;
            _mouseCapture = false;
            _mouseButton  = MouseButtons.None;
            _colorDetails = new ColorDetails();

            // Update with the tracking colors for the IDE style
            _colorDetails.DefineTrackColors(SystemColors.Highlight);

            // We need to know when our text changes
            TextChanged += new EventHandler(OnTextChanged);

            // Reset all properties to default values
            ResetImage();
            ResetStyle();
            ResetDirection();
            ResetTextEdge();
            ResetButtonStyle();
            ResetPushed();
            ResetBackColor();
            ResetAlwaysDrawEnabled();
            ResetAlwaysDrawBorder();
            ResetOffice2003GradBack();
            ResetIDE2005GradBack();
        }
예제 #3
0
        /// <summary>
        /// Initializes a new instance of the StatusBarControl class.
        /// </summary>
        public StatusBarControl()
        {
            // NAG processing
            NAG.NAG_Start();

            // Prevent drawing flicker by blitting from memory in WM_PAINT
            SetStyle(ControlStyles.DoubleBuffer |
                     ControlStyles.AllPaintingInWmPaint |
                     ControlStyles.ResizeRedraw |
                     ControlStyles.UserPaint, true);

            // Should not be allowed to select this control
            SetStyle(ControlStyles.Selectable, false);

            // Create collection to hold panels
            _panels = new StatusPanelCollection();

            // Hook into collection changes
            _panels.Inserted += new CollectionChange(OnPanelInserted);
            _panels.Removed  += new CollectionChange(OnPanelRemoved);
            _panels.Clearing += new CollectionClear(OnPanelsClearing);
            _panels.Cleared  += new CollectionClear(OnPanelsCleared);

            // Create helper for drawing themes
            _colorDetails = new ColorDetails();

            // Background color is defaulted
            _defaultBackColor = true;

            ResetBackColor();
            ResetStyle();
            ResetSizingGrip();
            ResetDock();
            ResetPadLeft();
            ResetPadRight();
            ResetPadTop();
            ResetPadBottom();
            ResetOffice2003GradBack();
            ResetIDE2005GradBack();

            // Set default height of control to be the font plus 4 pixels for panel
            // border control and also the padding at top and bottom
            this.Height = Font.Height + PadTop + PadBottom + 4;
        }
예제 #4
0
 /// <summary>
 /// Initialize a new instance of the ToolControl class.
 /// </summary>
 public ToolControl()
 {
     // NAG processing
     NAG.NAG_Start();
 }