Example #1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Encapsulates a color picker drop-down almost just like Word 2003's.
        /// </summary>
        /// <param name="fShowUnspecified">if set to <c>true</c> control will include a button
        /// for the "automatic" choice (i.e., not explicitly specified).</param>
        /// <param name="selectedColor">Initial color to select.</param>
        /// ------------------------------------------------------------------------------------
        public ColorPickerDropDown(bool fShowUnspecified, Color selectedColor)
        {
            LayoutStyle = ToolStripLayoutStyle.VerticalStackWithOverflow;

            if (fShowUnspecified)
            {
                // Add the "Automatic" button.
                m_autoItem           = new ToolStripButton(ColorPickerStrings.kstidUnspecifiedText);
                m_autoItem.TextAlign = ContentAlignment.MiddleCenter;
                m_autoItem.Click    += new EventHandler(m_autoItem_Click);
                m_autoItem.Margin    = new Padding(1, m_autoItem.Margin.Top,
                                                   m_autoItem.Margin.Right, m_autoItem.Margin.Bottom);

                Items.Add(m_autoItem);
            }

            // Add all the colored squares.
            m_colorMatrix              = new ColorPickerMatrix();
            m_colorMatrix.ColorPicked += new EventHandler(m_colorMatrix_ColorPicked);
            ToolStripControlHost host = new ToolStripControlHost(m_colorMatrix);

            host.AutoSize = false;
            host.Size     = new Size(m_colorMatrix.Width + 6, m_colorMatrix.Height + 6);
            host.Padding  = new Padding(3);
            Items.Add(host);

            // Add the "More Colors..." button.
            m_moreItem           = new ToolStripMenuItem(ColorPickerStrings.kstidMoreColors);
            m_moreItem.TextAlign = ContentAlignment.MiddleCenter;
            m_moreItem.Click    += new EventHandler(m_moreItem_Click);
            Items.Add(m_moreItem);

            CurrentColor = selectedColor;
        }
Example #2
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Encapsulates a color picker drop-down almost just like Word 2003's.
		/// </summary>
		/// <param name="fShowUnspecified">if set to <c>true</c> control will include a button
		/// for the "automatic" choice (i.e., not explicitly specified).</param>
		/// <param name="selectedColor">Initial color to select.</param>
		/// ------------------------------------------------------------------------------------
		public ColorPickerDropDown(bool fShowUnspecified, Color selectedColor)
		{
			LayoutStyle = ToolStripLayoutStyle.VerticalStackWithOverflow;

			if (fShowUnspecified)
			{
				// Add the "Automatic" button.
				m_autoItem = new ToolStripButton(ColorPickerStrings.kstidUnspecifiedText);
				m_autoItem.TextAlign = ContentAlignment.MiddleCenter;
				m_autoItem.Click += new EventHandler(m_autoItem_Click);
				m_autoItem.Margin = new Padding(1, m_autoItem.Margin.Top,
					m_autoItem.Margin.Right, m_autoItem.Margin.Bottom);

				Items.Add(m_autoItem);
			}

			// Add all the colored squares.
			m_colorMatrix = new ColorPickerMatrix();
			m_colorMatrix.ColorPicked += new EventHandler(m_colorMatrix_ColorPicked);
			ToolStripControlHost host = new ToolStripControlHost(m_colorMatrix);
			host.AutoSize = false;
			host.Size = new Size(m_colorMatrix.Width + 6, m_colorMatrix.Height + 6);
			host.Padding = new Padding(3);
			Items.Add(host);

			// Add the "More Colors..." button.
			m_moreItem = new ToolStripMenuItem(ColorPickerStrings.kstidMoreColors);
			m_moreItem.TextAlign = ContentAlignment.MiddleCenter;
			m_moreItem.Click += new EventHandler(m_moreItem_Click);
			Items.Add(m_moreItem);

			CurrentColor = selectedColor;
		}