只能用自己的方法写了一下:
using System;
using System.Collections.Generic;
using System.Text;
using System.Globalization;
namespace ConsoleApplication2
{
class Program
{
static string UnicodeToString(string srcstr)
{
string ret = "";
string src = srcstr;
int len = srcstr.Length / 4;
for (int i = 0; i <= len - 1; i++)
{
string str = "";
str = src.Substring(0,4);
src = src.Substring(4);
byte[] bytes = new byte[2];
bytes[1] = byte.Parse(int.Parse(str.Substring(0, 2), NumberStyles.HexNumber).ToString());
bytes[0] = byte.Parse(int.Parse(str.Substring(2, 2), NumberStyles.HexNumber).ToString());
ret += Encoding.Unicode.GetString(bytes);
}
return ret;
}
你也继续哈!作者: wyt323 时间: 2008-6-10 14:16
using System;
using System.Collections.Generic;
using System.Text;
using System.Globalization;
namespace ConsoleApplication2
{
class Program
{
static string UnicodeToString(string srcstr)
{
string ret = "";
string src = srcstr;
int len = srcstr.Length / 4;
for (int i = 0; i <= len - 1; i++)
{
string str = "";
str = src.Substring(0,4);
src = src.Substring(4);
if(有非法字符)
{
continue;
}
else
{
ret+=((char)int.Parse(str, System.Globalization.NumberStyles.HexNumber)).ToString();
}
class ShowString
{
private:
CStringList m_strlist;
int m_nCount,m_nHeight,m_nCountLine;
const static int m_csnDec;
const static int m_csnMaxFont;
const static int m_csnMinFont;
POSITION m_Pos;
bool m_bIsFull;
public:
ShowString(void);
ShowString(CString strshow[],int nCount);
void Show(CDC * pdc,CRect rcShow);
private:
void ShowText(CDC *pdc,int nleft,int nBottom,CString str,int nHeight,COLORREF col);
int GetFontHeight(int nIndex);
int GetLengthMoveRight(CRect rcShow);
int GetLeft(int nIndex,CRect rcShow);
int GetBottom(int nIndex);
CString GetString();
public:
~ShowString(void);
};
//ShowString.cpp
#include "StdAfx.h"
#include "ShowString.h"
const int ShowString::m_csnDec=2;
const int ShowString::m_csnMaxFont=40;
const int ShowString::m_csnMinFont=2;
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
this->SetTimer(m_timer,100,NULL);
return TRUE; // return TRUE unless you set the focus to a control
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CShowDlg::OnPaint()
{
CPaintDC dc(this); // device context for painting
if (IsIconic())
{
SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CRect rc;
this->GetClientRect(rc);
m_pshow->Show(&dc,rc);
CDialog::OnPaint();
}
}
// The system calls this function to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CShowDlg::OnQueryDragIcon()
{
return static_cast<HCURSOR>(m_hIcon);
}
void CShowDlg::OnTimer(UINT_PTR nIDEvent)
{
// TODO: Add your message handler code here and/or call default
if(m_timer==nIDEvent)
{
this->Invalidate();
}
CDialog::OnTimer(nIDEvent);
}
void CShowDlg::OnClose()
{
// TODO: Add your message handler code here and/or call default
delete m_pshow;
m_pshow=NULL;
CDialog::OnClose();
}
BOOL CShowDlg::OnEraseBkgnd(CDC* pDC)
{
// TODO: Add your message handler code here and/or call default
return FALSE;