简体   繁体   English

WinApi32 C滚动条控件(滑块)

[英]WinApi32 C Scroll Bar Control (Slider)

I would like to ask how I can create a scroll bar (slider) in WinApi32 C so I can 我想问一下如何在WinApi32 C中创建滚动条(滑块),以便
send serial port data depending on the position of the thumb in the scroll bar. 根据滚动条中拇指的位置发送串行端口数据。

You can create a window with a scroll bar by adding the WS_HSCROLL and/or WS_VSCROLL styles to your CreateWindow() call. 通过将WS_HSCROLL和/或WS_VSCROLL样式添加到CreateWindow()调用中,可以创建带有滚动条的窗口。

hWnd = CreateWindow("YourWnd","Name", 
  WS_OVERLAPPEDWINDOW | WS_HSCROLL | WS_VSCROLL,
  CW_USEDEFAULT, CW_USEDEFAULT, 500, 250,
  NULL,NULL,            
  hInstance,NULL
);

You can then check the location by calling the GetScrollPos() or GetScrollInfo() function. 然后,您可以通过调用GetScrollPos()GetScrollInfo()函数来检查位置。

See MSDN documentation here for more info. 有关更多信息,请参见此处的 MSDN文档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM