小弟我在一公司实习,这是我最近要做的项目。VS2005下用C#做界面,调一博士做的识别模块dll因为公司装的正版2003,在2003下遇到很多麻烦,只好转到 C# 2005 express下开发,有以下几个问题,请各位指教,谢谢!1. 系统启动时初始化要显示四个窗体form,成田字排列,请问如何实现? 我只会在主窗体下通过buttonclick来创建一个新窗体,就是初始化的时候只有一个主的。2. 在主窗体下调WindowsMediaPlayer,我们的系统想在MediaPlayer上显示识别的物体,其实就是在MediaPlayer上绘一些线,可以实现吗?请指教。3. 一个新的C#窗体如何绘制座标和上面的曲线?暂时这么些问题,请赐教,不胜感谢。
For this one, you might look into this post, which includes a compilable sample:pictureBox1的图像上画矩形框
控制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+画
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.
然后再在这个主窗体上用GDI+绘图IMHO,it is not practical to use GDI+ on top of AVI playback.
GDI+ is not built for this purpose.
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.
{
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;//结束鼠标捕获
}
什么都不用加在窗体上直接画!