bool textChangedFlag; // True means unsaved changes exist; false means file is up-to-date.

    #endregion Fields

    #region Constructors

    public SimpleWordProcessor()
        : base()
    {
        textbox = new RichTextBox();
        textbox.Parent = this;
        textbox.Dock = DockStyle.Fill;
        textbox.AcceptsTab = true;

        textbox.TextChanged += delegate(object sender, EventArgs args) {
            textChangedFlag = true;
        };

        // Display save prompt if closing with unsaved data.
        this.FormClosing += delegate(object sender, FormClosingEventArgs args) {
            if(!confirmSave())
                args.Cancel = true;
        };

        this.Text = "SimpleWordProcessor";
        this.Width = 600;
        this.Height = 480;

        fDiag = new FontDialog();
        cDiag = new ColorDialog();
        sDiag = new SaveFileDialog();
        oDiag = new OpenFileDialog();

        textChangedFlag = false;

        buildMenu();
    }
 public static ColorDialog GetInstance()
 {
     if(uniqueInstance == null) {
         uniqueInstance = new ColorDialog();
     }
     return uniqueInstance;
 }
示例#3
0
        public Form1()
        {
            InitializeComponent();

            //resultMatrix = new MMatrix();
            bSaveDone = true;
            InputMatrixForm = new FormMatrixInput();
            SystemOfEquationsForm = new FormSystemOfEquationsInput();
            ScalarForm = new FormScalarInput();
            NewRankForm = new FormNewRankInput();
            NoiseForDiscontinuityForm = new FormNoiseInput();
            CreateNoiseForm = new FormNoise();
            GaussForm = new FormGaussianSmooth();
            SharpenForm = new FormSharpening();
            ImageForm = new FormBitmapDisplay();
            FormHis = new FormHistogram();
            colordlg = new ColorDialog();
            ImgProcess = new ImageProcessing();

            for (int i = 1; i < 256; ++i)
            {
                toolStripSkeletonDiff.Items.Add(i);
                toolStripComboBoxSkeletonDiff.Items.Add(i);
            }
            colordlg.FullOpen = true;
            colordlg.ShowHelp = true;
            colordlg.AnyColor = true;
            this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
        }
示例#4
0
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     ColorDialog d = new ColorDialog();
     if (d.ShowDialog() == DialogResult.OK) {
         return ColorTranslator.ToHtml(Color.FromArgb(d.Color.ToArgb()));
     }
     return value;
 }
 void OnClicked(object sender, ToolBarButtonClickEventArgs e)
 {
     ColorDialog dialog = new ColorDialog();
        if (dialog.ShowDialog(this) == DialogResult.OK) {
       color = dialog.Color;
       Invalidate();
        }
 }
 static void OnSetCustomColorDialog(object sender, GetColorEventArgs e)
 {
     m_dlg = new ColorDialog();
     if (m_dlg.ShowDialog(null) == DialogResult.Ok)
     {
       var c = m_dlg.Color;
       e.SelectedColor = System.Drawing.Color.FromArgb (c.Ab, c.Rb, c.Gb, c.Bb);
     }
 }
 void EventProc(Object sender, EventArgs ea)
 {
     if ((ToolStripButton)sender == color_btn)
     {
         ColorDialog dlg = new ColorDialog();
         dlg.ShowDialog();
     }
     else if ((ToolStripButton)sender == comment_btn)
     {
         MessageBox.Show("StatusStrip 예제입니다.");
     }
 }
示例#8
0
 protected override void OnMouseDown(MouseEventArgs e)
 {
     if ( (e.Clicks == 1||e.Clicks==2) && e.Button == MouseButtons.Left )
     {
         if (!Checked) Checked=true;
         else
         {
             ColorDialog cd = new ColorDialog(controller.colorInfo.ToColor());
             if (cd.ShowDialog()==DialogResult.OK)
                 controller.colorInfo.GrabFromColor(cd.SelectedColor);
         }
     }
 }
示例#9
0
 // Changes the background color of the form
 private void backgroundColorToolStripMenuItem_Click(object sender, EventArgs e)
 {
     ColorDialog colorDlg = new ColorDialog();
     if (colorDlg.ShowDialog() == DialogResult.OK)
     {
         // Checks if grid is currently hidden and sets the grid color to that color
         if (hideGridToolStripMenuItem.Text == "Show Grid")
         {
             lifeGrid.GridColor = colorDlg.Color;
             this.BackColor = colorDlg.Color;
         }
         else
         {
             this.BackColor = colorDlg.Color; // Sets a new background color for this form
         }
     }
 }
示例#10
0
        private void editColorsButton_Click(object sender, EventArgs e)
        {
            ColorDialog colorDialog = new ColorDialog(paletteControl.Items);
            if (colorDialog.ShowDialog() == DialogResult.OK)
            {
                for (int i = 0; i < paletteControl.Items.Length; i++)
                    paletteControl.Items[i] = colorDialog.Items[i];

                if (currentPattern != null)
                {
                    for (int i = 0; i < paletteControl.Items.Length; i++)
                        currentPattern.ColorPalette.SetColor(i, AC.Palette.ColorPalette[paletteControl.Items[i]]);

                    LoadPattern(currentPattern);
                }
            }
        }
        private void OnTabColorToolStripMenuItemClick(object sender, EventArgs e)
        {
            LogWindow.LogWindow logWindow = dockPanel.ActiveContent as LogWindow.LogWindow;

            LogWindowData data = logWindow.Tag as LogWindowData;

            if (data == null)
            {
                return;
            }

            ColorDialog dlg = new ColorDialog();

            dlg.Color = data.color;
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                data.color = dlg.Color;
                SetTabColor(logWindow, data.color);
            }
            List <ColorEntry> delList = new List <ColorEntry>();

            foreach (ColorEntry entry in ConfigManager.Settings.fileColors)
            {
                if (entry.FileName.ToLower().Equals(logWindow.FileName.ToLower()))
                {
                    delList.Add(entry);
                }
            }
            foreach (ColorEntry entry in delList)
            {
                ConfigManager.Settings.fileColors.Remove(entry);
            }
            ConfigManager.Settings.fileColors.Add(new ColorEntry(logWindow.FileName, dlg.Color));
            while (ConfigManager.Settings.fileColors.Count > MAX_COLOR_HISTORY)
            {
                ConfigManager.Settings.fileColors.RemoveAt(0);
            }
        }
示例#12
0
        private void setReColourToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Debug.WriteLine("Setting ReColor");

            ToolStripMenuItem sitem = ((ToolStripMenuItem)sender);
            ListView          lbox  = ((customStrip)sitem.Owner).lBox;

            int index = lbox.SelectedIndices[0];

            //Color Dialog
            ColorDialog coldiag = new ColorDialog();

            DialogResult res = coldiag.ShowDialog();

            if (res == DialogResult.OK)
            {
                lbox.Items[index].BackColor = coldiag.Color;
                MVCore.GMDL.TextureMixer.reColourings[index] = new float[] { (int)coldiag.Color.R / 256.0f,
                                                                             (int)coldiag.Color.G / 256.0f,
                                                                             (int)coldiag.Color.B / 256.0f,
                                                                             1.0f };
            }
            else
            {
                lbox.Items[index].BackColor = System.Drawing.Color.White;
                MVCore.GMDL.TextureMixer.reColourings[index] = new float[] { 0.0f, 0.0f, 0.0f, 0.0f };
            }

            Console.WriteLine("RGB: {0} {1} {2}", MVCore.GMDL.TextureMixer.reColourings[index][0],
                              MVCore.GMDL.TextureMixer.reColourings[index][1],
                              MVCore.GMDL.TextureMixer.reColourings[index][2]);
            Vector3 hsv = RGBToHSV(new Vector3(MVCore.GMDL.TextureMixer.reColourings[index][0],
                                               MVCore.GMDL.TextureMixer.reColourings[index][1],
                                               MVCore.GMDL.TextureMixer.reColourings[index][2]));

            Console.WriteLine("HSV: {0} {1} {2}", hsv.X, hsv.Y, hsv.Z);
            glControl1.Invalidate();
        }
示例#13
0
        private void Color_Clicked(object sender, EventArgs e)
        {
            Label label = sender as Label;

            if (label == null)
            {
                return;
            }

            //弹出颜色选择窗体
            ColorDialog dialog = new ColorDialog();

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                Color color = dialog.Color;
                label.BackColor = color;  //首先把显示的颜色改了
                if (label == label_color) //文字颜色
                {
                    chemicalEquation1.FontColor = color;
                }
                else if (label == label_conditioncolor)  //反应条件颜色
                {
                    chemicalEquation1.ConditionColor = color;
                }
                else if (label == label_equalcolor)  //等于号颜色
                {
                    chemicalEquation1.EqualColor = color;
                }
                else if (label == label_subcolor)  //下标颜色
                {
                    chemicalEquation1.SubColor = color;
                }
                else if (label == label_supcolor)  //上标颜色
                {
                    chemicalEquation1.SupColor = color;
                }
            }
        }
 protected void ColorFunction(object sender, WriterCommandEventArgs args)
 {
     if (args.Mode == WriterCommandEventMode.QueryState)
     {
         args.Enabled = args.DocumentControler != null &&
                        args.DocumentControler.Snapshot.CanModifySelection;
     }
     else if (args.Mode == WriterCommandEventMode.Invoke)
     {
         DocumentContentStyle cs = GetCurrentStyle(args.Document);
         Color color             = Color.Black;
         if (args.Parameter is Color)
         {
             color = (Color)args.Parameter;
         }
         else
         {
             color = cs.Color;
         }
         if (args.ShowUI)
         {
             using (ColorDialog dlg = new ColorDialog())
             {
                 dlg.Color = color;
                 if (dlg.ShowDialog(args.EditorControl) == DialogResult.OK)
                 {
                     color = dlg.Color;
                 }
                 else
                 {
                     return;
                 }
             }//using
         }
         args.Parameter = color;
         SetStyleProperty(sender, args, StandardCommandNames.Color);
     }
 }
示例#15
0
            /// <summary>
            /// Initializes a new instance of the <see cref="CustomColorsPanel"/> class.
            /// </summary>
            /// <param name="serviceProvider">
            /// <para>Requires:</para>
            /// <para><see cref="INuGenButtonStateTracker"/></para>
            /// <para><see cref="INuGenControlStateTracker"/></para>
            /// <para><see cref="INuGenButtonRenderer"/></para>
            /// <para><see cref="INuGenPanelRenderer"/></para>
            /// <para><see cref="INuGenColorsProvider"/></para>
            /// </param>
            public CustomColorsPanel(INuGenServiceProvider serviceProvider)
            {
                if (serviceProvider == null)
                {
                    throw new ArgumentNullException("serviceProvider");
                }

                _serviceProvider = serviceProvider;

                this.Dock = DockStyle.Fill;

                _components       = new Container();
                _colorDialog      = new ColorDialog();
                _tableLayoutPanel = new TableLayoutPanel();
                _flowLayoutPanel  = new FlowLayoutPanel();
                _otherButton      = new NuGenButton(serviceProvider);

                this.InitializeColorDialog(_colorDialog);
                this.InitializeFlowLayoutPanel(_flowLayoutPanel);
                this.InitializeOtherButton(_otherButton);
                this.InitializeTableLayoutPanel(_tableLayoutPanel);

                _tableLayoutPanel.Controls.Add(_flowLayoutPanel, 0, 0);
                _tableLayoutPanel.Controls.Add(_otherButton, 0, 1);

                IList <Color> colors = null;

                this.ColorsProvider.FillWithCustomColors(out colors);
                Debug.Assert(colors != null, "colors != null");

                foreach (Color color in colors)
                {
                    ColorPanel colorPanel = new ColorPanel(serviceProvider);
                    colorPanel.Click       += _colorPanel_Click;
                    colorPanel.DisplayColor = color;
                    colorPanel.Parent       = _flowLayoutPanel;
                }
            }
        private void dataGridView_cursorInfo_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (_isInternalOperation || e.RowIndex < 0 || e.ColumnIndex < 0)
            {
                return;
            }
            _isInternalOperation = true;
            TabCursor changeCursor = _cursors[e.RowIndex];

            switch (e.ColumnIndex)
            {
            case CursorEnableIndex:
//                    dataGridView_cursorInfo.EndEdit();
                changeCursor.Enabled = !changeCursor.Enabled;
                dataGridView_cursorInfo.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = changeCursor.Enabled;
//                    dataGridView_cursorInfo.EndEdit();
                break;

            case CursorColorIndex:
                ColorDialog loColorForm = new ColorDialog();
                if (loColorForm.ShowDialog() == DialogResult.OK)
                {
                    changeCursor.Color = loColorForm.Color;
                    DataGridViewRow row = dataGridView_cursorInfo.Rows[e.RowIndex];
                    row.Cells[CursorColorIndex].Style.BackColor          = changeCursor.Color;
                    row.Cells[CursorColorIndex].Style.SelectionBackColor = changeCursor.Color;
                }
                break;

//                case CursorNameIndex:
//                    break;
//                case CursorValueIndex:
//                    break;
            default:
                break;
            }
            _isInternalOperation = false;
        }
示例#17
0
        private void chooseBackgroundColorToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ColorDialog CDialogue = new ColorDialog();
            Color       selected  = Color.White;

            int[] origColor = new int[dataGridView2.SelectedCells.Count];
            int[] newColor  = new int[dataGridView2.SelectedCells.Count];
            int[] newRow    = new int[dataGridView2.SelectedCells.Count];
            int[] newCol    = new int[dataGridView2.SelectedCells.Count];
            //Cell[] cellArr = new Cell[dataGridView2.SelectedCells.Count];

            if (CDialogue.ShowDialog() == DialogResult.OK)
            {
                selected = CDialogue.Color;
            }
            int   i     = 0;
            int   test  = selected.ToArgb();
            Color test2 = Color.FromArgb(test);

            foreach (DataGridViewTextBoxCell c in dataGridView2.SelectedCells)
            {
                origColor[i] = c.Style.BackColor.ToArgb();
                newColor[i]  = CDialogue.Color.ToArgb();
                newRow[i]    = c.RowIndex;
                newCol[i]    = c.ColumnIndex;
                //cellArr[i] = mySpread.cell_array[c.RowIndex, c.ColumnIndex];

                mySpread.cell_array[c.RowIndex, c.ColumnIndex].BGColor = newColor[i];
                //this updates in the Logic layer which in turn will notify the UI
                i++;
            }
            Restore colRestore = new ColorRestore(origColor, newColor, newRow, newCol);

            colRestore.BText = "Background Color";
            undoToolStripMenuItem.Enabled = true;
            undoToolStripMenuItem.Text    = "Undo Background Color Change";
            mySpread.undoPush(colRestore);
        }
