QQ登录

只需一步,快速开始

上位机MFC文本滚动特效源代码

[ 复制链接 ]

上位机MFC文本滚动特效源代码

上位机MFC文本滚动特效源代码

例程效果如上图
可以设置文本滚动速度,
绚丽背景,用户是否可通过鼠标操作文本等功能。
程序是通过从CWnd派生自己的集成类实现的。
class CCreditsCtrl : public CWnd;
可以在自己的工程中实例化一个对象        CCreditsCtrl m_wndCredits;
再初始化此对象,添加文本内容。

  1. BOOL CCreditsDlgDlg::OnInitDialog()
  2. {
  3.         CDialog::OnInitDialog();

  4.         // Set the icon for this dialog.  The framework does this automatically
  5.         //  when the application's main window is not a dialog
  6.         SetIcon(m_hIcon, TRUE);                        // Set big icon
  7.         SetIcon(m_hIcon, FALSE);                // Set small icon

  8.         srand((unsigned)time(NULL));
  9.        
  10.         // initialize credits control...

  11.         // Content
  12.         CString s;
  13.         s = "<font color='255,255,255' face='arial' size='12' align='center'>";
  14.         s += "<font size='28' face='Comic Sans MS' style='ui' color='255,255,255'>Demo Stuff </font><p>";
  15.         s += "  <font style='bu' align='left'>Color:<br></font><font color='255,0,0'>y</font><font color='220,30,10'>e</font><font color='200,60,30'>e</font><font color='200,100,50'>e</font><font color='180,120,80'>e</font><font color='160,140,100'>e</font><font color='140,160,120'>e</font><font color='120,180,140'>e</font><font color='100,200,160'>e</font><font color='80,180,180'>e</font><font color='60,140,220'>e</font><font color='80,120,250'>h</font><font color='110,100,255'>a</font><font color='130,90,255'>a</font><font color='150,80,255'>a</font><font color='170,70,255'>a</font><font color='180,50,255'>a</font><br>";
  16.         s += "  <font style='bu' align='left'>Font:<br></font><font color='0,200,100' size='14' face='Comic Sans MS'>Comic Sans MS</font><br><font color='0,200,100' size='14' face='Courier New'>Courier New</font><br><font color='0,200,100' size='14' face='Tahoma'>Tahoma</font><br>";
  17.         s += "  <font style='bu' align='left'>Size:<br></font><font color='150,100,255'><font size='42'>W</font><font size='36'>H</font><font size='28'>O</font><font size='18'>O</font><font size='14'>O</font><font size='18'>O</font><font size='28'>O</font><font size='36'>O</font><font size='42'>W</font></font><br>";
  18.         s += "  <font style='bu' align='left'>Styles:<br></font><font color='40,120,240' size='14'><font style='b'>bold</font>  <font style='i'>italic</font>  <font style='u'>underline</font>  <font style='s'>strikeout</font></font><br>";
  19.         s += "  <font style='bu' align='left'>Background:<br></font><font color='255,255,255' size='14' style='b'><font background='0,0,255'>Blue</font>  <font background='255,0,0'>Red</font>  <font background='210,150,40'>Brown</font>  <font background='0,0,255' color='none'>Ghost Font</font></font><br>";
  20.         s += "  <font style='bu' align='left'>Alignment:<br></font><font color='255,150,40' size='14' style='b'><font align='right'>right <br></font><font align='center'>center<br></font><font align='left'> left<br></font></font>";
  21.         s += "  <font style='bu' align='left'>Vertical Alignment:<br></font><font color='0,220,160' size='12' style='b'><font valign='top'>top</font><font valign='middle'>middle</font><font valign='bottom'>bottom</font><font size='48'>BIG</font></font><br>";
  22.         s += "  <font style='bu' align='left'>Resource Bitmap:<br></font><font color='30,70,255' size='12' style='b'><img src='#%d'><font color='255,0,0'>    red </font><font valign='bottom'>bo</font><font valign='middle'>rd</font><font valign='top'>er </font><img src='#%d' border='4' color='255,0,0'></font><br>";
  23.         s += "  <font style='bu' align='left'>Links:<br></font><font color='100,160,220' size='14' style='b'><a href='#Hello World!#%d' color='100,220,160'>Click Me!</a><br><a href='notepad.exe' color='100,220,160' style='bui'>notepad</a><br><a href='http://www.w3c.org' color='100,220,160' face='Courier New' size='16'>www.w3c.org</a><br><a href='mailto:devix@devix.cjb.net?SUBJECT=Hello World!! ;)' color='100,220,160' face='Comic Sans MS' size='18'>devix@devix.cjb.net</a><br><font size='36' color='255,200,0' style='u'><a href='#\nDo or do not. There is no try.\n\n\t\t-Yoda#%d' color='none' background='255,200,0' style='-uis'>Click Here</a></font><vspace size='4'><font valign='top' size='12' style='-b'>image link:  </font><a href='#%d#%d' color='255,200,0'><img src='#%d' border='2' color='none'></a></font><vspace size='80'>";
  24.         s += "<font size='28' face='Comic Sans MS' style='ui'>CCreditsCtrl </font><p><font size='18' style='u' color='255,200,0'>About</font><p>Coded in January 2001<br>by <font style='b'>Marc Richarme</font><vspace size='5'><font align='left' size='11'><hspace size='30'><font style='i'>mail:   </font><font style='ub'><a href='mailto:devix@devix.cjb.net?SUBJECT=Hello World!' color='255,200,0'>devix@devix.cjb.net</a></font><br><hspace size='30'><font style='i'>web:   </font><font style='ub'><a href='http://devix.cjb.net' color='255,200,0'>http://devix.cjb.net</a></font><p></font><font size='18' style='u' color='255,200,0'>Credits</font><p>Thanks to <font style='ub'><a href='http://www.codeproject.com' color='255,200,0'>The Code Project</a></font> for being<br> the coolest VC++/MFC site out there!<br></font><vspace size='80'>";

  25.         // Content Data
  26.         m_wndCredits.FormatDataString(s,IDB_BITMAP1,IDB_BITMAP1,(long)CCreditsDlgDlg::TestFunction,(long)CCreditsDlgDlg::TestFunction,(long)this,(long)CCreditsDlgDlg::TestFunction2,IDB_BITMAP2);
  27.        
  28.         // use our own function for background drawing
  29.         m_wndCredits.m_pBackgroundPaint = CCreditsDlgDlg::DrawCreditsBackground;
  30.         m_wndCredits.m_dwBackgroundPaintLParam = TRUE;

  31.         // as our background is going to be black, use black as default transparent color
  32.         m_wndCredits.m_crInternalTransparentColor = RGB(0,0,0);
  33.        
  34.         // now, we're ready to begin... create the window
  35.         m_wndCredits.Create(WS_EX_CLIENTEDGE,WS_VISIBLE|WS_CHILD,IDC_PLACEHOLDER,this,0,IDC_SMILEY,0);

  36.         // for details on what more can be customized, RTFM.


  37.         // default options
  38.         ((CButton*)GetDlgItem(IDC_BACKGROUND))->SetCheck(TRUE);
  39.         ((CButton*)GetDlgItem(IDC_USERSCROLL))->SetCheck(TRUE);
  40.        
  41.         return TRUE;  // return TRUE  unless you set the focus to a control
  42. }
复制代码
整体使用上还是很方便的。
更多的功能可以下载源代码编译运行查看。
请点击此处下载

请先注册会员后在进行下载

已注册会员,请先登录后下载

文件名称:上位机MFC文本滚动特效源代码.rar 
文件大小:36.88 KB  售价:3金币
下载权限: 不限 以上或 VIP会员   [购买捐助会员]   [充值积分]   有问题联系我


  

上位机VC MFC程序开发精典实例大全源码与视频讲解配套下载408例

  

经历1年的编程与录制点击进入查看


  

halcon从自学到接项目视频教程,另外再赠送全网最全资源  

  

欢迎围观我录制的一套halcon自学视频教程(进入)


  

如果您认可,可联系功能定制!

  

如果您着急,充值会员可直接联系发您资料!

  

QQ联系我

微信扫扫联系我

  


回复

使用道具 举报

快速回复 返回列表 客服中心 搜索