Гость
Целевая тема:
Создать новую тему:
Автор:
Форумы / WinForms, .Net Framework [игнор отключен] [закрыт для гостей] / "Визуализировать" бегунок splitContainer / 2 сообщений из 2, страница 1 из 1
12.11.2012, 14:43
    #38034713
waszkiewicz
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
"Визуализировать" бегунок splitContainer
Может, делал кто такую штуку - перерисовка бегунка splitComtainer?
...
Рейтинг: 0 / 0
12.11.2012, 16:46
    #38034975
HiMik2004
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
"Визуализировать" бегунок splitContainer
waszkiewicz,

Код: c#
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
public class MySplitContainer : SplitContainer
    {
        [DefaultValue(false)]
        public Boolean DrawSmartSeparator { get; set; }

        private Boolean blnIn = false;

        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            if (DrawSmartSeparator == false) return;
            try
            {
                if (this.SplitterWidth < 4) return;

                int dotsInterval = 8;
                Orientation orientation = this.Orientation;
                Rectangle rctSplitter = this.SplitterRectangle;

                Graphics g = e.Graphics;
                PointF cntr;
                PointF p1, p2, p3, p4;

                if (blnIn)
                {
                    g.FillRectangle(SystemBrushes.ControlDark, rctSplitter);
                }
                else
                {
                    g.FillRectangle(SystemBrushes.Control, rctSplitter);
                }

                switch (orientation)
                {
                    case Orientation.Vertical:
                        cntr = new PointF(rctSplitter.Left + rctSplitter.Width / (float)2, rctSplitter.Top + rctSplitter.Height / (float)2);
                        p1 = new PointF(cntr.X, cntr.Y - 1 * dotsInterval);
                        p2 = new PointF(cntr.X, cntr.Y + 1 * dotsInterval);
                        p3 = new PointF(cntr.X, cntr.Y - 2 * dotsInterval);
                        p4 = new PointF(cntr.X, cntr.Y + 2 * dotsInterval);
                        g.FillRectangle(SystemBrushes.ControlDarkDark, p1.X + 1, p1.Y + 1, 2, 2);
                        g.FillRectangle(SystemBrushes.ControlDarkDark, p2.X + 1, p2.Y + 1, 2, 2);
                        g.FillRectangle(SystemBrushes.ControlDarkDark, cntr.X + 1, cntr.Y + 1, 2, 2);
                        g.FillRectangle(SystemBrushes.ControlDarkDark, p3.X + 1, p3.Y + 1, 2, 2);
                        g.FillRectangle(SystemBrushes.ControlDarkDark, p4.X + 1, p4.Y + 1, 2, 2);

                        g.FillRectangle(SystemBrushes.ControlLightLight, p1.X, p1.Y, 2, 2);
                        g.FillRectangle(SystemBrushes.ControlLightLight, p2.X, p2.Y, 2, 2);
                        g.FillRectangle(SystemBrushes.ControlLightLight, cntr.X, cntr.Y, 2, 2);
                        g.FillRectangle(SystemBrushes.ControlLightLight, p3.X, p3.Y, 2, 2);
                        g.FillRectangle(SystemBrushes.ControlLightLight, p4.X, p4.Y, 2, 2);

                        break;

                    default:
                        cntr = new PointF(rctSplitter.Left + rctSplitter.Width / (float)2, rctSplitter.Top + rctSplitter.Height / (float)2);
                        p1 = new PointF(cntr.X - 1 * dotsInterval, cntr.Y);
                        p2 = new PointF(cntr.X + 1 * dotsInterval, cntr.Y);
                        p3 = new PointF(cntr.X - 2 * dotsInterval, cntr.Y);
                        p4 = new PointF(cntr.X + 2 * dotsInterval, cntr.Y);
                        g.FillRectangle(SystemBrushes.ControlDarkDark, p1.X + 1, p1.Y + 1, 2, 2);
                        g.FillRectangle(SystemBrushes.ControlDarkDark, p2.X + 1, p2.Y + 1, 2, 2);
                        g.FillRectangle(SystemBrushes.ControlDarkDark, cntr.X + 1, cntr.Y + 1, 2, 2);
                        g.FillRectangle(SystemBrushes.ControlDarkDark, p3.X + 1, p3.Y + 1, 2, 2);
                        g.FillRectangle(SystemBrushes.ControlDarkDark, p4.X + 1, p4.Y + 1, 2, 2);


                        g.FillRectangle(SystemBrushes.ControlLightLight, p1.X, p1.Y, 2, 2);
                        g.FillRectangle(SystemBrushes.ControlLightLight, p2.X, p2.Y, 2, 2);
                        g.FillRectangle(SystemBrushes.ControlLightLight, cntr.X, cntr.Y, 2, 2);
                        g.FillRectangle(SystemBrushes.ControlLightLight, p3.X, p3.Y, 2, 2);
                        g.FillRectangle(SystemBrushes.ControlLightLight, p4.X, p4.Y, 2, 2);

                        break;
                }
            }
            catch { }

        }

        protected override void OnMouseEnter(EventArgs e)
        {
            base.OnMouseEnter(e);
            blnIn = true;
            Invalidate();
        }

        protected override void OnMouseLeave(EventArgs e)
        {
            base.OnMouseLeave(e);
            blnIn = false;
            Invalidate();
        }

    }
...
Рейтинг: 0 / 0
Форумы / WinForms, .Net Framework [игнор отключен] [закрыт для гостей] / "Визуализировать" бегунок splitContainer / 2 сообщений из 2, страница 1 из 1
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]