示例#18
0
        private void ChangeTopPointBarColorButton_Click(object sender, EventArgs e)
        {
            ColorDialog cd = new ColorDialog();

            cd.AllowFullOpen = true;
            cd.ShowHelp      = true;
            cd.Color         = PointBarColor;

            if (cd.ShowDialog() == DialogResult.OK)
            {
                PointBarColor = cd.Color;
                for (int i = 0; i < 9; i++)
                {
                    PointBarList[i].SetColor(cd.Color);
                }
                DrawPointBars();
            }
            else
            {
                DrawPointBars();
            }
            cd.Dispose();
        }
示例#19
0
        private void colorButton_Click(object sender, EventArgs e)
        {
            Button      colorButton = (Button)sender;
            ColorDialog cdl         = new ColorDialog();

            cdl.FullOpen = true;

            cdl.Color = colorButton.BackColor;
            if (cdl.ShowDialog() == DialogResult.OK)
            {
                colorButton.BackColor = cdl.Color;
                switch (colorButton.Name)
                {
                case "currentDayColorButton":
                    SunsetChartSettings.Instance.CurrentDayColor = cdl.Color.ToArgb();
                    break;

                case "currentHourColorButton":
                    SunsetChartSettings.Instance.CurrentHourColor = cdl.Color.ToArgb();
                    break;
                }
            }
        }
示例#20
0
        private void front_color_btn_Click(object sender, EventArgs e)
        {
            ColorDialog colorDialog = new ColorDialog();
            var         btn         = (ToolStripButton)sender;

            colorDialog.Color = btn.BackColor;
            if (colorDialog.ShowDialog() == DialogResult.OK)
            {
                btn.BackColor = colorDialog.Color;


                switch (btn.Name)
                {
                case "front_color_btn":
                    frontColor = colorDialog.Color;
                    break;

                case "back_color_btn":
                    backColor = colorDialog.Color;
                    break;
                }
            }
        }
        private void btnColorCode_Click(object sender, EventArgs e)
        {
            ColorDialog color = new ColorDialog();

            if (color.ShowDialog() == DialogResult.OK)
            {
                if (mcbCode.SelectedIndex == 0)
                {
                    GeradorCode.QRCode code = new GeradorCode.QRCode();

                    CorCode = color.Color;

                    ptbCodeID.Image = code.GerarQRCode(txtID.Text, CorCode);
                }
                if (mcbCode.SelectedIndex == 1)
                {
                    GeradorCode.BarCode barcode = new GeradorCode.BarCode();

                    CorCode         = color.Color;
                    ptbCodeID.Image = barcode.GerarBarCode(txtID.Text, CorCode);
                }
            }
        }
示例#22
0
        private static void SetColor(ref Button button)
        {
            var isBackground = (ModifierKeys & Keys.Alt) == Keys.Alt;
            var color        = isBackground ? button.BackColor : button.ForeColor;
            var dialog       = new ColorDialog();

            dialog.Color          = color;
            dialog.FullOpen       = true;
            dialog.SolidColorOnly = false;
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                color = dialog.Color;
            }
            dialog.Dispose();
            if (isBackground)
            {
                button.BackColor = color;
            }
            else
            {
                button.ForeColor = color;
            }
        }
示例#23
0
        static void mi背景色_Click(Object sender, EventArgs e)
        {
            // ((System.Windows.Forms.ContextMenuStrip)(((System.Windows.Forms.ToolStripItem)(sender)).Owner)).SourceControl
            var ti  = sender as ToolStripItem;
            var txt = (ti.Owner as ContextMenuStrip).SourceControl as TextBoxBase;

            var cd = new ColorDialog
            {
                Color = txt.BackColor
            };

            if (cd.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            txt.BackColor = cd.Color;

            var ui = UIConfig.Current;

            ui.BackColor = txt.BackColor;
            ui.Save();
        }
示例#24
0
 /// <summary>
 /// Задание цвета в форме выбора цвета по двойному щелчку на объекте Label
 /// </summary>
 /// <param name="objLabel"></param>
 /// <param name="colorDialogSelect"></param>
 /// <param name="R1"></param>
 /// <param name="G1"></param>
 /// <param name="B1"></param>
 public void DoubleClickColorLabel(object objLabel, ColorDialog colorDialogSelect, object R1,
                                   object G1, object B1)
 {
     if (colorDialogSelect.ShowDialog() == DialogResult.OK)
     {
         ((Label)objLabel).BackColor = colorDialogSelect.Color;
         ((NumericUpDown)R1).Value   = colorDialogSelect.Color.R;
         ((NumericUpDown)G1).Value   = colorDialogSelect.Color.G;
         ((NumericUpDown)B1).Value   = colorDialogSelect.Color.B;
     }
     if (colorDialogSelect.Color.R < 40 || colorDialogSelect.Color.G < 40 || colorDialogSelect.Color.B < 40)
     {
         ((Label)objLabel).ForeColor = Color.White;
     }
     else if (colorDialogSelect.Color.R < 128 || colorDialogSelect.Color.G < 128 || colorDialogSelect.Color.B < 128)
     {
         ((Label)objLabel).ForeColor = Color.Yellow;
     }
     else
     {
         ((Label)objLabel).ForeColor = Color.Black;
     }
 }
示例#25
0
        private string pickColor()
        {
            ColorDialog MyDialog    = new ColorDialog();
            Color       colorPicked = new Color();

            MyDialog.CustomColors = new int[] {
                ColorTranslator.ToOle(ColorTranslator.FromHtml("#F8E000")),
                ColorTranslator.ToOle(ColorTranslator.FromHtml("#007BB7")),
                ColorTranslator.ToOle(ColorTranslator.FromHtml("#7EC845")),
                ColorTranslator.ToOle(ColorTranslator.FromHtml("#D01C1F"))
            };
            colorPicked = this.BackColor;

            string hexColor = "#FFFFFF";

            if (MyDialog.ShowDialog() == DialogResult.OK)
            {
                colorPicked = MyDialog.Color;
                hexColor    = "#" + colorPicked.R.ToString("X2") + colorPicked.G.ToString("X2") + colorPicked.B.ToString("X2");
            }

            return(hexColor);
        }
示例#26
0
        private void backgroundColorButton_Click(object sender, EventArgs e)
        {
            ColorDialog dlg = new ColorDialog();

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                Color backColor = dlg.Color;

                //edit current text color here;
                //this.shapeData.PenColor = penColor;

                if (backColor.GetBrightness() < 0.5)
                {
                    this.backgroundColorButton.ForeColor = Color.White;
                }
                else
                {
                    this.backgroundColorButton.ForeColor = Color.Black;
                }

                this.backgroundColorButton.BackColor = backColor;
            }
        }
        private void btnFadeColor_Click(object sender, System.EventArgs e)
        {
            //Create new ColorDialog control
            ColorDialog colorDialog = new ColorDialog();

            //Show the ColorDialog and exit if user cancelled
            if (colorDialog.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }

            //Get color from ColorDialog
            System.Drawing.Color color = colorDialog.Color;

            //The ToolbarControl host wrapper expects a SystemDrawingColor. The
            //ToolbarControl type library wrapper expects an OLE_Color. The OLE_Color
            //is made up as follows:(Red) + (Green * 256) + (Blue * 256 * 256)
            //IToolbarControl2 toolbarControl = (IToolbarControl2) axToolbarControl1.Object;
            //toolbarControl.FadeColor = (color.R + (color.G * 256) + (color.B * 256 * 256));
            axToolbarControl1.FadeColor = color;

            colorDialog = null;
        }
