自定义控件、用户定义控件,方便用户定义功能强大的控件。

Control属性:

Size,BackGround,Location等属性

Control方法:

鼠标事件继承了System.Windows.Form.Control

 

自定义了一个视频播放的窗口控件:

自定义控件、用户定义控件

 

 

 UpdateVisiblity()
        {
            if(dvrVisible)
            {
                
for (int i = 0; i < MaxClos;i++ )
                {
                    videowindows[i].Visible 
= (i<cols);
                }
            }
        }

        
private void UpdateSize()
        {
            
int width, height;

            
//width = (ClientRectangle.Width / cols) - 4;
            
//height = (ClientRectangle.Height ) - 4;
            width = this.Size.Width / cols - 4;
            height 
= this.Size.Height - 4;
      
            
// starting position of the view
            int startX = (ClientRectangle.Width - cols * (width + 4)) / 2;
            
int startY = (ClientRectangle.Height -(height + 4)) / 2;

            
//int startX = 2;
            
//int startY = 2;

            
this.SuspendLayout();

            
for (int i = 0; i < cols; i++)
            {
                videowindows[i].Location 
= new Point(startX + (width + 4* i + 1, startY+1);
                videowindows[i].Size 
= new Size(width , height );
            }

            
this.ResumeLayout(false);
        }

      问题:窗口不能充满容器

 

 

 

相关文章:

  • 2021-07-24
  • 2022-12-23
  • 2021-05-15
  • 2022-03-02
  • 2021-09-03
  • 2021-09-06
猜你喜欢
  • 2021-11-18
  • 2021-09-01
  • 2022-12-23
  • 2021-07-22
  • 2021-10-13
  • 2022-12-23
相关资源
相似解决方案