Exemple #1
0
        public uiItemLabel(oNode node, IconType iconType = IconType._none)
        {
            _node = node;
            string text = node.title;

            _detail = new FlowLayoutPanel()
            {
                Visible    = false,
                AutoScroll = true,
                //Dock = DockStyle.Fill,
                BackColor     = Color.White,
                FlowDirection = FlowDirection.RightToLeft,
                WrapContents  = true,
                Padding       = new Padding(7, 0, 0, 0),
                RightToLeft   = RightToLeft.Yes,
                BorderStyle   = BorderStyle.None,
                Margin        = new Padding(0),
            };
            _exit = new IconButton()
            {
                IconType = IconType.close_circled, Visible = false
            };
            _text = new Label()
            {
                Text = text, AutoSize = true, TextAlign = ContentAlignment.TopLeft
            };
            _state = new Label()
            {
                Dock = DockStyle.Left, AutoSize = false, Width = 1
            };

            using (Graphics g = CreateGraphics())
            {
                SizeF size = g.MeasureString(text, _text.Font);
                wi_text = (int)Math.Ceiling(size.Width);
            }

            if (iconType != IconType._none)
            {
                _icon = new IconButton(19)
                {
                    IconType = iconType, Location = new Point(3, 5), Width = 19
                };
                this.Controls.Add(_icon);

                wi_header      = wi_text + _icon.Width + _state.Width;
                _text.Location = new Point(_icon.Width + _state.Width, 5);
            }
            else
            {
                wi_header      = wi_text + _state.Width;
                _text.Location = new Point(_state.Width, 5);
            }

            this.Width = wi_header;

            this.Controls.AddRange(new Control[] { _text, _state, _exit, _detail });
            _text.Click += _text_Click;
            _exit.Click += _text_Click;
            this.Click  += _text_Click;

            this.HandleCreated += (se, ev) =>
            {
                if (wi_header > this.Parent.Width)
                {
                    wi_header  = this.Parent.Width;
                    this.Width = wi_header;
                }
            };
        }
Exemple #2
0
        public void f_init()
        {
            this.TopMost         = true;
            this.Icon            = Resources.favicon;
            this.FormBorderStyle = FormBorderStyle.None;
            this.BackColor       = Color.Black;
            this.Width           = 1;
            //if (!string.IsNullOrEmpty(title)) this.Text = title;

            // MEDIA
            m_media                  = new AxWindowsMediaPlayer();
            m_media.Dock             = DockStyle.Fill;
            m_media.Enabled          = true;
            m_media.PlayStateChange += new _WMPOCXEvents_PlayStateChangeEventHandler(this.f_media_event_PlayStateChange);
            this.Controls.Add(m_media);

            // MODAL
            m_modal            = new ControlTransparent();
            m_modal.Location   = new Point(0, 0);
            m_modal.Anchor     = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
            m_modal.BackColor  = Color.Black;
            m_modal.Opacity    = 1;
            m_modal.MouseMove += f_form_move_MouseDown;
            m_modal.Click     += (se, ev) =>
            {
                if (m_media.playState == WMPLib.WMPPlayState.wmppsPlaying)
                {
                    m_media.Ctlcontrols.pause();
                }
                else
                {
                    m_media.Ctlcontrols.play();
                }
            };
            this.Controls.Add(m_modal);
            m_modal.MouseDoubleClick += (se, ev) =>
            {
                if (m_media.uiMode == "none")
                {
                    m_media.uiMode = "full";
                    m_modal.Height = this.Height - 45;
                }
                else
                {
                    m_media.uiMode = "none";
                    m_modal.Height = this.Height;
                }
                m_media.Ctlcontrols.play();
            };

            // RESIZE
            m_resize           = new Panel();
            m_resize.Anchor    = AnchorStyles.Bottom | AnchorStyles.Right;
            m_resize.BackColor = Color.Black;
            m_resize.Size      = new Size(8, 8);
            this.Controls.Add(m_resize);
            m_resize.MouseDown += (se, ev) => { f_hook_mouse_Open(); m_resizing = true; };
            m_resize.MouseUp   += (se, ev) =>
            {
                m_resizing = false;
                f_hook_mouse_Close();
                //Debug.WriteLine("RESIZE: ok ");
                if (m_media.playState == WMPLib.WMPPlayState.wmppsPlaying)
                {
                    m_media.Ctlcontrols.pause();
                    m_media.Ctlcontrols.play();
                }
                else if (m_media.playState == WMPLib.WMPPlayState.wmppsPaused)
                {
                    m_media.Ctlcontrols.play();
                    m_media.Ctlcontrols.pause();
                }
            };

            btn_exit = new IconButton(18)
            {
                IconType = IconType.ios_close_empty, Anchor = AnchorStyles.Right | AnchorStyles.Top
            };
            btn_exit.Click += exit_Click;
            this.Controls.Add(btn_exit);
        }