public MenuStripW(IContainer container)
        {
            container.Add(this);

            InitializeComponent();

            ToolStripProfessionalRenderer toolStripRenderer = new Office2007Renderer();
            Panels.ProfessionalColorTable colorTable = new Office2007BlueColorTable();
            // XiaoCai.WinformUI.Panels.ProfessionalColorTable colorTable = new OfficeColorTable();
            //XiaoCai.WinformUI.Panels.ProfessionalColorTable colorTable = new Office2007BlueColorTable();
            //XiaoCai.WinformUI.Panels.ProfessionalColorTable colorTable = new Office2007BlackColorTable();
            PanelColors panelColorTable = colorTable.PanelColorTable;
            if (panelColorTable != null)
            {
                ControlCollection controls = new ControlCollection(this);
                PanelSettingsManager.SetPanelProperties(
                    //this.Controls,
                    controls,
                    panelColorTable);
            }
            this.m_currentToolStripRenderer = toolStripRenderer;
            if (colorTable.Equals(this.m_currentProfessionalColorTable) == false)
            {
                this.m_currentProfessionalColorTable = colorTable;
                object renderer = Activator.CreateInstance(this.m_currentToolStripRenderer.GetType(), new object[] { colorTable });
                this.m_currentToolStripRenderer = renderer as ToolStripProfessionalRenderer;
                ToolStripManager.Renderer = this.m_currentToolStripRenderer;
            }
        }
 private void LoadAndSetupConfiguration(ControlCollection controls)
 {
     foreach (var control in controls)
     {
         if (control is TextBox || control is CueTextBox)
         {
             var tb = (TextBox)control;
             tb.Text = ConfigRepository.Instance()[tb.Name];
         }
         else if (control is ComboBox)
         {
             var cb = (ComboBox)control;
             var value = ConfigRepository.Instance()[cb.Name];
             if (!String.IsNullOrEmpty(cb.ValueMember))
                 cb.SelectedValue = value;
             else
                 cb.SelectedItem = value;
         }
         else if (control is CheckBox)
         {
             var ch = (CheckBox)control;
             ch.Checked = ConfigRepository.Instance().GetBoolean(ch.Name);
         }
         else if (control is NumericUpDown)
         {
             var nud = (NumericUpDown)control;
             nud.Value = ConfigRepository.Instance().GetDecimal(nud.Name);
         }
         else if (control is GroupBox)
             LoadAndSetupConfiguration(((GroupBox)control).Controls);
     }
 }
Example #3
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="Control" /> class.
        /// </summary>
        public Control()
        {
            Active = false;
            Enabled = true;
            CanFocus = true;
            Visible = true;

            Controls = new ControlCollection(this);

            KeyUp += OnKeyUp;
            KeyDown += OnKeyDown;
            MouseEnter += OnMouseEnter;
            MouseLeave += OnMouseLeave;
            MouseDown += OnMouseDown;
            MouseUp += OnMouseUp;
            MouseScroll += OnMouseScroll;
            Enter += OnEnter;
            Leave += OnLeave;
            MouseClick += OnMouseClick;
            MouseDoubleClick += OnMouseDoubleClick;

            isMouseDown.Add(MouseButton.Left, false);
            isMouseDown.Add(MouseButton.Middle, false);
            isMouseDown.Add(MouseButton.Right, false);
            isMouseDown.Add(MouseButton.XButton1, false);
            isMouseDown.Add(MouseButton.XButton2, false);
        }
