Ejemplo n.º 1
0
        private void setBottomRight(SimpleOsdForm i_Osd)
        {
            Rectangle workingArea = Screen.PrimaryScreen.WorkingArea;
            int       x           = workingArea.Right - i_Osd.Width - k_Margin;
            int       y           = workingArea.Bottom - i_Osd.Height - k_Margin;

            i_Osd.Location = new Point(x, y);
        }
Ejemplo n.º 2
0
 private void applySettingsToOSD(SimpleOsdForm i_Osd)
 {
     i_Osd.HideFast();
     // apply initial settings
     i_Osd.Label.ForeColor = Properties.Settings.Default.ForeColor;
     i_Osd.Label.BackColor = Properties.Settings.Default.BackColor;
     i_Osd.Label.Font      = Properties.Settings.Default.Font;
     i_Osd.Opacity         = Properties.Settings.Default.Opacity;
     i_Osd.Border          = Properties.Settings.Default.OsdBorder;
 }
Ejemplo n.º 3
0
        private void loadExample()
        {
            if (this.m_ExampleOSD == null)
            {
                const bool k_Clickthrough = true;

                this.m_ExampleOSD            = new SimpleOsdForm(!k_Clickthrough);
                this.m_ExampleOSD.MouseUp   += new MouseEventHandler(m_ExampleOSD_MouseUp);
                this.m_ExampleOSD.MouseDown += new MouseEventHandler(m_ExampleOSD_MouseDown);
                this.m_ExampleOSD.Move      += new EventHandler(m_ExampleOSD_Move);
                this.m_ExampleOSD.Label.Text = "Example";
                this.updateExampleLocation();

                this.applySettingsToOSD(this.m_ExampleOSD);
            }

            this.m_ExampleOSD.ShowAlways(this);
        }
Ejemplo n.º 4
0
 private void setUpperRight(SimpleOsdForm i_Osd)
 {
     this.setBottomRight(i_Osd);
     i_Osd.Location = new Point(i_Osd.Location.X, k_Margin);
 }
Ejemplo n.º 5
0
 private void setUpperLeft(SimpleOsdForm i_Osd)
 {
     i_Osd.Location = new Point(k_Margin, k_Margin);
 }
Ejemplo n.º 6
0
        private void updateStickyOSD()
        {
            // style normal - hide and return
            if (this.m_Style == eStyle.Normal)
            {
                foreach (SimpleOsdForm o in m_ListStickyOSD)
                {
                    o.HideFast();
                }
                return;
            }

            // initialize osds
            if (m_ListStickyOSD.Count == 0)
            {
                for (int c = 0; c < 3; c++)
                {
                    SimpleOsdForm o = new SimpleOsdForm();
                    this.applySettingsToOSD(o);
                    m_ListStickyOSD.Add(o);
                }
            }

            int width  = 0;
            int height = 0;
            int active = 0;

            foreach (eOSD o in Enum.GetValues(typeof(eOSD)))
            {
                int i = (int)o;

                if (m_ListLabels[i] == string.Empty)
                {
                    m_ListStickyOSD[i].HideFast();
                    continue;
                }

                active++;

                m_ListStickyOSD[i].Label.AutoSize = true; // this fix width and height
                m_ListStickyOSD[i].Label.Text     = m_ListLabels[i];

                // get max width
                if (m_ListStickyOSD[i].Label.Width > width)
                {
                    width = m_ListStickyOSD[i].Label.Width;
                }

                if (height == 0)
                {
                    height = m_ListStickyOSD[i].Label.Height;
                }

                m_ListStickyOSD[i].ShowAlways();
            }

            Point p = this.m_OSD.Location;

            if (this.m_OsdLocation == eLocation.BottomRight ||
                this.m_OsdLocation == eLocation.UpperRight)
            {
                p.X = Screen.PrimaryScreen.WorkingArea.Width - width - k_Margin;
            }

            int horizontal_width = active * width + active * k_Margin;
            int hz_half_width    = horizontal_width / 2;

            if (this.m_Style == eStyle.StickyHorizontal &&
                (this.m_OsdLocation == eLocation.BottomRight ||
                 this.m_OsdLocation == eLocation.UpperRight))
            {
                p.X = Screen.PrimaryScreen.WorkingArea.Width - horizontal_width;
            }

            int vertical_height = active * height + active * k_Margin;
            int vt_half_height  = vertical_height / 2;

            if (this.m_Style == eStyle.StickyVertical &&
                (this.m_OsdLocation == eLocation.BottomLeft ||
                 this.m_OsdLocation == eLocation.BottomRight))
            {
                p.Y = Screen.PrimaryScreen.WorkingArea.Height - vertical_height;
            }

            if (this.m_OsdLocation == eLocation.Center)
            {
                if (this.m_Style == eStyle.StickyHorizontal)
                {
                    p.X = p.X - hz_half_width;
                }
                else if (this.m_Style == eStyle.StickyVertical)
                {
                    p.Y = p.Y - vt_half_height;
                }
            }

            this.m_OSD.Location = p;

            foreach (eOSD o in Enum.GetValues(typeof(eOSD)))
            {
                int i = (int)o;

                if (m_ListLabels[i] == string.Empty)
                {
                    continue;
                }

                m_ListStickyOSD[i].Location = p;

                switch (this.m_Style)
                {
                case eStyle.StickyHorizontal:
                    //p.X = p.X + m_ListStickyOSD[i].Label.Width + k_Margin;
                    p.X = p.X + width + k_Margin;
                    break;

                case eStyle.StickyVertical:
                    p.Y = p.Y + m_ListStickyOSD[i].Label.Height + k_Margin;
                    break;
                }
            }

            foreach (SimpleOsdForm o in m_ListStickyOSD)
            {
                if (width > 0)
                {
                    // fixed width for sticky vertical
                    o.Label.AutoSize = false;
                    o.Label.Width    = width;
                }
            }
        }