Esempio n. 1
0
        private void HexBox_Load(object sender, EventArgs e)
        {
            if (this.DesignMode)
            {
                return;
            }

            SetData(Program.ROM.Data);

            PanelForeBrush       = new SolidBrush(OptionForm.Color_Control_ForeColor());
            PanelBackBrush       = new SolidBrush(OptionForm.Color_Control_BackColor());
            ControlForeBrush     = new SolidBrush(OptionForm.Color_Input_ForeColor());
            ControlBackBrush     = new SolidBrush(OptionForm.Color_Input_BackColor());
            ControlSelectedBrush = new SolidBrush(OptionForm.Color_List_SelectedColor());
            RefColorBrush        = new SolidBrush(OptionForm.Color_NotifyWrite_BackColor());
            MarkColorBrush       = new SolidBrush(OptionForm.Color_Error_ForeColor());

            this.OneWidth  = (uint)(this.Font.SizeInPoints * 2);
            this.OneHeight = (uint)(this.Font.Height + 2);
            ClearUndoBuffer();
        }
        private void SearchHelperControl_Load(object sender, EventArgs e)
        {
            LangCode = System.Globalization.CultureInfo.CurrentCulture.TwoLetterISOLanguageName;

            Color Color_Control_BackColor = OptionForm.Color_Control_BackColor();
            Color Color_Control_ForeColor = OptionForm.Color_Control_ForeColor();

            EntryButton.BackColor = Color_Control_BackColor;
            EntryButton.ForeColor = Color_Control_ForeColor;
            NextButton.BackColor  = Color_Control_BackColor;
            NextButton.ForeColor  = Color_Control_ForeColor;
            this.BackColor        = Color_Control_BackColor;
            this.ForeColor        = Color_Control_ForeColor;
            searchlabel.BackColor = Color_Control_BackColor;
            searchlabel.ForeColor = Color_Control_ForeColor;


            Color Color_Input_BackColor = OptionForm.Color_Input_BackColor();
            Color Color_Input_ForeColor = OptionForm.Color_Input_ForeColor();

            SearchWord.BackColor = Color_Input_BackColor;
            SearchWord.ForeColor = Color_Input_ForeColor;
        }
Esempio n. 3
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            //TabControlの背景を塗る
            if (this.DesignMode)
            {
                e.Graphics.FillRectangle(SystemBrushes.Control, this.ClientRectangle);
                return;
            }
            else
            {
                Color backColor = OptionForm.Color_Control_BackColor();
                Brush backBrush = new System.Drawing.SolidBrush(backColor);
                e.Graphics.FillRectangle(backBrush, this.ClientRectangle);
                backBrush.Dispose();
            }


            if (this.TabCount == 0)
            {
                return;
            }
            if (this.SelectedIndex < 0 || this.SelectedIndex >= this.TabCount)
            {
                return;
            }

            //TabPageの枠を描画する
            TabPage   page     = this.TabPages[this.SelectedIndex];
            Rectangle pageRect = new Rectangle(
                page.Bounds.X - 2,
                page.Bounds.Y - 2,
                page.Bounds.Width + 5,
                page.Bounds.Height + 5);

            if (Application.RenderWithVisualStyles)
            {
                TabRenderer.DrawTabPage(e.Graphics, pageRect);
            }

            //タブを描画する
            for (int i = 0; i < this.TabCount; i++)
            {
                page = this.TabPages[i];
                Rectangle tabRect = this.GetTabRect(i);

                bool focused = false;
                //選択されたタブとページの間の境界線を消すために、
                //描画する範囲を大きくする
                if (this.SelectedIndex == i)
                {
                    tabRect.Height += 1;
                    focused         = true;
                }

                //画像のサイズを決定する
                Size imgSize = tabRect.Size;

                //タブの画像を作成する
                Bitmap   bmp = new Bitmap(imgSize.Width, imgSize.Height);
                Graphics g   = Graphics.FromImage(bmp);
                //高さに1足しているのは、下にできる空白部分を消すため
                Rectangle rect = new Rectangle(0, 0, bmp.Width, bmp.Height + 1);

                if (Application.RenderWithVisualStyles)
                {
                    //表示するタブの状態を決定する
                    System.Windows.Forms.VisualStyles.TabItemState state;
                    if (!this.Enabled)
                    {
                        state = System.Windows.Forms.VisualStyles.TabItemState.Disabled;
                    }
                    else if (focused)
                    {
                        state = System.Windows.Forms.VisualStyles.TabItemState.Selected;
                    }
                    else
                    {
                        state = System.Windows.Forms.VisualStyles.TabItemState.Normal;
                    }

                    TabRenderer.DrawTabItem(g,
                                            rect,
                                            false,
                                            state);
                }
                else
                {
                    if (focused)
                    {
                        g.FillRectangle(SystemBrushes.Control, rect);
                    }
                    else
                    {
                        g.FillRectangle(SystemBrushes.ControlDark, rect);
                        g.DrawRectangle(new Pen(SystemBrushes.ControlDarkDark), rect);
                    }
                }

                if (page.Text.Length > 10)
                {
                    g.DrawString(page.Text, page.Font, SystemBrushes.ControlText, new Rectangle(rect.Left + 6, rect.Top + 4, rect.Width - 20, rect.Height - 4));
                }
                else
                {
                    g.DrawString(page.Text, page.Font, SystemBrushes.ControlText, new Rectangle(rect.Left + 12, rect.Top + 4, rect.Width - 20, rect.Height - 4));
                }

                Rectangle closeButton = TabRectToCloseButtonRect(tabRect);
                if (closeButton.Contains(this.LastMouseCursor))
                {//マウスカーソルが当たっている、ボタンの背景の色を変える.
                    Brush     hoverBrush = new SolidBrush(OptionForm.Color_List_HoverColor());
                    Rectangle rc         = new Rectangle(closeButton.X - tabRect.X, closeButton.Y - tabRect.Y, closeButton.Width, closeButton.Height);
                    g.FillRectangle(hoverBrush, rc);
                    hoverBrush.Dispose();
                }
                g.DrawString("x", page.Font, SystemBrushes.ControlText, rect.Right - 15, rect.Top + 4);
                g.Dispose();

                //画像を描画する
                e.Graphics.DrawImage(bmp, tabRect.X, tabRect.Y, bmp.Width, bmp.Height);


                bmp.Dispose();
            }
        }