Example #4
0
        private void AoAlterarEntidade(Entidades.Pessoa.Funcionário funcionário, ControlCollection controles)
        {
            foreach (Control controle in controles)
            {
                AoAlterarEntidade(funcionário, controle.Controls);

                if (controle is ChkPermissão)
                    ((ChkPermissão)controle).AoAlterarEntidade(funcionário);
            }
        }
		private void InitCollections()
		{
			controls = new ControlCollection( control.Controls );
			
			// These will be initialized as needed
			buttons = null;
			labels = null;
			textboxes = null;
			combos = null;
		}
 protected void DisposeAllControls(ControlCollection controls, bool throwErr)
 {
     foreach (Control cn in controls)
     {
         this.DisposeAllControls(cn.Controls);
         try
         { cn.Dispose(); }
         catch
         { if (throwErr) throw; }
     }
 }
			/// <summary>
			/// Initializes a new instance of the <see cref="SlideManager"/> class.
			/// </summary>
			public SlideManager(ControlCollection ctrls, ImageTracker imageTracker)
			{
				Debug.Assert(ctrls != null, "ctrls != null");
				_ctrls = ctrls;

				Debug.Assert(imageTracker != null, "imageTracker != null");
				_imageTracker = imageTracker;
				_imageTracker.ImageAdded += _imageTracker_ImageAdded;
				_imageTracker.ImageInserted += _imageTracker_ImageInserted;
				_imageTracker.ImageRemoved += _imageTracker_ImageRemoved;

				_imageSlideDictionary = new Dictionary<Image, NuGenSlide>();
			}
        private static Control FindInputFocus(ControlCollection cc)
        {
            if(cc == null) { Debug.Assert(false); return null; }

            foreach(Control c in cc)
            {
                if(c.Focused)
                    return c;
                else if(c.ContainsFocus)
                    return FindInputFocus(c.Controls);
            }

            return null;
        }
        public SyntaxHighlightingMenager(TagsStorage tagsStorage)
        {
            //
            this.controls = new ControlCollection();
            this.controls.ControlAdded += new EventHandler(controls_ControlAdded);

            //
            TagsShow tagsShow = new TagsShow(tagsStorage);
            tagsShow.ShowOnlyTagsOfObjectType = true;
            // get array list of tags from tagsStorage object
            tagsList = tagsShow.GetTagsList();

            // costum sort
            TagsSortClass tagsSortClass = new TagsSortClass();
            tagsList.Sort(tagsSortClass);
            Log.Write(tagsList, this, "SyntaxHighlightingMenager", Log.LogType.DEBUG);
        }
Example #10
0
        public TabControl()
        {
            Controls = new ControlCollection(this);
            TabPages = new TabPageCollection(this);

            BorderColor = Color.FromArgb(172, 172, 172);
            ItemSize = new Size(42, 30);
            Padding = new Padding(3);
            Size = new Size(200, 100);

            pagesButtonsPanel = new Control();
            pagesButtonsPanel.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
            pagesButtonsPanel.BackColor = Color.Transparent;
            pagesButtonsPanel.Name = "buttonsPanel";
            pagesButtonsPanel.Size = new Size(Width, ItemSize.Height);

            (Controls as ControlCollection).AddInternal(pagesButtonsPanel);
        }
        private List<int> GetListTags(ControlCollection controls)
        {
            List<int> ret = new List<int>();
            foreach (Control cntrl in controls)
            {
                if (cntrl is FlowLayoutPanel)
                {
                    ret.AddRange(GetListTags(cntrl.Controls));
                    continue;
                }

                Tmp = (cntrl as CheckBox);

                if (Tmp != null && Tmp.Checked && Tmp.Tag != null)
                    ret.Add(int.Parse(Tmp.Tag.ToString()));
            }

            return ret;
        }
			public ThumbnailManager(
				INuGenServiceProvider serviceProvider
				, ControlCollection ctrls
				, ImageTracker imageTracker
				)
			{
				Debug.Assert(serviceProvider != null, "serviceProvider != null");
				_serviceProvider = serviceProvider;

				Debug.Assert(ctrls != null, "ctrls != null");
				_ctrls = ctrls;

				Debug.Assert(imageTracker != null, "imageTracker != null");
				_imageTracker = imageTracker;
				_imageTracker.ImageAdded += _imageTracker_ImageAdded;
				_imageTracker.ImageInserted += _imageTracker_ImageInserted;
				_imageTracker.ImageRemoved += _imageTracker_ImageRemoved;

				_imageThumbDictionary = new Dictionary<Image, NuGenThumbnail>();
			}
        public void SetStyle(Style style)
        {
            ToolStripProfessionalRenderer toolStripRenderer = new Office2007Renderer();
            Panels.ProfessionalColorTable colorTable = StyleBuilderFactory.GetOffice2007ColorTable(style);

            PanelColors panelColorTable = colorTable.PanelColorTable;
            if (panelColorTable != null)
            {
                ControlCollection controls = new ControlCollection(this);
                PanelSettingsManager.SetPanelProperties(
                    //this.Controls,
                    controls,
                    panelColorTable);
            }
            this.m_currentToolStripRenderer = toolStripRenderer;
            if (colorTable.Equals(this.m_currentProfessionalColorTable) == false)
            {
                this.m_currentProfessionalColorTable = colorTable;
                object renderer = Activator.CreateInstance(this.m_currentToolStripRenderer.GetType(), new object[] { colorTable });
                this.m_currentToolStripRenderer = renderer as ToolStripProfessionalRenderer;
                ToolStripManager.Renderer = this.m_currentToolStripRenderer;
            }
            this.Refresh();
        }
