乐之网站制作电影打卡WordPress模板

news/2025/10/4 8:10:26/文章来源:
乐之网站制作,电影打卡WordPress模板,课程网站开发开题报告,常州网站制作报价MFC 中#xff0c; ListBox 与 ComboBox 中的项在设置了高度的情况下如何实现文本的水平居中与垂直居中#xff1f;#xff1f;#xff1f;ListBox 与 ComboBox 中的数据均为动态添加文本内容含有数字、英文、中文void CMyComboBox::DrawItem(LPDRAWITEMSTRUCT lpDrawItemS…MFC 中 ListBox 与 ComboBox 中的项在设置了高度的情况下如何实现文本的水平居中与垂直居中ListBox 与 ComboBox 中的数据均为动态添加文本内容含有数字、英文、中文void CMyComboBox::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct){ASSERT(lpDrawItemStruct-CtlType  ODT_COMBOBOX);LPCTSTR lpszText  (LPCTSTR) lpDrawItemStruct-itemData;ASSERT(lpszText ! NULL);CDC dc;dc.Attach(lpDrawItemStruct-hDC);// Save these value to restore them when done drawing.COLORREF crOldTextColor  dc.GetTextColor();COLORREF crOldBkColor  dc.GetBkColor();// If this item is selected, set the background color// and the text color to appropriate values. Erase// the rect by filling it with the background color.if ((lpDrawItemStruct-itemAction  ODA_SELECT) (lpDrawItemStruct-itemState   ODS_SELECTED)){dc.SetTextColor(::GetSysColor(COLOR_HIGHLIGHTTEXT));dc.SetBkColor(::GetSysColor(COLOR_HIGHLIGHT));dc.FillSolidRect(lpDrawItemStruct-rcItem, ::GetSysColor(COLOR_HIGHLIGHT));}else{dc.FillSolidRect(lpDrawItemStruct-rcItem, crOldBkColor);}// Draw the text.dc.DrawText(lpszText,(int)_tcslen(lpszText),lpDrawItemStruct-rcItem,DT_CENTER|DT_SINGLELINE|DT_VCENTER);// Reset the background color and the text color back to their// original values.dc.SetTextColor(crOldTextColor);dc.SetBkColor(crOldBkColor);dc.Detach();}只能自绘。。。具体应用的时候我们往往不能满足于MFC提供的标准功能这种情况下我们一般会对控件进行重载定制对于ComboBox自然也不例外。不过ComboBox略显复杂它本身还包括子控件要想完全重载就要对这些子控件同样进行定制。有经验的朋友一定知道这个时候我们需要对这些子控件进行子类化用我们自己的类去代替。微软同样为我们想到了这一点在上文提到的链接中介绍说如果要重载ComboBox可以通过一篇文章《How to subclass CListBox and CEdit inside of CComboBox》介绍的方法来实现。这篇文章用的方法是通过OnCtlColor来实现对子控件的子类化的应该说这个方法很巧妙但并不优雅而且文章中也提到这个方法必须在ComboBox至少绘制一次的基础上才能起作用对于一些要求在这之前就要实现替换的需求并不适用文章相关原文如下Note that for subclassing to occur, the dialog box must be painted at least once. There are cases when the dialog box doesnt paint at all (for example, closing the dialog box before it is displayed, hidden dialog boxes). This method may not be suitable when access to the subclassed windows are needed in these cases.那么有什么更好的方法实现ComboBox对其子控件的子类化么本文就是要解决这个问题。要实现子类化其实只要解决一个问题那就是过去要子类化的控件的句柄。我们知道ComboBox的信息都封装到了COMBOBOXINFO这个结构中通过ComboBox的成员函数GetComboBoxInfo即可获取这些信息。看一下这个结构的定义[cpp] view plaincopy/** Combobox information*/typedef struct tagCOMBOBOXINFO{DWORD cbSize;RECT rcItem;RECT rcButton;DWORD stateButton;HWND hwndCombo;HWND hwndItem;HWND hwndList;} COMBOBOXINFO, *PCOMBOBOXINFO, *LPCOMBOBOXINFO;我们发现hwndItem和hwndList应该就是我们想要的。然后我们要为子类化选择一个合适的时间对于控件来说在PreSubclassWindow函数中处理再合适不过了。这样我们就很好的解决了子类化的途径和时机的问题动手试一下吧我重载重载了CComboBox做了测试为了验证子类化是否成功我没有对ComboBox进行初始化而是通过子类化的新控件完成的核心代码如下[cpp] view plaincopyvoid CExComboBox::PreSubclassWindow(){CComboBox::PreSubclassWindow();COMBOBOXINFO    comboInfo;//获取控件信息comboInfo.cbSize sizeof(COMBOBOXINFO);GetComboBoxInfo(comboInfo);//子类化编辑框if(comboInfo.hwndItem ! NULL){m_editReplace.SubclassWindow(comboInfo.hwndItem);m_editReplace.SetWindowText(_T(编辑框已被子类化));}//子类化列表框if(comboInfo.hwndList ! NULL){m_listboxReplace.SubclassWindow(comboInfo.hwndList);m_listboxReplace.AddString(_T(列表框已被子类化));}}运行程序成功实现目的。我整理了一个小例子有兴趣的朋友可以下载研究一下不过大家也能看得出来功能和实现都比较简单所以其实这个实例的价值也不是很大。个人认为这个方案相对来说比较合理对于动态创建的控件可通过OnCreate函数来完成子类化。找到了合理的子类化途径我们也就可以更好的对ComboBox做自绘和扩展以实现更加丰富的功能。Following is a owner drawn Combo Box which will be filled with the names of the fonts.. And each entry is in same font as selected. This is something similar to the one in Netscape 4.x font selector.This is pretty simple. All it does is to enumerate the fonts and store the LOGFONTs in the Item data. and when the painting is to be done, takes the value from the Item data and paints the item..It has a very nice effect.. Since this does only the font names, you might need another combobox for the sizes..Post-Migration Risks of Office 365 Download NowYou can also set the colors for the highlight and normal..To use this, Create a ComboBox in your Resource Editor, Set the Owner draw to Variable and check the Has strings.Then, In the OnInitDialog () or OnInitialUpdate() call the function FillFonts (). Thats it.. You have got your fonts in the Combo box. To get the selected font, Use GetSelFont () with LOGFONT as the argument. this argument will be filled in upon return.P.S:If you make the ComboBox to be a Drop down List then the edit window (actually the static control window) will hav the name in the same font as selected.. Otherwise, it will be in the dialog boxs font..//*************************************************************************//CCustComboBox.h#if !defined(AFX_CUSTCOMBOBOX_H__F8528B4F_396E_11D1_9384_00A0248F6145__INCLUDED_)#define AFX_CUSTCOMBOBOX_H__F8528B4F_396E_11D1_9384_00A0248F6145__INCLUDED_#if _MSC_VER 1000#pragma once#endif // _MSC_VER 1000// CustComboBox.h : header file///////// CCustComboBox windowtypedef enum {FONTS} STYLE;      //Why have I enumerated, Cos, Maybe I might want something other than Fonts hereclass CCustComboBox : public CComboBox{// Constructionpublic:CCustComboBox();CCustComboBox (STYLE);// Attributespublic:void SetHilightColors (COLORREF hilight,COLORREF hilightText){m_clrHilight hilight;m_clrHilightText hilightText;};void SetNormalColors (COLORREF clrBkgnd,COLORREF clrText){m_clrNormalText clrText;m_clrBkgnd clrBkgnd;};static BOOL CALLBACK EnumFontProc (LPLOGFONT lplf, LPTEXTMETRIC lptm, DWORD dwType, LPARAM lpData);void FillFonts ();int  GetSelFont (LOGFONT);// Operationspublic:// Overrides// ClassWizard generated virtual function overrides//{{AFX_VIRTUAL(CCustComboBox)public:virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);virtual void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct);protected:virtual void PreSubclassWindow();//}}AFX_VIRTUAL// Implementationpublic:virtual ~CCustComboBox();// Generated message map functionsprotected:STYLE m_enStyle;COLORREF m_clrHilight;COLORREF m_clrNormalText;COLORREF m_clrHilightText;COLORREF m_clrBkgnd;BOOL m_bInitOver;void DrawDefault (LPDRAWITEMSTRUCT);void DrawFont(LPDRAWITEMSTRUCT);void InitFonts ();//{{AFX_MSG(CCustComboBox)afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);afx_msg void OnDestroy();//}}AFX_MSGafx_msg   long OnInitFonts (WPARAM, LPARAM);DECLARE_MESSAGE_MAP()};///////{{AFX_INSERT_LOCATION}}// Microsoft Developer Studio will insert additional declarations immediately before the previous line.#endif //!defined(AFX_CUSTCOMBOBOX_H__F8528B4F_396E_11D1_9384_00A0248F6145__INCLUDED_)//**************************************************************************// CustComboBox.cpp : implementation file//#include stdafx.h#include CustComboBox.h#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE[] __FILE__;#endif#define WM_INITFONTS          (WM_USER 123)//I chose 123 cos nobody might use the same exact number.. I can improve this by use RegisterWindowMessage../////// CCustComboBox//Initial values of the text and highlight stuffCCustComboBox::CCustComboBox(){m_enStyle FONTS;m_clrHilight GetSysColor (COLOR_HIGHLIGHT);m_clrNormalText GetSysColor (COLOR_WINDOWTEXT);m_clrHilightText GetSysColor (COLOR_HIGHLIGHTTEXT);m_clrBkgnd GetSysColor (COLOR_WINDOW);m_bInitOver FALSE;}CCustComboBox::CCustComboBox (STYLE enStyle){m_enStyle enStyle;m_clrHilight GetSysColor (COLOR_HIGHLIGHT);m_clrNormalText GetSysColor (COLOR_WINDOWTEXT);m_clrHilightText GetSysColor (COLOR_HIGHLIGHTTEXT);m_clrBkgnd GetSysColor (COLOR_WINDOW);m_bInitOver FALSE;}CCustComboBox::~CCustComboBox(){}BEGIN_MESSAGE_MAP(CCustComboBox, CComboBox)//{{AFX_MSG_MAP(CCustComboBox)ON_WM_CREATE()ON_WM_DESTROY()//}}AFX_MSG_MAPON_MESSAGE (WM_INITFONTS,OnInitFonts)END_MESSAGE_MAP()/////// CCustComboBox message handlersvoid CCustComboBox::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct){//I might want to add something else somedayswitch (m_enStyle){case FONTS:DrawFont(lpDrawItemStruct);break;}}//I dont need the MeasureItem to do anything. Whatever the system says, it staysvoid CCustComboBox::MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct){}void CCustComboBox::DrawFont(LPDRAWITEMSTRUCT lpDIS){CDC* pDC CDC::FromHandle(lpDIS-hDC);CRect rect;TRACE0 (In Draw Font\n);// draw the colored rectangle portionrect.CopyRect(lpDIS-rcItem);pDC-SetBkMode( TRANSPARENT );if (lpDIS-itemState ODS_SELECTED){pDC-FillSolidRect (rect,m_clrHilight);pDC-SetTextColor (m_clrHilightText);}else{pDC-FillSolidRect (rect,m_clrBkgnd);pDC-SetTextColor (m_clrNormalText);}if ((int)(lpDIS-itemID) 0) // Well its negetive so no need to draw text{}else{CString strText;GetLBText (lpDIS-itemID,strText);CFont newFont;CFont *pOldFont;((LOGFONT*)lpDIS-itemData)-lfHeight 90; //9 point size((LOGFONT*)lpDIS-itemData)-lfWidth 0;newFont.CreatePointFontIndirect ((LOGFONT*)lpDIS-itemData);pOldFont pDC-SelectObject (newFont);pDC-DrawText(strText, rect, DT_LEFT | DT_VCENTER | DT_SINGLELINE);pDC-SelectObject (pOldFont);newFont.DeleteObject ();}}void CCustComboBox::InitFonts (){CDC *pDC GetDC ();ResetContent (); //Delete whatever is thereEnumFonts (pDC-GetSafeHdc(),NULL,(FONTENUMPROC) EnumFontProc,(LPARAM)this);//Enumeratem_bInitOver TRUE;}BOOL CALLBACK CCustComboBox::EnumFontProc (LPLOGFONT lplf, LPTEXTMETRIC lptm, DWORD dwType, LPARAM lpData){if (dwType TRUETYPE_FONTTYPE) //Add only TTF fellows, If you want you can change it to check for others{int index ((CCustComboBox *) lpData)-AddString(lplf-lfFaceName);LPLOGFONT lpLF;lpLF new LOGFONT;CopyMemory ((PVOID) lpLF,(CONST VOID *) lplf,sizeof (LOGFONT));((CCustComboBox *) lpData)-SetItemData (index,(DWORD) lpLF);}return TRUE;}int CCustComboBox::OnCreate(LPCREATESTRUCT lpCreateStruct){if (CComboBox::OnCreate(lpCreateStruct) -1)return -1;// TODO: Add your specialized creation code hereif (m_enStyle FONTS){PostMessage (WM_INITFONTS,0,0);}return 0;}long CCustComboBox::OnInitFonts (WPARAM, LPARAM){InitFonts ();return 0L;}void CCustComboBox::OnDestroy(){if (m_enStyle FONTS){int nCount;nCount GetCount ();for (int i 0; i {delete ((LOGFONT*)GetItemData (i)); //delete the LOGFONTS actually created..}}// TODO: Add your message handler code hereCComboBox::OnDestroy();}void CCustComboBox::FillFonts (){m_enStyle FONTS;PostMessage (WM_INITFONTS,0,0); //Process in one place}int  CCustComboBox::GetSelFont (LOGFONT lf){int index GetCurSel ();if (index LB_ERR)return LB_ERR;LPLOGFONT lpLF (LPLOGFONT) GetItemData (index);CopyMemory ((PVOID)lf, (CONST VOID *) lpLF, sizeof (LOGFONT));return index; //return the index here.. Maybe the user needs it:-)}void CCustComboBox::PreSubclassWindow(){// TODO: Add your specialized code here and/or call the base class//Tried to do what Roger Onslow did for the button.. Did not work..?? Any RD guys around :-)}CommentsgoodPosted by xixihaha on 12/02/2010 05:50amso nice ,hahahReplyHow Can I do Dynamic Creation of a ComboBoxPosted by subbaraovnrt on 12/15/2004 07:59amIn a Dialog box I used one Push Button When I press that button New Combobox Dynamically created but the all font in that ComboBox all are same bold Arial.How my Dialog box behaves as static your implementation.ReplyHow to initalize the Font combobox after FillFonts()Posted by Legacy on 11/14/2001 12:00amOriginally posted by: Chris HambletonTo initalize the Font combobox after FillFonts(), simply change the PostMessage() calls to SendMessage().PostMessage() returns as soon as the message is posted (while the combobox is still empty), but SendMessage() returns only after the message has been handled (after the combobox has been filled).The reason youre currently unable to initialize the Font combobox is because youre calling SetCurSel() / SetString() on a combobox thats currently empty.Hope this helps!!ReplyHow do you intialize the editor box?Posted by Legacy on 11/05/2001 12:00amOriginally posted by: ButchGreat.But how do you initialize the editor box portion of the combo to say a default font selection?Thanks.Reply!!!Posted by Legacy on 07/11/2001 12:00amOriginally posted by: Chethana SastryThis is great. I could finish a weeks work in just 15 mins!Thanks!I have a problem though...If i say SetCurSel(0) it fails and returns -1Have you encountered the same problem? If so, what is the solution?ReplysuperPosted by Legacy on 02/08/2001 12:00amOriginally posted by: pierresuper!!its worksReplyGreat !Posted by Legacy on 05/01/2000 12:00amOriginally posted by: Ergin SalihThis is wonderful, it is easily modified to work off a listof font objects.Exactly what I wanted.Thanks

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/926917.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

