本文介绍了编辑框控件问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我有一个关于编辑"控制框的问题.是否可以在子窗口中获得这种控件,就像出现在对话框中一样? (在对话框中,编辑框具有3d边框,但是在子窗口中,它没有任何视觉效果.我希望子窗口中也使用相同的编辑框,而不使用MFC,而仅使用Win32本机代码.)

在此先感谢您.

Hi All,
I have a question regarding Edit control box. It is possible to obtain such control in a child window like it appear in a dialog box? (In a dialog box the edit box has 3d border but in a child window it does not have any visual effect. I want the same edit box also in a child window without using MFC but only Win32 native code).

Thanks in advance.

推荐答案

//get the style
LONG_PTR style = GetWindowLongPtr(hWndEditbox, GWL_STYLE);
//use |= to add a style
style |= WS_BORDER;
//use &= ~(...) to remove a style
style &= ~(WS_BORDER);
//set the new style
SetWindowLongPtr(hWndEditBox, GWL_STYLE, style);


样式 [ ^ ]


Styles[^]

//get the extended style
LONG_PTR exStyle = GetWindowLongPtr(hWndEditbox, GWL_EXSTYLE);
//use |= to add a style
style |= WS_EX_CLIENTEDGE;
//use &= ~(...) to remove a style
style &= ~(WS_EX_CLIENTEDGE);
//set the new style
SetWindowLongPtr(hWndEditBox, GWL_EXSTYLE, exStyle);


扩展样式 [ ^ ]

尝试删除不同的样式以查看您不想要的样式.


Extended styles[^]

Try to remove different styles to see which one you don''t want.


HWND hed;

hed = CreateWindowEx
(
	0,
	__TEXT("EDIT"),
	__TEXT(""),
	WS_CHILD|WS_CLIPSIBLINGS|ES_AUTOHSCROLL,
	rcPos.left,
	rcPos.top,
	rcPos.right-rcPos.left,
	rcPos.bottom-rcPos.top,
	hWndParent,
	(HMENU)0,
	(HINSTANCE)0,
	0
);


将帮助手册用于编辑控件样式(ES _...).
祝你好运.


Use the help manual for the edit control styles (ES_...).
Good luck.



这篇关于编辑框控件问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-26 22:11
查看更多