Example #14
0
 void AttachControlsEvents(ControlCollection controls)
 {
     foreach(Control ctrl in controls)
       {
     ctrl.Click += this_Click;
     AttachControlsEvents(ctrl.Controls);
       }
 }
Example #15
0
 private void DefinirDetectorMudanca(ControlCollection Controls, bool definir = true)
 {
     foreach (Control ctrl in Controls)
     {
         if (ctrl.Controls.Count > 0)
             DefinirDetectorMudanca(ctrl.Controls, definir);
         else
             ctrl.TextChanged -= DetectorMundanca;
         if (definir)
             ctrl.TextChanged += DetectorMundanca;
     }
 }
Example #16
0
 void ClearPanel(ControlCollection controls)
 {
     foreach (Control control in controls)
     {
         if (control.GetType() == typeof(TextEdit))
             (control as TextEdit).Text = "";
         else if (control.GetType() == typeof(LookUpEdit))
             (control as LookUpEdit).EditValue = null;
         else if (control.GetType() == typeof(ButtonEdit))
             (control as ButtonEdit).EditValue = null;
         else if (control.GetType() == typeof(SpinEdit))
             (control as SpinEdit).EditValue = 0;
         else if (control.GetType() == typeof(ComboBoxEdit))
             (control as ComboBoxEdit).Text = "";
     }
 }
Example #17
0
        /*private  string GetCodeWord(string controlname)
        {

            if (controlname != null)
            {

                int pos = controlname.IndexOf('_');

                if (pos > 0)
                {
                    return controlname.Substring(pos + 1).ToLower();
                }
            }
            return null;
        }*/
        private void AssignControlsStyle(ControlCollection controls)
        {
            Color backColor = Color.FromArgb(122, 150, 223);

            foreach (object var in controls)
            {
                PropertyInfo pr = var.GetType().GetProperty("ToolTipController");
                if (pr != null)
                    pr.SetValue(var, toolTip, null);

                GridControl gridc = var as GridControl;
                if (gridc != null)
                {
                    gridc.ToolTipController = toolTip;
                    foreach (ColumnView bview in gridc.Views)
                    {
                        foreach (GridColumn column in bview.Columns)
                        {
                            string key = column.Name + "_Tip";
                            string tip = GetLocalized(key);
                            if (tip != null)
                                column.ToolTip = tip;
                            else
                            {
                                string caption = GetLocalized(column.Name);
                                if (caption != null)
                                    column.ToolTip = caption;
                            }
                        }

                        GridView gview = bview as GridView;
                        if (gview != null)
                        {
                            gview.Appearance.FocusedCell.BackColor = backColor;
                            gview.Appearance.FocusedRow.BackColor = backColor;
                            gview.Appearance.SelectedRow.BackColor = backColor;
                        }
                    }
                }
                else
                {
                    VGridControl vgrid = var as VGridControl;
                    if (vgrid != null)
                    {
                        vgrid.ToolTipController = toolTip;
                        vgrid.Appearance.FocusedCell.BackColor = backColor;
                        vgrid.Appearance.FocusedRecord.BackColor = backColor;
                    }
                    else
                    {
                        TreeList tlist = var as TreeList;
                        if (tlist != null)
                        {
                            tlist.Appearance.FocusedCell.BackColor = backColor;
                            tlist.Appearance.FocusedRow.BackColor = backColor;
                            tlist.Appearance.SelectedRow.BackColor = backColor;
                        }
                        else
                        {
                            LayoutControl lcontr = var as LayoutControl;
                            if (lcontr != null)
                            {
                                AssignControlsStyle(lcontr.Controls);
                                //lcontr.Root.GroupBordersVisible = false;
                            }
                            else
                            {
                                PanelControl panel = var as PanelControl;
                                if (panel != null)
                                {
                                    AssignControlsStyle(panel.Controls);
                                    //panel.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
                                }
                            }
                        }
                    }
                }
            }
        }
 public void InitEx(ControlCollection cc, Control cDefault)
 {
     m_ccControls = cc;
     m_cDefault = m_cLastKnown = cDefault;
 }
 void AttachSubControlsMouseEvents(ControlCollection controls)
 {
     foreach(Control ctrl in controls)
       {
     ctrl.MouseDown += new MouseEventHandler(ctrl_MouseDown);
     ctrl.MouseUp += new MouseEventHandler(ctrl_MouseUp);
     ctrl.MouseMove += new MouseEventHandler(ctrl_MouseMove);
     ctrl.MouseDoubleClick += new MouseEventHandler(ctrl_MouseDoubleClick);
     AttachSubControlsMouseEvents(ctrl.Controls);
       }
 }
