问题1:QQ的聊天框显示聊天内容,也就是上半部份是用什么控件实现在,能给个例子吗?他的容器可以放文字,也可以是图片;
问题2:当消息来时,,怎样实现如QQ一样的头像晃动效果,我是用的LISTVIEW控件,不知是不是应该用其它控件来做。
问题3:怎样实现视频聊天及语音聊天功能。

解决方案 »

  1.   

    1.RichTextbox
    2.晃动头像是交换图片实现
    3.这个问题比较复杂
      

  2.   

    2.头像闪动的问题:
    private void timer1_Tick(object sender, System.EventArgs e)
    {
    this.timer2.Stop();
    this.pictureBox1.Image = this.imageList1.Images[0];
    this.timer2.Start();
    } private void timer2_Tick(object sender, System.EventArgs e)
    {
    this.timer1.Stop();
    this.pictureBox1.Image = this.imageList1.Images[1];
    this.timer1.Start();
    }
    其中:imageList1中放有2张图片,这用线程做比较好
    两个timer1初始时都设置为500,true
      

  3.   

    我给你解答第三个问题:
    首先实现语音不是很复杂的问题,C#,delphi里面应该就有处理这个问题的方法不需要第三方实现,至少C#是这样
    视频实现起来有点复杂,不过你是完全有可能实现的(指的是你不需要付费支付专门控件)
    最后一个关键的效率问题,语音,视频实现的了,可效果可能是大相径庭,差别很大的。
    目前包括QQ在内的在线语音视频使用的核心技术都是花钱购买第三方的。
    现在的TM软件很多实现的核心技术也不太一样
      

  4.   

    我分析过一个C++局域网视频软件(VideoNet version 1.1)的源码
    里面有一个VideoCapture类  下面是捕获视频用的二个关键函数
    BOOL VideoCapture::Initialize()
    {
    char devname[100],devversion[100];
    char str[200];
    int index=0;m_capwnd = capCreateCaptureWindow("Capture",WS_POPUP,0,0,1,1,0,0);
    if(m_capwnd==NULL)
    {
    log.WriteString("\n Unable to create capture window");
    return FALSE;
    } //connect callback functions
    capSetUserData(m_capwnd,this);
    //Change destroy functions also........     capSetCallbackOnVideoStream(m_capwnd,OnCaptureVideo);
     
    capGetDriverDescription(index,devname,100,devversion,100);

    sprintf(str,"\n Driver name = %s version = %s ",devname,devversion);
    log.WriteString(str); // Connect to webcam driver
    if( ! capDriverConnect(m_capwnd,index) )
    {

    // Device may be open already or it may not have been
    // closed properly last time.
    AfxMessageBox("Unable to open Video Capture Device");
    log.WriteString("\n Unable to connect driver to the window");
    m_capwnd=NULL;
    return FALSE;
    } // Set the capture parameters
    if(SetCapturePara()==FALSE)
    {
    log.WriteString("\n Setting capture parameters failed");
    capDriverDisconnect(m_capwnd);
    return FALSE;
    }
    return TRUE;
    }
    /**
    *   Start capturing frames from webcam
    *
    */BOOL VideoCapture::StartCapture()
    {
    // Start live capturing ...
    if(capCaptureSequenceNoFile(m_capwnd)==FALSE)
    {
    log.WriteString("\n Failed to capture Sequence ..");
    return FALSE;
    }
    return TRUE;}以cap开关的都是windows提供的函数 查下MSDN都有
    我把这个类抠了出来 自己做了个视频捕获的小程序(C++)
     
    我也见过有人把上面见个API导到C#中做捕获的
    也就是说捕获很容易 关键是传输时的编码源程序好像用的是一种叫 h.263 的编码,有一大堆文件发送和接收就是用的一般的Socket
    就知道这么多了