C # WinForm implementation of QQ chat bubble interface, the principle is very simple, through the Webkitbrowser (third-party browser control, because of the poor compatibility) loading HTML code implementation, chat interface is a pure HTML code, and QQ chat interface can be compared, very good, Because it is HTML, so extensibility is very large, click the Send button can be text box to join chat, the project development process encountered a few difficulties are resolved, such as:
1, how to chat the new message after inserting the scroll bar scroll to the bottom, here I search online webkitbrowser scroll bar usage can not find, so here I used the anchor link through each load HTML with JS jump to the anchor point to achieve the scroll bar always at the bottom;
2, the compatibility of the HTML problem, originally I started with built-in WebBrowser to develop, because his kernel is IE many HTML effects can not be released, so using a third-party control Webkitbrowser, this control disadvantage is the need to use a lot of DLLs, in the bin directory.
3, beautify the scroll bar (online code)
。 Project complete projects: Click to download
Here are the following:
Here's some code:
Private voidForm1_Load (Objectsender, EventArgs e) {webkitbrowser1.iswebbrowsercontextmenuenabled=false;//set the control's Iswebbrowsercontextmenuenabled property to False to prevent the WebBrowser control from displaying its shortcut menu when the user right-clicks it. stringSB =""; SB=@""; Webkitbrowser1.documenttext=SB; }
WinForm Implementation QQ Chat bubble 200 lines of code