示例#28
0
        public TemplateForm()
        {
            InitializeComponent();

            colorDialog = new ColorDialog();

            fakeModelItem = new ModelItem()
            {
                Id           = 1,
                ModelId      = 1,
                PositionTop  = 0,
                PositionLeft = 0,
                Text         = String.Empty,
                TemplateId   = 1,
                FontSize     = 64,
                FontColor    = "#FF00FF",
                Rotation     = 0,
            };

            resultImage = new Bitmap(1, 1);

            fontPath = Utils.GetFontPath();
        }
示例#29
0
        //Abre un color dialog y si se acepta el color llama mediante un delegado a la función de cambio de color de la ventana principal
        private void colorButton_Click(object sender, RoutedEventArgs e)
        {
            ColorDialog colorDialog = new ColorDialog();

            colorDialog.AnyColor       = true;
            colorDialog.FullOpen       = true;
            colorDialog.SolidColorOnly = false;
            colorDialog.Color          = System.Drawing.Color.FromArgb(color.A, color.R, color.G, color.B);
            colorDialog.CustomColors   = colores;
            if (colorDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                int[] coloresAux = (int[])colorDialog.CustomColors.Clone();
                for (int i = 0; i < 16; i++)
                {
                    colores[i] = coloresAux[i];
                }
                if (color != Color.FromArgb(colorDialog.Color.A, colorDialog.Color.R, colorDialog.Color.G, colorDialog.Color.B))
                {
                    color = Color.FromArgb(colorDialog.Color.A, colorDialog.Color.R, colorDialog.Color.G, colorDialog.Color.B);
                    cambiarColorGrafica(color);
                }
            }
        }
 private void colorSelectButton_Click(object sender, EventArgs e)
 {
     using (colorDialog1 = new ColorDialog())
     {
         colorDialog1.SolidColorOnly = false;
         colorDialog1.AllowFullOpen  = true;
         colorDialog1.AnyColor       = true;
         int colorabgr = (int)cx.ToABGR();
         colorabgr &= 0x00ffffff;
         int[] colorsabgr = new int[1];
         colorsabgr[0]             = colorabgr;
         colorDialog1.FullOpen     = true;
         colorDialog1.ShowHelp     = true;
         colorDialog1.Color        = ColorExToColor(cx);
         colorDialog1.CustomColors = colorsabgr;
         DialogResult result = colorDialog1.ShowDialog();
         if (result == DialogResult.OK)
         {
             colorSelectButton.BackColor = colorDialog1.Color;
             cx = ColorToColorEx(colorDialog1.Color);
         }
     }
 }
示例#31
0
 public System.Drawing.Color ShowColorPicker(System.Drawing.Color currentColor)
 {
     if (colorDialog == null)
     {
         colorDialog = new ColorDialog()
         {
             FullOpen = true
         }
     }
     ;
     if (!currentColor.IsEmpty)
     {
         colorDialog.Color = currentColor;
     }
     if (colorDialog.ShowDialog() == DialogResult.OK)
     {
         return(colorDialog.Color);
     }
     else
     {
         return(System.Drawing.Color.Empty);
     }
 }
示例#32
0
 void button_Click(object sender, EventArgs e)
 {
     if (sender == this.foreColorButton)
     {
         this.foreColorButton.Selected = true;
         this.backColorButton.Selected = false;
     }
     else if (sender == this.backColorButton)
     {
         this.foreColorButton.Selected = false;
         this.backColorButton.Selected = true;
     }
     else if (sender == this.editColorButton)
     {
         ColorDialog dialog = new ColorDialog();
         dialog.ShowDialog(this.FindForm());
         SelectColor(dialog.Color);
     }
     else
     {
         SelectColor((sender as Button).BackColor);
     }
 }
示例#33
0
        private Color?ColorChangeHandler(Color?color)
        {
            using (var cp = new ColorDialog())
            {
                cp.FullOpen     = true;
                cp.CustomColors = _customColors;

                if (color.HasValue)
                {
                    cp.Color = color.Value.ToSystemDrawing();
                }

                var res = cp.ShowDialog();

                _customColors = cp.CustomColors;
                if (res == DialogResult.OK)
                {
                    return(cp.Color.ToXna());
                }
            }

            return(null);
        }
        private void SetBackgroundColor(object sender, EventArgs evt)
        {
            ColorDialog cd = new ColorDialog
            {
                Color         = Properties.Settings.Default.TextOutline,
                AllowFullOpen = true,
                AnyColor      = true,
            };

            bool hasChanged = false;

            if (cd.ShowDialog() != DialogResult.Cancel)
            {
                hasChanged = !Properties.Settings.Default.TextBackground.Equals(cd.Color);
                Properties.Settings.Default.TextBackground = cd.Color;
            }

            if (hasChanged)
            {
                Properties.Settings.Default.Save();
                TrackDisplayer.UpdateTrack(true);
            }
        }
示例#35
0
        /// <summary>
        /// Asks the user for a colour if one has not been specified
        /// </summary>
        /// <param name="colour">The <see cref="Color"/> to check</param>
        /// <returns>If a colour is present</returns>
        static bool TryGetColour(ref Color?colour)
        {
            if (colour.HasValue)
            {
                return(true);
            }

            Console.WriteLine("Please select the colour to be changed to alpha");

            var colourDialog = new ColorDialog()
            {
                AllowFullOpen = true,
                AnyColor      = true
            };

            if (colourDialog.ShowDialog() != DialogResult.OK)
            {
                return(false);
            }

            colour = colourDialog.Color;
            return(true);
        }
示例#36
0
文件: Formdtr.cs 项目: whoiskp/KTDH
        private void button1_Click(object sender, EventArgs e)
        {
            MessageBox.Show(" Warning: Khong nen chon mau duong \ntrung voi mau nen (=mau trang)!");
            ColorDialog MyDialog = new ColorDialog();

            // Keeps the user from selecting a custom color.
            MyDialog.AllowFullOpen = false;
            // Allows the user to get help. (The default is false.)
            MyDialog.ShowHelp = true;
            MyDialog.Color    = textBox4.ForeColor;
            // Update the text box color if the user clicks OK
            if (MyDialog.ShowDialog() == DialogResult.OK)
            {
                if (MyDialog.Color == Color.White)
                {
                    MessageBox.Show("Hay chon mau duong \nkhac voi mau nen(=mau trang)");
                }
                else
                {
                    textBox4.ForeColor = MyDialog.Color;
                }
            }
        }
示例#37
0
        // ********************************************************************************
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <returns></returns>
        /// <created>UPh,25.04.2015</created>
        /// <changed>UPh,25.04.2015</changed>
        // ********************************************************************************
        private void linkMore_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            using (ColorDialog dlg = new ColorDialog())
            {
                dlg.FullOpen = true;
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }


                ToolStripDropDown host = Parent as ToolStripDropDown;
                if (host != null)
                {
                    host.Close();
                }

                if (ColorSelected != null)
                {
                    ColorSelected(this, new ColorSelectedEventArgs(dlg.Color));
                }
            }
        }
示例#38
0
        private async void ColorButton_Click(object sender, EventArgs e)
        {
            DisableComponents();

            ColorDialog colorDialog = new ColorDialog();

            if (colorDialog.ShowDialog() == DialogResult.OK)
            {
                CalculateNewColor calculateNewColor = new CalculateNewColor((previousColor) => {
                    double averageColorPercentage = ((previousColor.R + previousColor.G + previousColor.B) / 3.0) / 255.0;

                    int newRed   = (int)(colorDialog.Color.R * averageColorPercentage);
                    int newGreen = (int)(colorDialog.Color.G * averageColorPercentage);
                    int newBlue  = (int)(colorDialog.Color.B * averageColorPercentage);

                    return(Color.FromArgb(newRed, newGreen, newBlue));
                });

                await TransformImage(calculateNewColor);
            }

            EnableComponents();
        }
