コード例 #1
0
 protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e)
 {
     if (e.Item.Owner is ContextMenuStrip)
     {
         if (e.Item.Selected)
         {
             e.ArrowColor = LayoutSetting.GetForeColorHover(LayoutSetting.Theme);
         }
         else
         {
             e.ArrowColor = LayoutSetting.GetForeColorCommon(LayoutSetting.Theme);
         }
     }
     else
     {
         if (e.Item.Selected || e.Item.Pressed)
         {
             e.ArrowColor = LayoutSetting.GetForeColorHover(LayoutSetting.Theme);
         }
         else
         {
             e.ArrowColor = LayoutSetting.GetForeColorCommon(LayoutSetting.Theme);
         }
     }
     base.OnRenderArrow(e);
 }
コード例 #2
0
 protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e)
 {
     if (e.ToolStrip is ContextMenuStrip)
     {
         if (e.Item.Selected)
         {
             e.TextColor = LayoutSetting.GetForeColorHover(LayoutSetting.Theme);
         }
         else
         {
             e.TextColor = LayoutSetting.GetForeColorCommon(LayoutSetting.Theme);
         }
     }
     else
     {
         if (e.Item.Selected || e.Item.Pressed)
         {
             e.TextColor = LayoutSetting.GetForeColorHover(LayoutSetting.Theme);
         }
         else
         {
             e.TextColor = LayoutSetting.GetForeColorCommon(LayoutSetting.Theme);
         }
     }
     base.OnRenderItemText(e);
 }
コード例 #3
0
ファイル: DownloadDialog.cs プロジェクト: vip00112/GTLauncher
        private void DownloadDialog_Load(object sender, EventArgs e)
        {
            LayoutSetting.Invalidate(this);

            string title = string.Format(label_title.Tag as string, 0, 0);

            label_title.Text = title;
        }
コード例 #4
0
        protected override void OnMouseLeave(EventArgs e)
        {
            base.OnMouseLeave(e);

            if (LayoutSetting.IsEditMode)
            {
                return;
            }
            BackColor = Color.Transparent;
            ForeColor = LayoutSetting.GetForeColorCommon(LayoutSetting.Theme);
        }
コード例 #5
0
        protected override void OnMouseEnter(EventArgs e)
        {
            base.OnMouseEnter(e);

            if (LayoutSetting.IsEditMode)
            {
                return;
            }
            BackColor = LayoutSetting.GetBackColorHover(LayoutSetting.Theme);
            ForeColor = LayoutSetting.GetForeColorHover(LayoutSetting.Theme);
        }
コード例 #6
0
        protected override void OnPaint(PaintEventArgs e)
        {
            using (var backBrush = new SolidBrush(LayoutSetting.GetBackColorHover(LayoutSetting.Theme)))
                using (var innerBrush = new SolidBrush(LayoutSetting.GetBackColorCommon(LayoutSetting.Theme)))
                {
                    var rec = e.ClipRectangle;
                    e.Graphics.FillRectangle(backBrush, rec);

                    rec.Width  = (int)(rec.Width * ((double)Value / Maximum)) - 4;
                    rec.Height = rec.Height - 4;
                    e.Graphics.FillRectangle(innerBrush, 2, 2, rec.Width, rec.Height);
                }
        }
コード例 #7
0
ファイル: ThemeListView.cs プロジェクト: vip00112/GTLauncher
 protected override void OnDrawItem(DrawListViewItemEventArgs e)
 {
     if (e.Item.Focused)
     {
         e.Item.BackColor = LayoutSetting.GetBackColorHover(LayoutSetting.Theme);
         e.Item.ForeColor = LayoutSetting.GetForeColorHover(LayoutSetting.Theme);
     }
     else
     {
         e.Item.BackColor = LayoutSetting.GetBackColorCommon(LayoutSetting.Theme);
         e.Item.ForeColor = LayoutSetting.GetForeColorCommon(LayoutSetting.Theme);
     }
     e.DrawBackground();
     e.DrawText(TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter);
 }
コード例 #8
0
ファイル: PageContainer.cs プロジェクト: vip00112/GTLauncher
        public void BuildLayout()
        {
            DockMode       = LayoutSetting.DockMode;
            SizeModeWidth  = LayoutSetting.SizeModeWidth;
            SizeModeHeight = LayoutSetting.SizeModeHeight;

            // 기존 페이지 삭제
            var pages = _pages.ToList();

            foreach (var page in pages)
            {
                Controls.Remove(page);
            }

            // 페이지 등록
            foreach (var srcPage in LayoutSetting.Pages)
            {
                var page = new Page(srcPage.PageName);
                page.Title             = srcPage.Title;
                page.VisibleTitle      = srcPage.VisibleTitle;
                page.VisibleBackButton = srcPage.VisibleBackButton;
                page.CloseMode         = srcPage.CloseMode;

                // 해당 페이지의 아이템 등록
                var srcPageItems = LayoutSetting.PageItems.Where(o => o.PageName == srcPage.PageName).ToList();
                foreach (var srcItem in srcPageItems)
                {
                    var item = page.AddItemAfterCopy(srcItem);
                    if (item == null)
                    {
                        continue;
                    }

                    item.OnFolderClickEvent += PageItemFolderClick;
                }

                Controls.Add(page);
            }

            var main = _pages.FirstOrDefault(o => o.PageName == "Main");

            if (main != null)
            {
                main.BringToFront();
            }

            LayoutSetting.Invalidate(this);
        }
