资源简介
mfc中Menu控件的美化,可改变任意菜单项的宽高,并使用自己定义的颜色作为背景,可以渐变。能够在每个菜单项左侧添加位图,并改变菜单中右侧箭头形状。本例子使用打过补丁后的VS2008创建,内附控件类的接口说明文档
代码片段和文件信息
// HSGraphics.cpp: implementation of the CHSGraphics class.
//
//////////////////////////////////////////////////////////////////////
#include “stdafx.h“
#include “HSGraphics.h“
#include
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
void WINAPI Draw3DLine(HDC hDC bool bHeave const POINT& ptStart const POINT& ptEnd)
{
HPEN hpen;
HGDIOBJ hpenOld;
hpen = ::CreatePen( PS_SOLID 1 GetSysColor( bHeave ? COLOR_3DHILIGHT : COLOR_3DSHADOW ) );
hpenOld = ::Selectobject( hDC hpen );
::MoveToEx( hDC ptStart.x ptStart.y NULL );
::LineTo( hDC ptEnd.x ptEnd.y );
::Deleteobject( hpen );
hpen = ::CreatePen( PS_SOLID 1 GetSysColor( bHeave ? COLOR_3DSHADOW : COLOR_3DHILIGHT ) );
::Selectobject( hDC hpen );
::MoveToEx( hDC ptStart.x ptStart.y+1 NULL );
::LineTo( hDC ptEnd.x ptEnd.y+1 );
::Deleteobject( hpen );
::Selectobject( hDC hpenOld );
}
void WINAPI DrawRectEdge(HDC hDC const RECT& rect int nWidth COLORREF clrEdge int nstyle)
{
HPEN hpen = ::CreatePen( nstyle nWidth clrEdge );
HGDIOBJ hobjOld = ::Selectobject( hDC hpen );
POINT pt[3];
pt[0].x = pt[1].x = rect.left; // p1 +-----+ p2
pt[0].y = rect.bottom; // |
pt[1].y = pt[2].y = rect.top; // |
pt[2].x = rect.right; // p0 +
::Polyline( hDC pt 3 );
pt[1].x = pt[2].x = rect.right; // + p2
pt[1].y = rect.bottom; // |
pt[2].y = rect.top; // |
// p0 +-----+ p1
::Polyline( hDC pt 3 );
::Selectobject( hDC hobjOld );
::Deleteobject( hpen );
}
void WINAPI Draw3DRectEdge(HDC hDC bool bHeave int nLeft int nTop int nRight int nBottom)
{
HPEN hpen;
HGDIOBJ hpenOld;
POINT pt[3];
pt[0].x = pt[1].x = nLeft; // p1 +-----+ p2
pt[0].y = nBottom; // |
pt[1].y = pt[2].y = nTop; // |
pt[2].x = nRight + 1; // p0 +
hpen = ::CreatePen( PS_SOLID 1 GetSysColor( bHeave ? COLOR_3DHILIGHT : COLOR_3DSHADOW ) );
hpenOld = ::Selectobject( hDC hpen );
::Polyline( hDC pt 3 );
::Deleteobject( hpen );
pt[1].x = pt[2].x = nRight; // + p2
pt[1].y = nBottom; // |
pt[2].y = nTop; // |
// p0 +-----+ p1
hpen = ::CreatePen( PS_SOLID 1 GetSysColor( bHeave ? COLOR_3DSHADOW : COLOR_3DHILIGHT ) );
::Selectobject( hDC hpen );
::Polyline( hDC pt 3 );
::Deleteobject( hpen );
::Selectobject( hDC hpenOld );
}
void WINAPI Draw3DRgnEdge(HDC hDC bool bHeave HRGN rgnWnd)
{
HBRUSH hbr;
HRGN rgnTemp = ::CreateRectRgn( 0 0 0 0 );
::CombineRgn( rgnTemp rgnWnd 0 RGN_COPY );
::OffsetRgn ( rgnTemp 1 1 );
::CombineRgn( rgnTemp rgnWnd rgnTemp RGN_DIFF );
hbr = ::CreateSolidBrush( GetSysColor( bHeave ? COLOR_3DHILIGHT : COLOR_3DSHADOW ) );
::FillRgn( hDC rgnTemp hbr );
::Deleteobject( hbr );
::Combi
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
I.A.... 20897 2012-02-23 18:07 MenuControl\CHSMenu(Pro)使用说明.txt
I.A.... 24606 2012-02-07 16:06 MenuControl\MyMenu\HSGraphics.cpp
I.A.... 3511 2012-02-07 16:06 MenuControl\MyMenu\HSGraphics.h
I.A.... 31133 2012-02-07 16:02 MenuControl\MyMenu\HSMenu.cpp
I.A.... 8920 2012-02-07 16:03 MenuControl\MyMenu\HSMenu.h
I.A.... 10242 2012-02-07 15:56 MenuControl\MyMenu\HSMenuPro.cpp
I.A.... 3596 2012-02-07 16:05 MenuControl\MyMenu\HSMenuPro.h
I.A.... 2685 2012-02-07 14:58 MenuControl\MyMenu\HSMenuX.cpp
I.A.... 674 2003-03-10 22:06 MenuControl\MyMenu\HSMenuX.h
I.A.... 154628 2012-02-07 17:03 MenuControl\MyMenu\MyMenu.aps
I.A.... 2090 2012-02-07 13:36 MenuControl\MyMenu\MyMenu.cpp
I.A.... 508 2012-02-07 13:36 MenuControl\MyMenu\MyMenu.h
I.A.... 6540 2012-02-07 17:03 MenuControl\MyMenu\MyMenu.rc
I.A.... 8054 2012-02-07 15:00 MenuControl\MyMenu\MyMenu.vcproj
I.A.... 1421 2012-05-10 11:51 MenuControl\MyMenu\MyMenu.vcproj.INGRASYS.marsquan.user
I.A.... 7321 2012-02-07 17:07 MenuControl\MyMenu\MyMenuDlg.cpp
I.A.... 852 2012-02-08 11:34 MenuControl\MyMenu\MyMenuDlg.h
I.A.... 4224 2012-02-07 13:36 MenuControl\MyMenu\ReadMe.txt
I.A.... 894 2012-02-07 14:43 MenuControl\MyMenu\res\icon001.ico
I.A.... 894 2012-02-07 14:43 MenuControl\MyMenu\res\icon002.ico
I.A.... 4150 2012-02-07 14:43 MenuControl\MyMenu\res\icon008.ico
I.A.... 4150 2002-07-27 18:42 MenuControl\MyMenu\res\icon014.ico
I.A.... 894 2012-02-07 14:43 MenuControl\MyMenu\res\icon015.ico
I.A.... 3262 2002-09-02 11:37 MenuControl\MyMenu\res\icon106.ico
I.A.... 3262 2012-02-07 14:43 MenuControl\MyMenu\res\icon107.ico
I.A.... 3262 2002-09-02 11:37 MenuControl\MyMenu\res\icon109.ico
I.A.... 3262 2002-06-07 15:09 MenuControl\MyMenu\res\icon115.ico
I.A.... 3262 2002-06-07 16:10 MenuControl\MyMenu\res\icon130.ico
I.A.... 3262 2002-05-30 22:08 MenuControl\MyMenu\res\icon15.ico
I.A.... 3262 2002-07-20 20:24 MenuControl\MyMenu\res\icon18.ico
............此处省略34个文件信息
相关资源
- 可添加至MFC的256色bmp图
- MFC实现局域网内点对点的大文件传输
- 扫雷小游戏,c++版本
- DLT645-97/07报文解释器VC源码
- MFC制作可编辑闹钟
- 基于MFCC和SVM的说话人性别识别
- mfc实现画图板源码+实验报告
- 行李寄存管理软件绿色版.
- 优秀开源项目基于VC++和MFC基于VC++和
- MFC编程案例之文件管理器C++
- c++/mfc编写的网络电话,网络语音 程序
- LanScannerMFC程序扫描局域网内主机Mac地
- MFC实现点对点通信
- UDP实现广播通信 MFC
- Dialog下创建 MFC OpenGL子窗口
- MFC实现计算器 vC++
- VC++点阵字生成器(MFC)
- 利用MFC实现简单的住房系统
- Socket异步通信 MFC
- msado.dll用于ado
- 高斯混合模型直观实现
- 基于TCP的聊天室c++、MFC
- MFC图像处理荧光检测算法代码
- vc++简易图形编辑器MFC
- 第三方串口类
- MFCJunior U盘SD卡寿命测试工具
- 控制台嵌入MFC
- Visual C++ MFC Web 浏览器
- 文件传输,用MFC实现
- MFC漂亮的进度条
评论
共有 条评论