示例#39
0
        protected override void ChangeSettings()
        {
            // pick TacticalMap background color

            var diag = new ColorDialog();

            diag.Color = BackColor;

            var result = diag.ShowDialog();

            if (result == DialogResult.OK)
            {
                BackColor = diag.Color;

                if (TacticalMap != null)
                {
                    var action = new Action(() => TacticalMap.BackColor = BackColor);
                    InvokeOnUIThread(action);
                }

                Serialize("color", BackColor);
            }
        }
示例#40
0
        private void recolorButton_Click(object sender, EventArgs e)
        {
            string[] rgb = new string[3];
            colorDialog1               = new ColorDialog();
            colorDialog1.AnyColor      = true;
            colorDialog1.AllowFullOpen = true;
            //colorDialog1.FullOpen = true;
            DialogResult re = colorDialog1.ShowDialog();

            if (re == DialogResult.OK)
            {
                Color picked = colorDialog1.Color;
                rgb[0] = picked.R.ToString();
                rgb[1] = picked.G.ToString();
                rgb[2] = picked.B.ToString();
                Rgb    = rgb;

                // print a little label at the bottom of ParticleDesignForm.
                string rgb_output = "R: " + Rgb[0] + " G: " + Rgb[1] + " B: " + Rgb[2];
                colorLabel.Text = "Color: " + rgb_output;
                colorPicked     = true;
            }
        }
示例#41
0
	private void btnColor_Click(object sender, System.EventArgs e)
	{
		ColorDialog dlgColor = new ColorDialog();
		dlgColor.ShowDialog(this);
		btnColor.BackColor = dlgColor.Color;

	}
示例#42
0
文件: MainForm.cs 项目: mono/gert
	void ResetButton_Click (object sender, EventArgs e)
	{
		_colorDialog = new ColorDialog ();
		_allowFullOpenCheck.Checked = _colorDialog.AllowFullOpen;
		_fullOpenCheck.Checked = _colorDialog.FullOpen;
	}
示例#43
0
 private void cellPointsToolStripMenuItem_Click(object sender, EventArgs e)
 {
     ColorDialog cd = new ColorDialog();
     cd.Color = m_clrDots;
     if (DialogResult.OK == cd.ShowDialog(this))
     {
         m_clrDots = cd.Color;
     }
 }
示例#44
0
        private void dataGridView4_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 2 && e.RowIndex >= 0)
            {
                ColorDialog cd = new ColorDialog();

                if (cd.ShowDialog() == DialogResult.OK)
                {
                    // 将先中的颜色设置为窗体的背景色
                    dataGridView4.Rows[e.RowIndex].Cells["曲线颜色"].Style.BackColor = cd.Color;
                    dt_zk.Rows[e.RowIndex][1] = "#" + string.Format("{0:X2}", cd.Color.R) + string.Format("{0:X2}", cd.Color.G) + string.Format("{0:X2}", cd.Color.B);

                }
            }
        }
示例#45
0
        private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex > 0 && e.RowIndex >= 0)
            {
                ColorDialog cd = new ColorDialog();

                if (cd.ShowDialog() == DialogResult.OK)
                {
                    // 将先中的颜色设置为窗体的背景色
                    dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.BackColor = cd.Color;
                    dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Tag = cd.Color;
                    //dt_zz.Rows[e.RowIndex][4] = "#"+string.Format("{0:X2}", cd.Color.R) + string.Format("{0:X2}", cd.Color.G) + string.Format("{0:X2}", cd.Color.B);

                }
            }
        }
示例#46
0
        /// <summary>
        /// 色選択ダイアログを表示します。
        /// </summary>
        public static Color? ShowColorDialog(Color? defaultColor, Window owner = null)
        {
            var dialog = new ColorDialog();
            if (owner != null)
            {
                dialog.Owner = owner;
            }

            // 必要ならデフォルト色を設定します。
            if (defaultColor != null)
            {
                dialog.SelectedColor = defaultColor.Value;
            }

            // OKボタンが押されたら、その色を返します。
            var result = dialog.ShowDialog();
            if (result != null && result.Value)
            {
                return dialog.SelectedColor;
            }

            return null;
        }
 /// <summary>
 /// Erforderliche Methode für die Designerunterstützung.
 /// Der Inhalt der Methode darf nicht mit dem Code-Editor
 /// geändert werden.
 /// </summary>
 private void InitializeComponent()
 {
     this.cd = new System.Windows.Forms.ColorDialog();
     this.btnReset = new System.Windows.Forms.Button();
     this.pbWhite = new System.Windows.Forms.PictureBox();
     this.pbGray = new System.Windows.Forms.PictureBox();
     this.pbBlack = new System.Windows.Forms.PictureBox();
     this.lblWhite = new System.Windows.Forms.Label();
     this.lblGray = new System.Windows.Forms.Label();
     this.lblBlack = new System.Windows.Forms.Label();
     this.btnClose = new System.Windows.Forms.Button();
     ((System.ComponentModel.ISupportInitialize)(this.pbWhite)).BeginInit();
     ((System.ComponentModel.ISupportInitialize)(this.pbGray)).BeginInit();
     ((System.ComponentModel.ISupportInitialize)(this.pbBlack)).BeginInit();
     this.SuspendLayout();
     //
     // cd
     //
     this.cd.AnyColor = true;
     //
     // btnReset
     //
     this.btnReset.Location = new System.Drawing.Point(11, 107);
     this.btnReset.Name = "btnReset";
     this.btnReset.Size = new System.Drawing.Size(120, 23);
     this.btnReset.TabIndex = 1;
     this.btnReset.Text = "Zurücksetzen";
     this.btnReset.UseVisualStyleBackColor = true;
     this.btnReset.Click += new System.EventHandler(this.btnReset_Click);
     //
     // pbWhite
     //
     this.pbWhite.BackColor = System.Drawing.Color.White;
     this.pbWhite.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
     this.pbWhite.Cursor = System.Windows.Forms.Cursors.Hand;
     this.pbWhite.Location = new System.Drawing.Point(12, 12);
     this.pbWhite.Margin = new System.Windows.Forms.Padding(20);
     this.pbWhite.Name = "pbWhite";
     this.pbWhite.Size = new System.Drawing.Size(50, 50);
     this.pbWhite.TabIndex = 3;
     this.pbWhite.TabStop = false;
     this.pbWhite.Click += new System.EventHandler(this.pbWhite_Click);
     //
     // pbGray
     //
     this.pbGray.BackColor = System.Drawing.Color.White;
     this.pbGray.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
     this.pbGray.Cursor = System.Windows.Forms.Cursors.Hand;
     this.pbGray.Location = new System.Drawing.Point(109, 12);
     this.pbGray.Margin = new System.Windows.Forms.Padding(20);
     this.pbGray.Name = "pbGray";
     this.pbGray.Size = new System.Drawing.Size(50, 50);
     this.pbGray.TabIndex = 4;
     this.pbGray.TabStop = false;
     this.pbGray.Click += new System.EventHandler(this.pbGray_Click);
     //
     // pbBlack
     //
     this.pbBlack.BackColor = System.Drawing.Color.White;
     this.pbBlack.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
     this.pbBlack.Cursor = System.Windows.Forms.Cursors.Hand;
     this.pbBlack.Location = new System.Drawing.Point(207, 12);
     this.pbBlack.Margin = new System.Windows.Forms.Padding(20);
     this.pbBlack.Name = "pbBlack";
     this.pbBlack.Size = new System.Drawing.Size(50, 50);
     this.pbBlack.TabIndex = 5;
     this.pbBlack.TabStop = false;
     this.pbBlack.Click += new System.EventHandler(this.pbBlack_Click);
     //
     // lblWhite
     //
     this.lblWhite.AutoSize = true;
     this.lblWhite.Location = new System.Drawing.Point(18, 65);
     this.lblWhite.Name = "lblWhite";
     this.lblWhite.Size = new System.Drawing.Size(32, 13);
     this.lblWhite.TabIndex = 6;
     this.lblWhite.Text = "Weiß";
     //
     // lblGray
     //
     this.lblGray.AutoSize = true;
     this.lblGray.Location = new System.Drawing.Point(120, 65);
     this.lblGray.Name = "lblGray";
     this.lblGray.Size = new System.Drawing.Size(30, 13);
     this.lblGray.TabIndex = 7;
     this.lblGray.Text = "Grau";
     //
     // lblBlack
     //
     this.lblBlack.AutoSize = true;
     this.lblBlack.Location = new System.Drawing.Point(209, 65);
     this.lblBlack.Name = "lblBlack";
     this.lblBlack.Size = new System.Drawing.Size(48, 13);
     this.lblBlack.TabIndex = 8;
     this.lblBlack.Text = "Schwarz";
     //
     // btnClose
     //
     this.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel;
     this.btnClose.Location = new System.Drawing.Point(137, 107);
     this.btnClose.Name = "btnClose";
     this.btnClose.Size = new System.Drawing.Size(120, 23);
     this.btnClose.TabIndex = 0;
     this.btnClose.Text = "Schließen";
     this.btnClose.UseVisualStyleBackColor = true;
     this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
     //
     // frmSetCursorColor
     //
     this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     this.CancelButton = this.btnClose;
     this.ClientSize = new System.Drawing.Size(269, 142);
     this.Controls.Add(this.btnClose);
     this.Controls.Add(this.pbWhite);
     this.Controls.Add(this.lblBlack);
     this.Controls.Add(this.lblWhite);
     this.Controls.Add(this.btnReset);
     this.Controls.Add(this.pbBlack);
     this.Controls.Add(this.lblGray);
     this.Controls.Add(this.pbGray);
     this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
     this.MaximizeBox = false;
     this.MinimizeBox = false;
     this.Name = "frmSetCursorColor";
     this.ShowIcon = false;
     this.ShowInTaskbar = false;
     this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
     this.Text = "SetCursorColor";
     this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.frmSetCursorColor_FormClosed);
     this.Load += new System.EventHandler(this.frmSetCursorColor_Load);
     ((System.ComponentModel.ISupportInitialize)(this.pbWhite)).EndInit();
     ((System.ComponentModel.ISupportInitialize)(this.pbGray)).EndInit();
     ((System.ComponentModel.ISupportInitialize)(this.pbBlack)).EndInit();
     this.ResumeLayout(false);
     this.PerformLayout();
 }