コード例 #9
0
        private void propertyGrid_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
        {
            switch (e.ChangedItem.Label)
            {
            case "SizeModeWidth":
                foreach (TabPage tabPage in tabControl_pages.TabPages)
                {
                    foreach (var page in tabPage.Controls[0].Controls.OfType <Page>())
                    {
                        page.Parent.Width = LayoutSetting.GetWidth((SizeMode)e.ChangedItem.Value);
                    }
                }
                break;

            case "SizeModeHeight":
                foreach (TabPage tabPage in tabControl_pages.TabPages)
                {
                    foreach (var page in tabPage.Controls[0].Controls.OfType <Page>())
                    {
                        page.Parent.Height = LayoutSetting.GetHeight((SizeMode)e.ChangedItem.Value);
                    }
                }
                break;

            case "PageName":
                var tab = tabControl_pages.SelectedTab;
                if (tab == null)
                {
                    return;
                }

                string pageName = e.ChangedItem.Value as string;
                if (string.IsNullOrWhiteSpace(pageName))
                {
                    return;
                }
                if (pageName == "Main")
                {
                    return;
                }

                tab.Text = pageName;
                SelectedPage.PageName = pageName;
                SelectedPage.PageItems.ForEach(o => o.PageName = pageName);
                break;
            }
        }
コード例 #10
0
        private void LayoutSettingForm_Load(object sender, EventArgs e)
        {
            if (Runtime.DesignMode)
            {
                return;
            }

            LayoutSetting.Invalidate(this);
            LayoutSetting.IsEditMode = true;

            _layout = new LayoutProperty()
            {
                DockMode       = LayoutSetting.DockMode,
                SizeModeWidth  = LayoutSetting.SizeModeWidth,
                SizeModeHeight = LayoutSetting.SizeModeHeight,
            };
            propertyGrid_layout.SelectedObject = _layout;

            var pages     = LayoutSetting.Pages.ToList();
            var pageItems = LayoutSetting.PageItems.ToList();

            foreach (var p in pages)
            {
                string pageName = p.PageName;
                var    page     = CreatePage(pageName, p);

                var items = pageItems.Where(o => o.PageName == pageName).ToList();
                items.Reverse();
                foreach (var item in items)
                {
                    CreatePageItem(page, item, item.PageName);
                }
            }

            var pagesOfControl = tabControl_pages.SelectedTab.Controls[0].Controls.OfType <Page>().ToList();

            if (pagesOfControl.Count == 0)
            {
                return;
            }

            SelectedPage = pagesOfControl[0];
            ResetCells();
        }
コード例 #11
0
        protected override void OnHandleCreated(EventArgs e)
        {
            base.OnHandleCreated(e);

            if (Runtime.DesignMode)
            {
                return;
            }

            _doccomment.Resize += delegate(object sender, EventArgs ex)
            {
                //var renderer = ToolStripRenderer as ThemeToolStripRenderer;
                //LineColor = renderer.ColorTable.ToolStripGradientBegin;
                //HelpBackColor = renderer.ColorTable.ToolStripGradientBegin;

                LineColor         = LayoutSetting.GetBackColorCommon(LayoutSetting.Theme);
                HelpBackColor     = LayoutSetting.GetBackColorCommon(LayoutSetting.Theme);
                CategoryForeColor = LayoutSetting.GetForeColorCommon(LayoutSetting.Theme);
                SelectedItemWithFocusBackColor = LayoutSetting.GetBackColorHover(LayoutSetting.Theme);
                SelectedItemWithFocusForeColor = LayoutSetting.GetForeColorHover(LayoutSetting.Theme);
            };
            _doccomment.Height++;
            _doccomment.Height--;
        }
コード例 #12
0
 private void CreatePageDialog_Load(object sender, EventArgs e)
 {
     LayoutSetting.Invalidate(this);
 }
コード例 #13
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            if (BackgroundImage != null)
            {
                ImageAnimator.UpdateFrames(BackgroundImage);
                e.Graphics.DrawImage(BackgroundImage, 0, 0, Width, Height);
            }

            // 에디트 모드에서 이미지가 없을시 파란색 표기
            else if (LayoutSetting.IsEditMode)
            {
                using (var b = new SolidBrush(Color.FromArgb(50, Color.Blue)))
                {
                    e.Graphics.FillRectangle(b, new Rectangle(0, 0, Width, Height));
                }
            }

            // Text 표기
            if (!string.IsNullOrWhiteSpace(TextContent))
            {
                var color = LayoutSetting.GetForeColorCommon(LayoutSetting.Theme);
                using (var b = new SolidBrush(color))
                {
                    e.Graphics.DrawString(TextContent, TextFont, b, ClientRectangle, GetStringFormat());
                }
            }

            // 마우스 오버 표기
            if (_isMouseOver)
            {
                var color = Color.FromArgb(50, LayoutSetting.GetBackColorHover(LayoutSetting.Theme));
                using (var b = new SolidBrush(color))
                {
                    e.Graphics.FillRectangle(b, 0, 0, Width, Height);
                }
            }

            // 에디트 모드에서 Resize, 선택시 빨간색 표기
            if (LayoutSetting.IsEditMode)
            {
                using (var b = new SolidBrush(Color.Red))
                    using (var p = new Pen(Color.Red, 2))
                    {
                        var     bottom = ResizeRec;
                        Point[] locs   = new Point[]
                        {
                            new Point(bottom.X, bottom.Y + bottom.Height),
                            new Point(bottom.X + bottom.Width, bottom.Y),
                            new Point(bottom.X + bottom.Width, bottom.Y + bottom.Height)
                        };
                        e.Graphics.FillPolygon(b, locs);
                        e.Graphics.FillRectangle(b, MoveRec);
                        e.Graphics.DrawRectangle(p, new Rectangle(0, 0, Width, Height));
                    }

                if (IsSelected)
                {
                    using (var b = new SolidBrush(Color.FromArgb(100, Color.Red)))
                    {
                        e.Graphics.FillRectangle(b, 0, 0, Width, Height);
                    }
                }
            }
        }