小弟我在一公司实习,这是我最近要做的项目。VS2005下用C#做界面,调一博士做的识别模块dll因为公司装的正版2003,在2003下遇到很多麻烦,只好转到 C# 2005 express下开发,有以下几个问题,请各位指教,谢谢!1. 系统启动时初始化要显示四个窗体form,成田字排列,请问如何实现? 我只会在主窗体下通过buttonclick来创建一个新窗体,就是初始化的时候只有一个主的。2. 在主窗体下调WindowsMediaPlayer,我们的系统想在MediaPlayer上显示识别的物体,其实就是在MediaPlayer上绘一些线,可以实现吗?请指教。3. 一个新的C#窗体如何绘制座标和上面的曲线?暂时这么些问题,请赐教,不胜感谢。

解决方案 »

  1.   

    3. 一个新的C#窗体如何绘制座标和上面的曲线?
    For this one, you might look into this post, which includes a compilable sample:pictureBox1的图像上画矩形框
      

  2.   

    1、New 4个Rectange 分别做为4个Form的bounds,如果是要4个一样的话,其他3个为继承窗体,随着主窗体LOAD而LOAD
    控制4个Rectange的左顶点坐标,以及长宽,让他们组合为一个田字形,然后分别把4个FORM的bounds=RECTANGE。
    如果是要4个不同的窗体,可以先做4个窗体,然后做一主启动窗体,主窗体LOAD时,不可见,在LOAD主窗体时,LOAD4个已做好的窗体,绑定位置也是用rectange
    rect1(0,0,100,100) rect2(100,0,100,100)
    rect3(0,100,100,100)rect4(100,100,100,100)2、如楼上,用GDI+画3、如楼上,用GDI+画
      

  3.   

    2. 在主窗体下调WindowsMediaPlayer,我们的系统想在MediaPlayer上显示识别的物体,其实就是在MediaPlayer上绘一些线,可以实现吗?请指教。 Usually the WindowsMediaPlayer window is a DirectDraw surface. It's not practical to use GDI+ to draw onto that surface.With WindowsMediaplayer, one possible way is to implement a filter 
    interface (if provided by the WindowsMediaPlayer) to overlay some image.Another possible way is to look into DirectX.Since I am not familiar with DirectX in C#, feel free to ignore my suggestion.
      

  4.   

    要修改WindowsMediaPlayer的显示图像?不现实吧,微软有提供相应接口么?
      

  5.   

    在主窗体不使用WindowsMediaPlayer也可以,那在C#中如何实现AVI的视频播放(不使用WindowsMediaPlayer)?然后再在这个主窗体上用GDI+绘图。
      

  6.   

    ...C#中如何实现AVI的视频播放(不使用WindowsMediaPlayer)? 
    然后再在这个主窗体上用GDI+绘图
    IMHO,it is not practical to use GDI+ on top of AVI playback. 
    GDI+ is not built for this purpose.
      

  7.   

    请问各位,如何在一个窗体中即可以视频播放avi又可以在视频上绘图呢?谢谢!
      

  8.   

    请问各位,如何在一个窗体中即可以视频播放avi又可以在视频上绘图呢?
    Video players are NOT using GDI to show the playback - GDI just too slow - they directly draw to the surface without using GDI. I have a doubt whether the surface is compatible with GDI+. Even if you manage to use 
    GDI+ to draw something, your drawing will soon be overwritten by the video playback.In OpenCV's case, OpenCV makes itself as a filter in the video playback graph, so it can provides you a change to get the buffer for analysis or modify the buffer to overlay your own picture.That is the reason I said it is not practical to use GDI+ on top of video playback.
      

  9.   

    那使用OpenCV如何处理??我读过opencv的读视频文件的示例代码,C++写的,如何在C#中实现呢?
     
      

  10.   

    另外问个菜问题在一个窗体上绘曲线前,需要在窗体上加什么控件?  我加了个picturebox,然后在pictureBox1_Click上直接加g.DrawLine,没任何效果出来。画那种X-Y型的坐标如何画? 谢谢!
      

  11.   

    GDI+   很强大的  曾经在vb里面用c#里面写的gdi+的方法做了个打印的一个软件
      

  12.   

    private void Form1_Load(object sender, System.EventArgs e)
    {
    g=this.CreateGraphics();//建立Graphics对象
    MyPen=new Pen(Color.Black ,1);//建立画笔对象
    MyBrush=new SolidBrush(Color.Blue);//建立画刷对象
    } private void Form1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
    {
    this.Capture =true;//捕获鼠标
    DrawShould=true;//启动绘图
    StartPt.X=e.X ;//起始点
    StartPt.Y=e.Y ;
    EndPt=StartPt;//终止点
    } private void Form1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
    {
    if (DrawShould==true)//如果启动了绘图
    { MyPen.Color=this.BackColor ;//设置画笔的颜色为背景色
    //清除前面绘制的图形
      g.DrawEllipse (MyPen,StartPt.X ,StartPt.Y,EndPt.X-StartPt.X ,EndPt.Y-StartPt.Y  );
      MyPen.Color=Color.Black ;  //设置画笔的颜色为黑色 
    MyPen.DashStyle=DashStyle.Dash;//设置虚线样式
    //绘制轮廓
      g.DrawEllipse (MyPen,StartPt.X ,StartPt.Y ,e.X-StartPt.X ,e.Y-StartPt.Y  ) ;
      EndPt.X =e.X ;//把当前点设置为终点
      EndPt.Y=e.Y;
       }
    } private void Form1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
    {
    DrawShould=false;//停止画图
    MyPen.Color=this.BackColor ;//设置图笔颜色为背景色
    //清除先前的轮廓
    g.DrawEllipse (MyPen,StartPt.X ,StartPt.Y,EndPt.X-StartPt.X ,EndPt.Y-StartPt.Y  );
    //绘制以蓝色填充的椭圆
    g.FillEllipse(MyBrush,StartPt.X ,StartPt.Y ,e.X-StartPt.X ,e.Y-StartPt.Y);
    this.Capture =false;//结束鼠标捕获

    }
    什么都不用加在窗体上直接画!