VC中如何获取窗口当前的背景颜色,具体用到什么函数

VC中如何获取窗口当前的背景颜色,具体用到什么函数,第1张

GetClassLong(hwnd,GCL_HBRBACKGROUND) 获得背景画刷

GetObject 根据背景画刷获取逻辑画刷

typedef struct tagLOGBRUSH {

UINT lbStyle;

COLORREF lbColor; //这里就是背景颜色

LONG lbHatch;

} LOGBRUSH,

或者用GetClassInfo 根据类名获取其WNDCLASS结构

typedef struct _WNDCLASS {

UINT style;

WNDPROC lpfnWndProc;

int cbClsExtra;

int cbWndExtra;

HINSTANCE hInstance;

HICON hIcon;

HCURSOR hCursor;

HBRUSH hbrBackground; //背景画刷

LPCTSTR lpszMenuName;

LPCTSTR lpszClassName;

} WNDCLASS, PWNDCLASS;

BITMAP bmp;

int bmp_width;

int bmp_height;

if(GetObject(hBmp,sizeof(BITMAP),(LPSTR)&bmp))

{

bmp_width=bmpbmWidth;

bmp_height=bmpbmHeight;

}

private

sub

command1_mousemove(button

as

integer,

shift

as

integer,

x

as

single,

y

as

single)

command1mousepointer

=

vbcross

end

sub

private

sub

command1_mouseup(button

as

integer,

shift

as

integer,

x

as

single,

y

as

single)

if

button

=

vbrightbutton

then

msgbox

"现在鼠标光标位于命令按钮中"

end

if

end

sub

private

sub

form_load()

'picture1mouseicon

=

loadpicture("c:\handcur")'光标文件的路径

end

sub

private

sub

form_mousemove(button

as

integer,

shift

as

integer,

x

as

single,

y

as

single)

memousepointer

=

vbdefault

end

sub

private

sub

form_mouseup(button

as

integer,

shift

as

integer,

x

as

single,

y

as

single)

if

button

=

vbrightbutton

then

msgbox

"现在鼠标光标位于窗体上"

end

if

end

sub

private

sub

picture1_mousemove(button

as

integer,

shift

as

integer,

x

as

single,

y

as

single)

picture1mousepointer

=

vbcustom

end

sub

private

sub

picture1_mouseup(button

as

integer,

shift

as

integer,

x

as

single,

y

as

single)

if

button

=

vbrightbutton

then

msgbox

"现在鼠标光标位于框中"

end

if

end

sub

private

sub

text1_mousemove(button

as

integer,

shift

as

integer,

x

as

single,

y

as

single)

text1mousepointer

=

vbhourglass

end

sub

private

sub

text1_mouseup(button

as

integer,

shift

as

integer,

x

as

single,

y

as

single)

if

button

=

vbrightbutton

then

msgbox

"现在鼠标光标位于文本框中"

end

if

end

sub

以上就是关于VC中如何获取窗口当前的背景颜色,具体用到什么函数全部的内容,包括:VC中如何获取窗口当前的背景颜色,具体用到什么函数、C++ 获取图片宽高、VB编程如何获取鼠标双击事件等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/9541750.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-29
下一篇 2023-04-29

发表评论

登录后才能评论

评论列表(0条)

保存