示例#48
0
 private void btnChooseTextColor_Click(object sender, EventArgs e)
 {
     ColorDialog dialog = new ColorDialog();
     if (dialog.ShowDialog() == DialogResult.OK)
     {
         panelTextColor.BackColor = dialog.Color;
         lblTest.ForeColor = dialog.Color;
     }
 }
示例#49
0
 private void tilesetToolStripMenuItem_Click(object sender, EventArgs e)
 {
     ColorDialog cd = new ColorDialog();
     if (DialogResult.OK == cd.ShowDialog(this))
     {
         m_clrTilesetBGClear = cd.Color;
     }
 }
示例#50
0
 private void button3_Click(object sender, System.EventArgs e)
 {
     ColorDialog cd = new ColorDialog(Color.FromArgb(0, 0, 0));
     cd.ShowDialog();
 }
示例#51
0
        private void editColorsButton_Click(object sender, EventArgs e)
        {
            using (ColorDialog colorDialog = new ColorDialog(paletteControl.Items))
            {
                patternEditor.BeginPreview();

                colorDialog.ColorPaletteChanged +=
                    (o, s) => patternEditor.SetColorPalette(colorDialog.GetAsPalette());
                if (colorDialog.ShowDialog() == DialogResult.OK)
                {
                    for (int i = 0; i < paletteControl.Items.Length; i++)
                        paletteControl.Items[i] = colorDialog.Items[i];

                    patternEditor.SetColorPalette(colorDialog.GetAsPalette());
                }
                else
                {
                    patternEditor.EndPreview();
                }
            }
        }