Example #20
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Control"/> class.
        /// </summary>
        public Control()
        {
            this.Active = false;
            this.Enabled = true;
            this.CanFocus = true;
            this.Visible = true;

            this.Controls = new ControlCollection(this);

            this.KeyUp += OnKeyUp;
            this.KeyDown += OnKeyDown;
            this.MouseEnter += OnMouseEnter;
            this.MouseLeave += OnMouseLeave;
            this.MouseDown += OnMouseDown;
            this.MouseUp += OnMouseUp;
            this.MouseScroll += OnMouseScroll;
            this.Enter += OnEnter;
            this.Leave += OnLeave;
            this.MouseClick += OnMouseClick;
            this.MouseDoubleClick += OnMouseDoubleClick;

            this.isMouseDown.Add(MouseButton.Left, false);
            this.isMouseDown.Add(MouseButton.Middle, false);
            this.isMouseDown.Add(MouseButton.Right, false);
            this.isMouseDown.Add(MouseButton.XButton1, false);
            this.isMouseDown.Add(MouseButton.XButton2, false);
        }
		/// <summary>
		/// Adds a new one-line, bold label to a controls collection
		/// </summary>
		/// <param name="text">The text for the label</param>
		/// <param name="controls">The collection to add the label to</param>
		private void AddNewLabel(string text, ControlCollection controls)
		{
			Label label = new Label()
			{
				Visible = false,
				AutoSize = false,
				Dock = DockStyle.Top,
				Height = 16,
				Font = new Font("Arial", 8, FontStyle.Bold),
				Text = text
			};

			controls.Add(label);
			label.BringToFront();
		}
Example #22
0
 ///
 private void RemoveHandler(ControlCollection coll, EventHandler e)
 {
     foreach (Control control in coll)
     {
         control.DoubleClick -= e;
         this.AddHandler(control.Controls, e);
     }
 }
        private static HidButton FindMatchingButton(ControlCollection controls, KeyEventArgs e)
        {
            foreach (Control c in controls)
            {
                if (c is HidButton)
                {
                    HidButton button = (HidButton)c;
                    if (button.CatchKey == (Classes.HidKeys)e.KeyCode)
                    {
                        return button;
                    }
                }
                else if (c is ContainerPanel)
                {
                    HidButton button = FindMatchingButton(((ContainerPanel)c).Controls, e);

                    if (null != button)
                    {
                        return button;
                    }
                }
            }
            return null;
        }
