Example #1
0
        private void buttonDefaultPrint_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("Set all printing colors default.", "MBE",
                                              MessageBoxButtons.OKCancel, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2);

            if (dr == DialogResult.OK)
            {
                MbeColors.SetDefaultPrintColor();
                MbeColors.StoreSettings();
                listBoxColorPrint.Invalidate();
            }
        }
Example #2
0
        private void ObButtonDefault(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("Set all display colors default.", "MBE",
                                              MessageBoxButtons.OKCancel, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2);

            if (dr == DialogResult.OK)
            {
                MbeColors.SetDefaultColor();
                if (ColorChange != null)
                {
                    //ColorChange(this, null);
                    ColorChange();
                }
                MbeColors.StoreSettings();
                listBoxColorDisplay.Invalidate();
            }
        }
Example #3
0
        /// <summary>
        /// カラーサンプルがクリックされたときの処理
        /// </summary>
        /// <param name="index"></param>
        /// <remarks>
        /// カラーダイアログを呼び出し、変更があればイベントを発行する。
        /// </remarks>
        protected void ColorSampleClick(int index)
        {
            uint  nCol = MbeColors.GetLayerColor(index);
            Color col  = Color.FromArgb(unchecked ((int)nCol));

            colorDialog.Color = col;
            if (colorDialog.ShowDialog() == DialogResult.OK)
            {
                nCol = unchecked ((uint)(colorDialog.Color.ToArgb()));
                MbeColors.SetLayerColor(index, nCol);
                if (LayerColorChange != null)
                {
                    LayerColorChange(this, null);
                }
                MbeColors.StoreSettings();
                Invalidate();
            }
        }
Example #4
0
        /// <summary>
        /// 印刷用色リストボックスがクリックされたときのハンドラ
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void listBoxColorPrint_Click(object sender, EventArgs e)
        {
            if (listBoxColorPrint.SelectedIndex <= -1)
            {
                return;
            }

            int index = listBoxColorPrint.SelectedIndex;        //レイヤーのインデックス

            uint nCol = 0;

            if (index < MbeLayer.valueTable.Length)
            {
                nCol = MbeColors.GetLayerPrintColor(index);
            }
            else
            {
                return;
            }


            Color       col         = Color.FromArgb(unchecked ((int)nCol));
            ColorDialog colorDialog = new System.Windows.Forms.ColorDialog();

            colorDialog.Color = col;
            if (colorDialog.ShowDialog() == DialogResult.OK)
            {
                nCol = unchecked ((uint)(colorDialog.Color.ToArgb()));
            }
            else
            {
                return;
            }

            MbeColors.SetLayerPrintColor(index, nCol);

            MbeColors.StoreSettings();
            listBoxColorPrint.Invalidate();
        }
Example #5
0
        /// <summary>
        /// リストボックスがクリックされたときのハンドラ
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnClickListBoxColor(object sender, EventArgs e)
        {
            System.Diagnostics.Debug.WriteLine("OnClickListBoxColor index= " + listBoxColorDisplay.SelectedIndex);

            if (listBoxColorDisplay.SelectedIndex <= -1)
            {
                return;
            }

            int index  = listBoxColorDisplay.SelectedIndex;             //レイヤーのインデックス
            int index2 = index - MbeLayer.valueTable.Length;            //レイヤー以外のインデックス

            uint nCol = 0;

            if (index < MbeLayer.valueTable.Length)
            {
                nCol = MbeColors.GetLayerColor(index);
            }
            else if (index2 < nameTable.Length)
            {
                switch (index2)
                {
                case 0: nCol = MbeColors.OriginMark; break;

                case 1: nCol = MbeColors.GridOriginMark; break;

                case 2: nCol = MbeColors.Grid; break;

                case 3: nCol = MbeColors.SnapPoint; break;

                case 4: nCol = MbeColors.ActiveSnapPoint; break;

                case 5: nCol = MbeColors.PinNum; break;

                case 6: nCol = MbeColors.CrossCursor; break;

                case 7: nCol = MbeColors.Background; break;

                case 8: nCol = MbeColors.BgNotWorkArea; break;

                default: nCol = MbeColors.InputErr; break;
                }
            }
            else
            {
                return;
            }


            Color       col         = Color.FromArgb(unchecked ((int)nCol));
            ColorDialog colorDialog = new System.Windows.Forms.ColorDialog();

            colorDialog.Color = col;
            if (colorDialog.ShowDialog() == DialogResult.OK)
            {
                nCol = unchecked ((uint)(colorDialog.Color.ToArgb()));
            }
            else
            {
                return;
            }

            if (index < MbeLayer.valueTable.Length)
            {
                MbeColors.SetLayerColor(index, nCol);
            }
            else
            {
                switch (index2)
                {
                case 0: MbeColors.OriginMark = nCol; break;

                case 1: MbeColors.GridOriginMark = nCol; break;

                case 2: MbeColors.Grid = nCol; break;

                case 3: MbeColors.SnapPoint = nCol; break;

                case 4: MbeColors.ActiveSnapPoint = nCol; break;

                case 5: MbeColors.PinNum = nCol; break;

                case 6: MbeColors.CrossCursor = nCol; break;

                case 7: MbeColors.Background = nCol; break;

                case 8: MbeColors.BgNotWorkArea = nCol; break;

                default: MbeColors.InputErr = nCol; break;
                }
            }
            if (ColorChange != null)
            {
                //ColorChange(this, null);
                ColorChange();
            }
            MbeColors.StoreSettings();
            listBoxColorDisplay.Invalidate();
        }