实用指南:开源 C# 快速开发(十四)进程--内存映射

pre { white-space: pre !important; word-wrap: normal !important; overflow-x: auto !important; display: block !important; font-family: "Consolas", "Monaco", "Courier New", …

rqlite 集成sqlite-vec 简单说明

rqlite 集成sqlite-vec 简单说明rqlite 是一个基于raft 的实现的分布式sqlite,sqlite-vec 是可以直接集成rqlite的,核心是sqlite 的插件机制,以下是一个简单试用 环境准备 可以使用docker 或者直接下载二进制包运行…

英语_阅读_Water Sliding_待读

One, two, three... Goooooooh! 一、二、三……出发咯! Slide down the slope. 沿着斜坡滑下去。 Hit the pool with a splash. “扑通”一声掉进泳池。 Water-slides might seem simple. 水滑梯看起来可能很简单。 B…

实用指南:ArcGIS JSAPI 高级教程 - 高亮效果优化之开启使用多高亮样式

实用指南:ArcGIS JSAPI 高级教程 - 高亮效果优化之开启使用多高亮样式pre { white-space: pre !important; word-wrap: normal !important; overflow-x: auto !important; display: block !important; font-family: &…

网站入口自己找网站开发项目

远程手机遥控开关的工作原理主要是通过互联网传递无线信号,控制用电器的一种智能家居产品。 远程手机遥控开关的基本套件包括:手机APP、网线、家用WIFI中转无服务器或者是工厂提供的自带网线端口的中转服务器、连接用电器的接收器。使用时,手…

网站后台代码添加图片wordpress怎么弄

如果项目着眼于尽快无BUG上线,那么此时可以抓大放小,代码的细节可以不精打细磨;但是如果有足够的时间开发、维护代码,这时候就必须考虑每个可以优化的细节了,一个一个细小的优化点累积起来,对于代码的运行效…

手机网站菜单栏怎么做东莞网站建设推广技巧

博主是搞是个FPGA的,一直没有真正的研究过以太网相关的技术,现在终于能静下心学习一下,希望自己能更深入的掌握这项最基本的通信接口技术。下面就开始搞了。 一、OSI参考模型 今天我们先学习一下以太网最基本也是重要的知识——OSI参考模型。…

电商网站界面规范新型建筑模板

SA8000认证流程 SA8000认证流程的第一步是申请组织参加管理体系在线自我评估。Social Fingerprint自我评估可以帮助该组织了解 SA8000管理体系要求并判断是否已做好认证申请准备。当该组织认为其管理实践足够成熟,具备认证条件时,可以从20 多家独立的SAA…

用wang域名做购物网站怎么样网站建设预算策划

http://blog.csdn.net/lu_embedded/article/details/60469851 由于 Linux 所具备的开源、稳定、高效、易裁剪、硬件支持广泛等优点,使得它在嵌入式系统领域最近十几年内迅速崛起。目前嵌入式 Linux 系统开发已经开辟了很大的市场,同时也开发出很多成型的…

const在for用不了

js中关于const在for in或者for of中的使用_for in const-CSDN博客

新闻静态网站模板自建视频网站

🌟博主主页:我是一只海绵派大星 📚专栏分类:软件测试笔记 📚参考教程:黑马教程❤️感谢大家点赞👍收藏⭐评论✍️ 目录 1、操作系统 2、Linux发展历程 3、命令行程序 4、cd 切换文件夹…

苏州做网站优化社交电商系统开发

引言 原文链接 近日,一场由微软视窗系统软件更新引发的全球性"微软蓝屏"事件震惊了整个科技界。这次事件源于美国电脑安全技术公司"众击"提供的一个带有"缺陷"的软件更新,如同一颗隐形炸弹在全球范围内引爆,…

网站开发毕业设计摘要范文剪辑师培训班有用吗

IIS-HTTPS(TSL)强制开启的方法和解决过时的安全问题 系统为:Windows server 2008R2 工具为:IIS6 数据库为: Windows Sql server 2014 证书为:腾讯云颁发的AC证书 首先你需要这几个工具 IISCrypto | 检测和为你配置最安全的 策略环境 手写reg注册表 | 来关闭本地的事件 Windo…

有做外贸的平台网站吗永城网站建设

鸿蒙是面向5G物联网、面向全场景的分布式操作系统,其不是安卓系统的分支或修改而来的,与安卓、iOS是不一样的操作系统。鸿蒙将打通手机、电脑、平板、电视、电器设备、工业自动化控制、无人驾驶、车机设备 、智能穿戴统一成一个操作系统,并且…

需要锦州网站建设自己电脑wordpress

数据对齐 数据对齐是一种计算机内存管理技术,确保数据存储在内存中的特定地址上,以提高访问效率和性能。 不同的数据类型(如整数、浮点数、指针等)在内存中的存储位置通常需要满足特定的边界要求,即数据的起始地址是其…

10月北京中学集训随笔

10.4~10.8计划 长达5天的模拟赛 根据刚哥的压力提前释放理论 所以这五天的模拟赛一定要给予最高级别的重视

公司网站域名com好还是cn好视频拍摄剪辑培训班

【说明:转载于http://blog.csdn.net/jojo52013145/article/details/5783677】 1. 我们不禁要问,什么是"服务集群"?什么是"企业级开发"? 既然说了EJB 是为了"服务集群"和"企业级开发"&…

icp备案网站用不了淄博网站建设 招聘

声明! 学习视频来自B站up主 **泷羽sec** 有兴趣的师傅可以关注一下,如涉及侵权马上删除文章,笔记只是方便各位师傅的学习和探讨,文章所提到的网站以及内容,只做学习交流,其他均与本人以及泷羽sec团队无关&a…

专业做俄语网站建设网站建设公司哪好

在此实现了一个基本的IL汇编程序; 了解MSIL汇编和IL汇编评估堆栈_bcbobo21cn的博客-CSDN博客 它用了下面两句来在屏幕输出字符串, ldstr "I am from the IL Assembly Language..." call void [mscorlib]System.Console::WriteLine (string) …

为什么做的网站在浏览器搜不到做暧暧视频免费视频中国网站

在攻击中,命令注入是比较常见的方式,今天我们细说在软件开发中如何避免命令执行漏洞 我们通过DVWA中不同的安全等级来细说命令执行漏洞 1、先调整DVWA的安全等级为Lower,调整等级在DVWA Security页面调整 2、在Command Injection页面输入127.0.0.1&…