示例#52
0
    public void CreateMySettingsForm()
    {
        buttonOk 				= new Button();
        buttonCancel 			= new Button();
        buttonChangeFont 		= new Button();
        buttonApply				= new Button();
        buttonLineColor			= new Button();
        buttonLineMore			= new Button();
        buttonLineLess			= new Button();
        buttonArrowMore			= new Button();
        buttonArrowLess			= new Button();
        buttonHorizontalMore	= new Button();
        buttonHorizontalLess	= new Button();
        buttonVerticalMore		= new Button();
        buttonVerticalLess		= new Button();
        buttonSymbolSizeLess	= new Button();
        buttonSymbolSizeMore	= new Button();
        buttonRestoreDefault	= new Button();
        labelFont				= new Label();
        labelLineColor			= new Label();
        labelGapHeight			= new Label();
        labelGapWidth 			= new Label();
        labelLineThickness		= new Label();
        labelArrowSize			= new Label();
        labelSymbolSize			= new Label();
        fontDialog1				= new FontDialog();
        colorDialog1			= new ColorDialog();
        tabPageFont				= new TabPage();
        tabPageLine				= new TabPage();
        tabPageDimensions		= new TabPage();
        tabPageOptimization		= new TabPage();
        tabControl 				= new TabControl();
        groupBoxTandNT			= new GroupBox();
        groupBoxThickness		= new GroupBox();
        groupBoxArrow			= new GroupBox();
        groupBoxLineColor		= new GroupBox();
        groupBoxHorizontal		= new GroupBox();
        groupBoxVertical		= new GroupBox();
        groupBoxSymbolSize		= new GroupBox();
        groupBoxOptimization	= new GroupBox();
        checkBoxOptimization	= new CheckBox();

           form1.Text 				= "Settings";
           form1.FormBorderStyle 	= FormBorderStyle.FixedDialog;
           form1.MaximizeBox 		= false;
           form1.MinimizeBox 		= false;
           form1.AcceptButton 		= buttonOk;
           form1.CancelButton 		= buttonCancel;
           form1.StartPosition 		= FormStartPosition.CenterScreen;

           checkBoxOptimization.Checked = Node.OptimizeGraph;

           buttonCancel.Text 		= "Cancel";
           buttonOk.Text 			= "OK";
           buttonChangeFont.Text	= "Change font...";
           buttonApply.Text			= "Apply";
           buttonLineMore.Text		= ">";
           buttonLineLess.Text		= "<";
           buttonArrowMore.Text		= ">";
           buttonArrowLess.Text		= "<";
           buttonHorizontalMore.Text= ">";
           buttonHorizontalLess.Text= "<";
           buttonVerticalMore.Text	= ">";
           buttonVerticalLess.Text	= "<";
           buttonSymbolSizeMore.Text= ">";
           buttonSymbolSizeLess.Text= "<";
           buttonLineColor.Text		= "Change color...";
           buttonRestoreDefault.Text= "Restore default settings";
           labelFont.Text			= Node.CharFont.Name;
           labelGapHeight.Text		= Convert.ToString(Node.ComponentGapHeight);
           labelGapWidth.Text		= Convert.ToString(Node.ComponentGapWidth-26);
           tabPageFont.Text			= "Font";
           tabPageLine.Text			= "Line";
           tabPageDimensions.Text	= "Dimensions";
           tabPageOptimization.Text = "Optimizations";
           groupBoxTandNT.Text		= "Terminal and nonterminal symbols";
           groupBoxThickness.Text	= "Thickness";
           groupBoxArrow.Text		= "Size of Arrow";
           groupBoxLineColor.Text	= "Color";
           groupBoxHorizontal.Text	= "Horizontal";
           groupBoxVertical.Text	= "Vertical";
           groupBoxSymbolSize.Text	= "Gap between symbolline and font (vertical)";
           groupBoxOptimization.Text= "Optimization";
           labelLineThickness.Text  = Convert.ToString(Node.LinePen.Width);
           labelArrowSize.Text  	= Convert.ToString(Node.ArrowSize);
           labelSymbolSize.Text		= Convert.ToString(Node.SymbolGapHeight);
           checkBoxOptimization.Text= "Enable optimizations (reload required)";

           labelFont.Font			= Node.CharFont;
           labelFont.ForeColor		= Node.CharColor;
           labelFont.BackColor		= Color.White;
           labelFont.TextAlign		= ContentAlignment.MiddleCenter;

           if(Node.LinePen.Width<=1)		buttonLineLess.Enabled 		 	= false;
           if(Node.SymbolGapHeight<=0)		buttonSymbolSizeLess.Enabled 	= false;
           if(Node.ArrowSize<=1)			buttonArrowLess.Enabled  	 	= false;
           if(Node.ComponentGapHeight<=0)	buttonVerticalLess.Enabled 		= false;
           if(Node.ComponentGapWidth<=26)	buttonHorizontalLess.Enabled	= false;

           labelLineThickness.Font		= new Font("Times",12);
           labelLineThickness.TextAlign	= ContentAlignment.MiddleCenter;

           labelArrowSize.Font			= new Font("Times",12);
           labelArrowSize.TextAlign		= ContentAlignment.MiddleCenter;

           labelGapHeight.Font			= new Font("Times",12);
           labelGapHeight.TextAlign		= ContentAlignment.MiddleCenter;

           labelGapWidth.Font			= new Font("Times",12);
           labelGapWidth.TextAlign		= ContentAlignment.MiddleCenter;

           labelSymbolSize.Font			= new Font("Times",12);
           labelSymbolSize.TextAlign	= ContentAlignment.MiddleCenter;

           labelLineColor.BackColor=Node.LinePen.Color;

           buttonLineColor.Size 	= new Size(100,20);
           buttonLineMore.Size		= new Size(20,20);
           buttonLineLess.Size		= new Size(20,20);
           buttonArrowMore.Size		= new Size(20,20);
           buttonArrowLess.Size		= new Size(20,20);
           buttonHorizontalMore.Size= new Size(20,20);
           buttonHorizontalLess.Size= new Size(20,20);
           buttonVerticalMore.Size	= new Size(20,20);
           buttonVerticalLess.Size	= new Size(20,20);
           buttonSymbolSizeMore.Size= new Size(20,20);
           buttonSymbolSizeLess.Size= new Size(20,20);
           buttonChangeFont.Size	= new Size(90,20);
           buttonRestoreDefault.Size= new Size(150,20);
           tabControl.Size			= new Size(form1.Size.Width-15, form1.Size.Height-150);
           groupBoxTandNT.Size		= new Size(tabControl.Size.Width-30, groupBoxTandNT.Size.Height);
           groupBoxThickness.Size	= new Size(100, 50);
           groupBoxArrow.Size		= new Size(100, 50);
           groupBoxHorizontal.Size	= new Size(100, 50);
           groupBoxVertical.Size	= new Size(100, 50);
           groupBoxOptimization.Size= new Size(tabControl.Size.Width-30, 50);
           groupBoxLineColor.Size   = new Size(155, 50);
           groupBoxSymbolSize.Size	= new Size(tabControl.Size.Width-30, 50);
           labelLineColor.Size		= new Size(20,20);
           labelFont.Size			= new Size(groupBoxTandNT.Size.Width-20,40);
           checkBoxOptimization.Size= new Size(220, 20);

           groupBoxTandNT.Location			= new Point (10,10);
           groupBoxThickness.Location		= new Point (10,10);
           groupBoxArrow.Location			= new Point (10,groupBoxThickness.Height+10);
           groupBoxLineColor.Location		= new Point (110,10);
           groupBoxHorizontal.Location		= new Point (10,10);
           groupBoxVertical.Location		= new Point (110,10);
           groupBoxOptimization.Location	= new Point (10,10);
           groupBoxSymbolSize.Location		= new Point (10,groupBoxVertical.Height+10);
           labelFont.Location 				= new Point (10,20);
           buttonOk.Location				= new Point (20, 220);
           buttonApply.Location				= new Point (buttonOk.Left+buttonOk.Width+10, 220);
           buttonCancel.Location 			= new Point (buttonApply.Left+buttonApply.Width+20, 220);
           tabControl.Location				= new Point (5,5);
           buttonChangeFont.Location		= new Point (tabControl.Right-buttonChangeFont.Size.Width-45,labelFont.Top+labelFont.Height+10);
           buttonLineLess.Location			= new Point (10,20);
           buttonLineMore.Location			= new Point (buttonLineLess.Right+40, buttonLineLess.Top);
           buttonArrowLess.Location			= new Point (10,20);
           buttonArrowMore.Location			= new Point (buttonLineLess.Right+40, buttonLineLess.Top);
           buttonHorizontalLess.Location	= new Point (10,20);
           buttonHorizontalMore.Location	= new Point (buttonHorizontalLess.Right+40, buttonHorizontalLess.Top);
           buttonVerticalLess.Location		= new Point (10,20);
           buttonVerticalMore.Location		= new Point (buttonVerticalLess.Right+40, buttonVerticalLess.Top);
           buttonSymbolSizeLess.Location	= new Point (10,20);
           buttonSymbolSizeMore.Location	= new Point (buttonSymbolSizeLess.Right+40, buttonSymbolSizeLess.Top);
           buttonRestoreDefault.Location	= new Point ((tabControl.Size.Width-buttonRestoreDefault.Size.Width)/2, tabControl.Bottom+20);
           labelLineThickness.Location		= new Point (buttonLineLess.Right,buttonLineLess.Top);
           labelArrowSize.Location			= new Point (buttonArrowLess.Right,buttonArrowLess.Top);
           labelGapHeight.Location			= new Point (buttonHorizontalLess.Right,buttonHorizontalLess.Top);
           labelGapWidth.Location			= new Point (buttonVerticalLess.Right,buttonVerticalLess.Top);
           labelSymbolSize.Location			= new Point (buttonSymbolSizeLess.Right,buttonSymbolSizeLess.Top);
           labelLineColor.Location			= new Point (10,20);
           buttonLineColor.Location			= new Point (labelLineColor.Right+10,20);
           checkBoxOptimization.Location	= new Point (10,20);

           labelLineThickness.Size			= new Size  (buttonLineMore.Left-buttonLineLess.Right,buttonLineLess.Height);
           labelArrowSize.Size				= new Size  (buttonArrowMore.Left-buttonArrowLess.Right,buttonArrowLess.Height);
           labelGapHeight.Size				= new Size  (buttonHorizontalMore.Left-buttonHorizontalLess.Right,buttonHorizontalLess.Height);
           labelGapWidth.Size				= new Size  (buttonVerticalMore.Left-buttonVerticalLess.Right,buttonVerticalLess.Height);
           labelSymbolSize.Size				= new Size  (buttonSymbolSizeMore.Left-buttonSymbolSizeLess.Right,buttonSymbolSizeLess.Height);

           groupBoxTandNT.Controls.Add(buttonChangeFont);
           groupBoxTandNT.Controls.Add(labelFont);
           groupBoxHorizontal.Controls.Add(labelGapWidth);
           groupBoxVertical.Controls.Add(labelGapHeight);
           groupBoxThickness.Controls.Add(buttonLineMore);
           groupBoxThickness.Controls.Add(buttonLineLess);
           groupBoxThickness.Controls.Add(labelLineThickness);
           groupBoxLineColor.Controls.Add(buttonLineColor);
           groupBoxLineColor.Controls.Add(labelLineColor);
           groupBoxArrow.Controls.Add(buttonArrowMore);
           groupBoxArrow.Controls.Add(buttonArrowLess);
           groupBoxArrow.Controls.Add(labelArrowSize);
           groupBoxHorizontal.Controls.Add(buttonHorizontalLess);
           groupBoxHorizontal.Controls.Add(buttonHorizontalMore);
           groupBoxVertical.Controls.Add(buttonVerticalLess);
           groupBoxVertical.Controls.Add(buttonVerticalMore);
           groupBoxSymbolSize.Controls.Add(buttonSymbolSizeMore);
           groupBoxSymbolSize.Controls.Add(buttonSymbolSizeLess);
           groupBoxSymbolSize.Controls.Add(labelSymbolSize);
           groupBoxOptimization.Controls.Add(checkBoxOptimization);

           tabPageFont.Controls.Add(groupBoxTandNT);
           tabPageLine.Controls.Add(groupBoxThickness);
           tabPageLine.Controls.Add(groupBoxLineColor);
           tabPageLine.Controls.Add(groupBoxArrow);
           tabPageDimensions.Controls.Add(groupBoxSymbolSize);
           tabPageDimensions.Controls.Add(groupBoxHorizontal);
           tabPageDimensions.Controls.Add(groupBoxVertical);
           tabPageOptimization.Controls.Add(groupBoxOptimization);

           tabControl.Controls.Add(this.tabPageFont);
           tabControl.Controls.Add(this.tabPageLine);
           tabControl.Controls.Add(this.tabPageDimensions);
           tabControl.Controls.Add(this.tabPageOptimization);

           form1.Controls.Add(this.tabControl);
           form1.Controls.Add(buttonOk);
           form1.Controls.Add(buttonCancel);
           form1.Controls.Add(buttonApply);
           form1.Controls.Add(buttonRestoreDefault);

           buttonOk.Click				+= new System.EventHandler(this.buttonOk_Click);
           buttonChangeFont.Click		+= new System.EventHandler(this.buttonChangeFont_Click);
           buttonApply.Click			+= new System.EventHandler(this.buttonApply_Click);
           buttonLineColor.Click		+= new System.EventHandler(this.buttonLineColor_Click);
           buttonLineMore.Click			+= new System.EventHandler(this.buttonLineMore_Click);
           buttonLineLess.Click			+= new System.EventHandler(this.buttonLineLess_Click);
           buttonArrowMore.Click		+= new System.EventHandler(this.buttonArrowMore_Click);
           buttonArrowLess.Click		+= new System.EventHandler(this.buttonArrowLess_Click);
           buttonHorizontalMore.Click	+= new System.EventHandler(this.buttonHorizontalMore_Click);
           buttonHorizontalLess.Click	+= new System.EventHandler(this.buttonHorizontalLess_Click);
           buttonVerticalMore.Click		+= new System.EventHandler(this.buttonVerticalMore_Click);
           buttonVerticalLess.Click		+= new System.EventHandler(this.buttonVerticalLess_Click);
           buttonSymbolSizeMore.Click	+= new System.EventHandler(this.buttonSymbolSizeMore_Click);
           buttonSymbolSizeLess.Click	+= new System.EventHandler(this.buttonSymbolSizeLess_Click);
           buttonCancel.Click			+= new System.EventHandler(this.buttonCancel_Click);
           buttonRestoreDefault.Click	+= new System.EventHandler(this.buttonRestoreDefault_Click);

           form1.ShowDialog();
    }
