如何在编辑控件中添加箭头以使用鼠标水平滚动? [英] How to add arrows to an edit control to scroll horizontally using mouse?

查看:80
本文介绍了如何在编辑控件中添加箭头以使用鼠标水平滚动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好
我想创建Windows API应用程序并在其上放置单行编辑控件.
编辑控件的侧面应有两个箭头,以使用鼠标水平滚动.我在Windows编辑控件中找不到任何编辑样式来执行此操作.除了创建自定义控件外,还有其他方法吗?
感谢advanse
阿布扎德

我的代码来创建编辑控件,如下所示:

Hello everyone
I want create windows API application and put singleline edit controls on it.
The edit controls should have two arrows at sides to scroll horizontally using mouse. I could not find any edit styles to do this in windows edit controls. Is there any other way to do this, other than creating customized controls?
Thanks in advanse
abzadeh

my code to create edit control as this:

int iStyleEx = WS_EX_CLIENTEDGE;
int iStyle = WS_BORDER | WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL;
static wchar_t wszBuffer[400];
HWND hWndEdit = CreateWindowExW( iStyleEx, L"EDIT", wszBuffer, iSstyle,
		cpx, cpy, cpWidth, cpHeight, hwndDlg, NULL, hInst, NULL );

由于没有简单的方法可以向编辑控件的两侧添加箭头以水平滚动,所以我认为解决此问题的最佳方法是在编辑控件的左侧和右侧创建两个按钮控件,并处理它们的WM_LBUTTONDOWN和WM_LBUTTONUP事件.
按钮控件应绘制箭头.

As there is no simple way to add arrows to both sides of edit control to scroll horizontally, I think the best way to solve this problem is to create two button controls to left and right of edit control, and handle their WM_LBUTTONDOWN and WM_LBUTTONUP events.
The button controls should paint arrows.

推荐答案

也许此功能可以提供帮助

ScrollWindowEx函数

int ScrollWindowEx(
_In_ HWND hWnd,
_In_ int dx,
_In_ int dy,
_In_ const RECT * prcScroll,
_In_ const RECT * prcClip,
_In_ HRGN hrgnUpdate,
_Out_ LPRECT prcUpdate,
_In_ UINT标志
);
Maybe this function could help

ScrollWindowEx function

int ScrollWindowEx(
_In_ HWND hWnd,
_In_ int dx,
_In_ int dy,
_In_ const RECT *prcScroll,
_In_ const RECT *prcClip,
_In_ HRGN hrgnUpdate,
_Out_ LPRECT prcUpdate,
_In_ UINT flags
);


这篇关于如何在编辑控件中添加箭头以使用鼠标水平滚动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