It is currently Tue Sep 24, 2019 10:46 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Color bug when use Win32Api
PostPosted: Fri Apr 12, 2019 2:17 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Jan 22, 2009 3:48 am
Posts: 596
Location: china
Color bug when use Win32Api
1 use #LWA_COLORKEY, bug when moust into Or out a form,Color destroy
2 use #GWLP_HWNDPARENT Or SetParent_(),setColor invalidation
Code:
OpenWindow(1,0,0,200,200,"",#PB_Window_SystemMenu)
g1=ButtonGadget(1, 0, 0,200, 20,""):bc=GetPixel_(GetDC_(g1),33,10)
;TODO test code 1 {
SetWindowLongPtr_(g1, #GWL_EXSTYLE,GetWindowLongPtr_(g1, #GWL_EXSTYLE) | #WS_EX_LAYERED)
SetLayeredWindowAttributes_(g1, bc,0, #LWA_COLORKEY)
;}
g2=TextGadget(2, 2, 2,196, 16,"text",#PB_Text_Center)
SetGadgetColor(2,#PB_Gadget_FrontColor,#Red)
SetGadgetColor(2,#PB_Gadget_BackColor,#Green)
;TODO test code 2 {
;SetWindowLongPtr_(g2,#GWLP_HWNDPARENT,g1)
;}
;TODO test code 3 {
;SetParent_(g2, g1)
;}
TextGadget(3, 0, 60,200, 20,"move")
ButtonGadget(4, 0, 25,200, 20,"try")
Repeat:ev=WaitWindowEvent():Select ev
  Case #PB_Event_Gadget:eg=EventGadget()
   Select eg
    Case 4
;TODO test code 1 {
     ResizeGadget(3,0, 0,200, 20)
     Delay(2222):ResizeGadget(3,0, 60,200, 20)
     Delay(2222):SetCursorPos_(100,35)
     While WindowEvent():Wend
;}
   EndSelect
   
  Case #PB_Event_CloseWindow:Break
EndSelect:ForEver
End
; IDE Options = PureBasic 5.70 LTS (Windows - x86)
; CursorPosition = 3
; EnableXP
; DPIAware

_________________
my pb for chinese:
http://ataorj.ys168.com


Top
 Profile  
Reply with quote  
 Post subject: Re: Color bug when use Win32Api
PostPosted: Fri Apr 12, 2019 5:22 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sat May 05, 2007 5:31 pm
Posts: 609
Location: Linz, Austria
https://docs.microsoft.com/en-us/windows/desktop/winmsg/window-features#layered-windows
Quote:
Beginning with Windows 8, WS_EX_LAYERED can be used with child windows and top-level windows. Previous Windows versions support WS_EX_LAYERED only for top-level windows.


Top
 Profile  
Reply with quote  
 Post subject: Re: Color bug when use Win32Api
PostPosted: Fri Apr 12, 2019 8:59 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Jan 22, 2009 3:48 am
Posts: 596
Location: china
Thanks to Chi, answer the first question!

_________________
my pb for chinese:
http://ataorj.ys168.com


Top
 Profile  
Reply with quote  
 Post subject: Re: Color bug when use Win32Api
PostPosted: Mon Apr 15, 2019 1:05 pm 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 13614
Location: France
API only use, not a PB bug


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye