• 大小: 1.14MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-10-24
  • 语言: ASP
  • 标签: 表情  

资源简介

平时我们在做IM聊天之类的软件的时候,一般都会使用Rich Edit控件来作为聊天编辑框和聊天记录框的控件在Visual Studio 2008 SP1下扩展了些功能,比如解码转义字符、编码转义字符、自动检测超链接、聊天记录框的用户内容和信息内容颜色和缩进分开显示等等,加上原来的插入位图表情、右键菜单、表情拾取器、RTF输入输出等等,可以符合基本的聊天控件要求了。见http://blog.csdn.net/akof1314/archive/2010/11/03/5983443.aspx文章 1.2版本更新修复内存泄露

资源截图

代码片段和文件信息

/*
 * 文件名:BmpContainer.cpp
 * 作用:位图拾取器的容器面板
 */

// BmpContainer.cpp : 实现文件
//

#include “stdafx.h“
#include “BmpContainer.h“
#include “BmpPicker.h“
#include “math.h“
// CBmpContainer
#define IDC_INNERBUTTON 10000
#define IDC_ICONCONTAINER 10001
IMPLEMENT_DYNAMIC(CBmpContainer CWnd)

CBmpContainer::CBmpContainer()
{
m_nRow=0;
m_nCol=0;
m_bClosed=FALSE;
}

CBmpContainer::~CBmpContainer()
{
CInnerButton* pInnerButton;
for(int i=0;i {
pInnerButton=m_InnerButtonArray.GetAt(i);
pInnerButton->SendMessage(WM_CLOSE00);
delete pInnerButton;
}
}


BEGIN_MESSAGE_MAP(CBmpContainer CWnd)
ON_WM_KILLFOCUS()
ON_WM_PAINT()
END_MESSAGE_MAP()



// CBmpContainer 消息处理程序



BOOL CBmpContainer::Create(POINT ptCButton* pParentButtonCArray *pBitmapArrayBOOL hasCreate) 
{
if(pBitmapArray->GetSize()<=0)return FALSE;

m_pParentButton=pParentButton;

///根据每张图片的大小创建IconContainer
//m_nCol=int(sqrt((double)pBitmapArray->GetSize()))+1;    //计算列数
m_nCol=10;
BITMAP bm;
pBitmapArray->GetAt(0)->GetBitmap(&bm); //以图片列表中的第0号图片的大小为基准
m_nCellWidth=bm.bmWidth+4; //内部单元的宽度
m_nCellHeight=bm.bmHeight+4; //内部单元的高度

CRect rect;
rect.left=pt.xrect.top=pt.y;
rect.right=pt.x+m_nCellWidth*m_nCol; //容器的宽度

if(pBitmapArray->GetSize()%m_nCol==0) //计算行数
{
m_nRow=pBitmapArray->GetSize()/m_nCol;
}
else
{
m_nRow=pBitmapArray->GetSize()/m_nCol+1;
}
//rect.bottom=pt.y+m_nCellHeight*m_nRow+2+46; ///容器的高度=(行数+2)*单元宽度要多两个扩展功能按钮的话,用这一行
rect.bottom=pt.y+m_nCellHeight*m_nRow+2;
rect.top=pt.y-m_nCellHeight*m_nRow-2;
rect.bottom=pt.y;
//pParentButton->GetParent()->ScreenToClient(&rect);
if (hasCreate)
{
SetWindowPos(&wndToprect.leftrect.top00SWP_NOSIZE);
return TRUE;
}
///创建容器
//CWnd::Create(NULL NULL WS_VISIBLE | WS_CHILD
//rectpParentButton->GetParent()IDC_ICONCONTAINER NULL);
CWnd::CreateEx(WS_EX_LEFT| WS_EX_TOOLWINDOWAfxRegisterWndClass(0)NULLWS_VISIBLE|WS_POPUPrectNULLNULL );
///创建图片张数+2个按钮
for(int i=0;i {
for(int j=0;jGetSize();j++)
{
///计算按钮的位置
CRect innerrect;
innerrect.left=j*m_nCellWidth;
innerrect.top=i*m_nCellHeight;
innerrect.right=innerrect.left+m_nCellWidth;
innerrect.bottom=innerrect.top+m_nCellHeight;

innerrect.DeflateRect(22);

///新建按钮
CInnerButton *pInnerButton;
pInnerButton=new CInnerButton;
pInnerButton->Create(NULLWS_CHILD |WS_VISIBLE
innerrectthisIDC_INNERBUTTON+i*m_nCol+j);

///设置按钮的图标
pInnerButton->SetBitmap(pBitmapArray->GetAt(i*m_nCol+j));
pInnerButton->ShowWindow(SW_SHOW);

///记录该按钮的指针
m_InnerButtonArray.Add(pInnerButton);
}
}


////创建两个扩展功能按钮
/*
this->GetClientRect(&rect);
CInnerButton *pInnerButton;
pInnerButton=new CInnerButton;

rect.left=2;
rect.right-=2;
rect.top=m_nRow*m_nCellHeight+3;

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       6500  2010-12-18 23:08  TestCoolChat\TestCoolChat\TestCoolChat.vcproj

     文件       2827  2010-10-22 00:16  TestCoolChat\TestCoolChat\ReadMe.txt

     文件        481  2010-10-22 00:16  TestCoolChat\TestCoolChat\TestCoolChat.h

     文件       1844  2011-05-13 23:52  TestCoolChat\TestCoolChat\TestCoolChat.cpp

     文件       1008  2010-10-28 10:25  TestCoolChat\TestCoolChat\TestCoolChatDlg.h

     文件       5102  2011-05-14 13:32  TestCoolChat\TestCoolChat\TestCoolChatDlg.cpp

     文件       1854  2010-10-22 00:16  TestCoolChat\TestCoolChat\stdafx.h

     文件       1030  2010-10-22 00:16  TestCoolChat\TestCoolChat\targetver.h

     文件        145  2010-10-22 00:16  TestCoolChat\TestCoolChat\stdafx.cpp

     文件       5748  2010-10-31 20:47  TestCoolChat\TestCoolChat\TestCoolChat.rc

     文件        368  2010-10-22 00:16  TestCoolChat\TestCoolChat\res\TestCoolChat.rc2

    .......     67777  2007-11-28 16:21  TestCoolChat\TestCoolChat\res\TestCoolChat.ico

     文件        925  2011-05-14 02:15  TestCoolChat\TestCoolChat\BmpPicker.h

     文件       3758  2011-05-14 02:31  TestCoolChat\TestCoolChat\BmpPicker.cpp

     文件        727  2010-10-25 02:27  TestCoolChat\TestCoolChat\InnerButton.h

     文件       5227  2010-10-26 13:30  TestCoolChat\TestCoolChat\InnerButton.cpp

     文件      42366  2010-10-22 00:51  TestCoolChat\TestCoolChat\img\InnerButtonMark.bmp

     文件       2167  2008-08-20 13:00  TestCoolChat\TestCoolChat\img\shame_32.png

     文件       2627  2008-08-20 12:59  TestCoolChat\TestCoolChat\img\after_boom_32.png

     文件       2611  2008-08-20 12:59  TestCoolChat\TestCoolChat\img\angry_32.png

     文件       2575  2008-08-20 13:00  TestCoolChat\TestCoolChat\img\stop_32.png

     文件       2540  2008-08-20 13:00  TestCoolChat\TestCoolChat\img\sleep_32.png

     文件       2518  2008-08-20 12:59  TestCoolChat\TestCoolChat\img\music_32.png

     文件       2512  2008-08-20 12:59  TestCoolChat\TestCoolChat\img\love_32.png

     文件       2499  2008-08-20 12:59  TestCoolChat\TestCoolChat\img\adore_32.png

     文件       2495  2008-08-20 12:59  TestCoolChat\TestCoolChat\img\haha_32.png

     文件       2474  2008-08-20 13:00  TestCoolChat\TestCoolChat\img\what_32.png

     文件       2429  2008-08-20 12:59  TestCoolChat\TestCoolChat\img\faint_32.png

     文件       2376  2008-08-20 12:59  TestCoolChat\TestCoolChat\img\grimace_32.png

     文件       2370  2008-08-20 12:59  TestCoolChat\TestCoolChat\img\cool_32.png

............此处省略134个文件信息

评论

共有 条评论