示例#53
0
        private void dataGridView2_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex >0 && e.RowIndex >= 0)
            {
                ColorDialog cd = new ColorDialog();

                if (cd.ShowDialog() == DialogResult.OK)
                {
                    // 将先中的颜色设置为窗体的背景色
                    dataGridView2.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.BackColor = cd.Color;
                    dataGridView2.Rows[e.RowIndex].Cells[e.ColumnIndex].Tag = cd.Color;
                }
            }
        }
示例#54
0
        private void btnBackColor_Click_1(object sender, EventArgs e)
        {
            using (ColorDialog cdialog = new ColorDialog())
            {
                cdialog.AnyColor = true;
                if (cdialog.ShowDialog() == DialogResult.OK)
                {
                    this.b.BackColor = cdialog.Color;
                    this.btnBackColor.BackColor = this.b.BackColor;
                }//if
            }//using

        }
示例#55
0
 protected virtual void OnCommandFontColor(object sender, System.EventArgs e)
 {
     ColorDialog dialog = new ColorDialog ();
     if (dialog.Run () == (int) Gtk.ResponseType.Ok) {
         UndoableCommand fontColor = new UndoableCommand (new ChangeAttributeCommand ("Font color",
             FigureAttribute.FontColor, GdkCairoHelper.CairoColor (dialog.Color), this));
         fontColor.Execute ();
     }
     dialog.Destroy ();
 }
示例#56
0
        private void changeBGColorToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ColorDialog cd = new ColorDialog();

            if (DialogResult.OK == cd.ShowDialog(this))
            {
                m_clrMapBGclear = cd.Color;
            }
        }
示例#57
0
 public void SetDlg(ColorDialog dlg)
 {
     cdlg=dlg;
 }
示例#58
0
		} // SetupListItems

		// ----------------------------------------------------------------------
		private void ButtonChangeColor( object sender, RoutedEventArgs e )
		{
			ColorDialog colorDialog = new ColorDialog();
			colorDialog.Color = WindowColor;
			colorDialog.FullOpen = true;
			if ( colorDialog.ShowDialog() )
			{
				WindowColor = colorDialog.Color;
			}
		} // ButtonChangeColor
示例#59
0
 private void gpsColor_Click(object sender, EventArgs e)
 {
     ColorDialog colorDialog = new ColorDialog(this.Handle);
     if (colorDialog.ShowDialog() == DialogResult.OK)
             gpsColor.BackColor = colorDialog.Color;
 }
示例#60
0
 private void colorIcon1_Click(object sender, EventArgs e)
 {
     ColorDialog colorDialog = new ColorDialog(this.Handle);
     if (colorDialog.ShowDialog() == DialogResult.OK)
         ciNewLayerColor.BackColor = colorDialog.Color;
     colorDialog.Dispose();
 }