Programming °æ (¾«»ªÇø)

·¢ÐÅÈË: Mice (ÃÎ), ÐÅÇø: Programming
±ê  Ìâ: ÏûÏ¢ WM_SETREDRAW   µÄÓ¦ÓÃ
·¢ÐÅÕ¾: ×϶¡Ïã (Mon Sep 22 11:47:27 1997)

                ¼ò½é£:

   ±¾ÎÄ´ÓAsk Dr.GUI.#1ժ¼£¬½éÉÜÁ˵±¶ÔÁбí¿òͬʱ½øÐÐ
½Ï¶àµÄ²åÈë»òɾ³ýʱ£¬ÈçºÎ±ÜÃâÒòÁбí¿òµÄ¹ý¶àÖØ»­¶øÉÁ˸¡£
ÆäÖÐÉæ¼°µ½ÏûÏ¢ WM_SETREDRAW £»²¢ÇÒ£¬¸ÃÏûÏ¢¶ÔËùÒÔµÄ
Windows±ê×¼Control¾ùÆð×÷Óá

               ÕýÎÄ£º
   Using WM_SETREDRAW to Prevent List Box Flashing

Dear Dr. GUI:
   Do you know a method I can use to modify a list box
string without having to use LB_DELETESTRING and then
LB_INSERTSTRING? Deleting and insertin  g causes an
unpleasant repaint of the entire list box, not to mention
the "jump" that takes place between the delete and the
insert messages.

Dr. GUI replies:

   Although Microsoft Windows has no atomic call that
deletes and inserts a string in a list box, you can
prevent the list box from jumping around when you modify
its contents. Take a look at the WM_SETREDRAW message.
Sending this message to the list box with a FALSE value
in wParam prevents the control from updating when you
make changes. Passing a TRUE value reenables these
updates. After you reenable updates, you have to force
the control to redraw. In other words, follow these
steps:

SendMessage(hWndListbox, WM_SETREDRAW, FALSE, 0) ;

/* Modify the control content here. */
SendMessage(hWndListbox, WM_SETREDRAW, TRUE, 0) ;

InvalidateRect(hWndListbox, NULL, FALSE) ;

UpdateWindow(hWndListbox) ;

   By the way, WM_SETREDRAW works on all standard controls,
not only on list boxes.
--

          />>>
         (*>
()%\%\%\%|*|33333333333333333333333333333333333>
         (*>
          \>>>

¡ù À´Ô´:£®×϶¡Ïã pclinux.hit.edu.cn£®[FROM: 202.118.226.75]
[°Ù±¦Ïä] [·µ»ØÊ×Ò³] [Éϼ¶Ä¿Â¼] [¸ùĿ¼] [·µ»Ø¶¥²¿] [Ë¢ÐÂ] [·µ»Ø]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
Ò³ÃæÖ´ÐÐʱ¼ä£º3.258ºÁÃë