Example #24
0
        /// <summary>
        /// This function makes sure, that all child controls
        /// send the necessary events to the owner control.
        /// </summary>
        public void GetAllMouseDowns(ControlCollection controls)
        {
            if (DesignMode) return;

            foreach (Control control in controls)
            {
                control.MouseDown += new MouseEventHandler(OnChildMouseDown);
                control.DoubleClick += new EventHandler(OnChildDoubleClick);
                GetAllMouseDowns(control.Controls);
            }
        }
        public static void ParseChildren(CustomInputControl parent, List<Classes.CustomInput.CustomInputControl> controls, ControlCollection controlContainer)
        {
            Bitmap image_down = Properties.Resources.Custom_Button_Down;
            Bitmap image_up = Properties.Resources.Custom_Button_Up;

            foreach (Classes.CustomInput.CustomInputControl controlDesc in controls)
            {
                HidButton imageButton = null;
                Control control = imageButton;

                switch (controlDesc.InputType)
                {
                    case Classes.CustomInputType.Container:
                        {
                            control = new ContainerPanel(parent, controlDesc);
                        }
                        break;
                    case Classes.CustomInputType.KeyCombination:
                    case Classes.CustomInputType.VirtualKey:
                    case Classes.CustomInputType.ScanCode:
                        {
                            control = imageButton = new KeyboardHidButton(parent, controlDesc);

                            if (!string.IsNullOrEmpty(controlDesc.Image))
                            {
                                imageButton.Image = GetBitmap(controlDesc.Image);
                            }
                            else
                            {
                                imageButton.Image = BuildCustomBitmap(image_up, controlDesc.InputDisplay, parent.Font, Color.Black);
                            }
                            if (!string.IsNullOrEmpty(controlDesc.DownImage))
                            {
                                imageButton.DownImage = GetBitmap(controlDesc.DownImage);
                            }
                            else
                            {
                                imageButton.DownImage = BuildCustomBitmap(image_down, controlDesc.InputDisplay, parent.Font, Color.White);
                            }
                            imageButton.SelectedImage = imageButton.DownImage;
                            imageButton.TransparentBackground = controlDesc.TransparentBackground;
                            imageButton.BackColor = parent.BackColor;
                            imageButton.CanHold = false;
                        }
                        break;
                    case Classes.CustomInputType.ShiftKey:
                    case Classes.CustomInputType.AltKey:
                    case Classes.CustomInputType.WinKey:
                        {
                        }
                        break;
                    case Classes.CustomInputType.LeftMouseButton:
                        {
                            imageButton = new MouseButtonHidButton(parent, controlDesc);
                        }
                        break;
                    case Classes.CustomInputType.RightMouseButton:
                        {
                            imageButton = new MouseButtonHidButton(parent, controlDesc);
                        }
                        break;
                    case Classes.CustomInputType.MouseDPad:
                        {
                            // add a control here to map dpad to mouse
                        }
                        break;
                    case Classes.CustomInputType.Accelerometer:
                        {
                            // add a control here to map accelerometer to mouse
                        }
                        break;
                    case Classes.CustomInputType.TouchPad:
                    case Classes.CustomInputType.TouchPadWithScroll:
                        {
                            control = new TouchControl();
                            ((TouchControl)control).HidWriter = parent.HidWriter;
                        }
                        break;
                    default:
                        {
                            // why are we here?
                        }
                        break;
                }
                control.Width = controlDesc.Width;
                control.Height = controlDesc.Height;
                control.Left = controlDesc.Left;
                control.Top = controlDesc.Top;
                control.Tag = controlDesc;

                if (!(control is ContainerPanel))
                {
                    control.Anchor = controlDesc.Anchor;
                    control.Dock = controlDesc.Dock;
                }

                controlContainer.Add(control);
            }
        }
Example #26
0
 protected virtual void Clear( ControlCollection controls )
 {
     foreach (Control control in controls)
     {
         Clear( control.Controls );
         var lc = control as ATMLListControl;
         var tb = control as TextBox;
         var dg = control as DataGridView;
         var lv = control as ListView;
         if (lc != null)
             lc.Clear();
         if (tb != null)
             tb.Clear();
         if (dg != null)
             dg.Rows.Clear();
         if (lv != null)
             lv.Items.Clear();
     }
 }
			Object ICloneable.Clone ()
			{
				ControlCollection clone = new ControlCollection (this.owner);
				clone.list = (ArrayList)list.Clone ();
				// FIXME: Do we need this?
				return clone;
			}
Example #28
0
 private void addEvents(ControlCollection items)
 {
     foreach (Control thisCtl in items)
     {
         if (thisCtl.GetType().BaseType == typeof(UserControl))  // todo: should really recurse baseTypes
         {
             this.addEvents(thisCtl.Controls);
         }
         else
         {
             thisCtl.MouseDown += new MouseEventHandler(this.item_MouseDown);
             thisCtl.MouseUp += new MouseEventHandler(this.item_MouseUp);
             thisCtl.MouseMove += new MouseEventHandler(this.item_MouseMove);
             thisCtl.DoubleClick += this.openOptions;
         }
     }
 }
		/// <summary>
		/// Creates a multiline label with its height fitted to the text
		/// </summary>
		/// <param name="text">The text for the label</param>
		/// <param name="graphics">The graphics context to use for measuring the text</param>
		/// <param name="width">The available width</param>
		/// <param name="controls">The collection to add the label to</param>
		private void AddNewLabel(string text, Graphics graphics, int width, ControlCollection controls)
		{
			Label label = new Label()
			{
				Visible = false,
				AutoSize = false,
				Dock = DockStyle.Top,
				Text = text
			};
			SizeF size = graphics.MeasureString(text, label.Font, width);
			label.Height = (int) Math.Round(size.Height + 8);

			controls.Add(label);
			label.BringToFront();
		}
Example #30
0
		public Control ()
		{
			if (WindowsFormsSynchronizationContext.AutoInstall)
				if (!(SynchronizationContext.Current is WindowsFormsSynchronizationContext))
					SynchronizationContext.SetSynchronizationContext (new WindowsFormsSynchronizationContext ());

			layout_type = LayoutType.Anchor;
			anchor_style = AnchorStyles.Top | AnchorStyles.Left;

			is_created = false;
			is_visible = true;
			is_captured = false;
			is_disposed = false;
			is_enabled = true;
			is_entered = false;
			layout_pending = false;
			is_toplevel = false;
			causes_validation = true;
			has_focus = false;
			layout_suspended = 0;
			mouse_clicks = 1;
			tab_index = -1;
			cursor = null;
			right_to_left = RightToLeft.Inherit;
			border_style = BorderStyle.None;
			background_color = Color.Empty;
			dist_right = 0;
			dist_bottom = 0;
			tab_stop = true;
			ime_mode = ImeMode.Inherit;
			use_compatible_text_rendering = true;
			show_keyboard_cues = false;
			show_focus_cues = SystemInformation.MenuAccessKeysUnderlined;
			use_wait_cursor = false;

			backgroundimage_layout = ImageLayout.Tile;
			use_compatible_text_rendering = Application.use_compatible_text_rendering;
			padding = this.DefaultPadding;
			maximum_size = new Size();
			minimum_size = new Size();
			margin = this.DefaultMargin;
			auto_size_mode = AutoSizeMode.GrowOnly;

			control_style = ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | 
					ControlStyles.Selectable | ControlStyles.StandardClick | 
					ControlStyles.StandardDoubleClick;
			control_style |= ControlStyles.UseTextForAccessibility;

			parent = null;
			background_image = null;
			text = string.Empty;
			name = string.Empty;

			window_target = new ControlWindowTarget(this);
			window = new ControlNativeWindow(this);
			child_controls = CreateControlsInstance();
			
			bounds.Size = DefaultSize;
			client_size = ClientSizeFromSize (bounds.Size);
			client_rect = new Rectangle (Point.Empty, client_size);
			explicit_bounds = bounds;
		}
Example #31
0
 public ControlCollectionEnumerator(ControlCollection controls)
 {
     this.controls = controls;
     originalCount = controls.Count;
     current       = -1;
 }