It is currently Wed Jul 18, 2018 5:50 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Transparent Layered Window -Opaque Title Bar?
PostPosted: Fri Apr 13, 2018 10:41 pm 
Offline
Always Here
Always Here

Joined: Fri Oct 23, 2009 2:33 am
Posts: 5774
Location: Wales, UK
Transparent window, the title bar is also transparent:
Code:
#Win = 0
iFlags.i = #PB_Window_Tool|#PB_Window_ScreenCentered|#PB_Window_Invisible|#PB_Window_SystemMenu

If OpenWindow(#Win, 50, 50, 200, 200, "Transparent", iFlags)

                SetWindowColor(#Win, RGB(100,080,200))
             SetWindowLongPtr_(WindowID(#Win), #GWL_EXSTYLE, #WS_EX_LAYERED)
   SetLayeredWindowAttributes_(WindowID(#Win), 0, 100, #LWA_ALPHA)
                    HideWindow(#Win, #False)
                  StickyWindow(#Win, #True)
EndIf

Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow

Is there a way to set the title bar Opaque?

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


Top
 Profile  
Reply with quote  
 Post subject: Re: Transparent Layered Window -Opaque Title Bar?
PostPosted: Mon Apr 16, 2018 3:06 pm 
Offline
Moderator
Moderator
User avatar

Joined: Thu Dec 31, 2009 11:05 pm
Posts: 580
Location: Berlin and Ibiza
Do you mean like this?
Code:
EnableExplicit

If OpenWindow(0, 0, 0, 500, 400, "Window", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  SetWindowColor(0, RGB(255, 0, 0))
  SetWindowLongPtr_(WindowID(0), #GWL_EXSTYLE, GetWindowLongPtr_(WindowID(0), #GWL_EXSTYLE) | #WS_EX_LAYERED)
  SetLayeredWindowAttributes_(WindowID(0), RGB(255, 0, 0), 0, #LWA_COLORKEY)
 
  Repeat
    Select WaitWindowEvent()
      Case #PB_Event_CloseWindow
        End
    EndSelect
  ForEver
EndIf

_________________
ImageImageImageImage


Top
 Profile  
Reply with quote  
 Post subject: Re: Transparent Layered Window -Opaque Title Bar?
PostPosted: Tue Apr 17, 2018 6:58 am 
Offline
Addict
Addict

Joined: Sun Apr 12, 2009 6:27 am
Posts: 3034
Maybe
Code:
#Win = 0
#Win1 = 1

Procedure WindowProc(hWnd,uMsg,wParam,lParam)
  Result = #PB_ProcessPureBasicEvents
  Select uMsg
    Case  #WM_SIZE,#WM_MOVE
        ResizeWindow(#Win1,WindowX(#Win,#PB_Window_InnerCoordinate), WindowY(#Win,#PB_Window_InnerCoordinate),WindowWidth(#Win),WindowHeight(#Win))
           
    Case #WM_NCACTIVATE
            Result = 1

  EndSelect
  ProcedureReturn Result
EndProcedure

iFlags.i = #PB_Window_Tool|#PB_Window_ScreenCentered|#PB_Window_SystemMenu|#PB_Window_SizeGadget

If OpenWindow(#Win, 50, 50, 200, 200, "Transparent", iFlags)

                SetWindowColor(#Win, RGB(100,080,200))
             SetWindowLongPtr_(WindowID(#Win), #GWL_EXSTYLE, #WS_EX_LAYERED)
   SetLayeredWindowAttributes_(WindowID(#Win), RGB(100,080,200), 0, #LWA_COLORKEY)
                  StickyWindow(#Win, #True)
  OpenWindow(#Win1, WindowX(#Win,#PB_Window_InnerCoordinate), WindowY(#Win,#PB_Window_InnerCoordinate), 200, 200, "", #PB_Window_BorderLess,WindowID(#Win))
                  SetWindowColor(#Win1, RGB(100,080,200))
             SetWindowLongPtr_(WindowID(#Win1), #GWL_EXSTYLE, #WS_EX_LAYERED)
   SetLayeredWindowAttributes_(WindowID(#Win1), 0, 100, #LWA_ALPHA)
EndIf

SetActiveWindow(#Win)
SetWindowCallback(@WindowProc())

Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow

_________________
Egypt my love


Top
 Profile  
Reply with quote  
 Post subject: Re: Transparent Layered Window -Opaque Title Bar?
PostPosted: Wed Apr 18, 2018 11:58 pm 
Offline
Always Here
Always Here

Joined: Fri Oct 23, 2009 2:33 am
Posts: 5774
Location: Wales, UK
Hi RSBasic

Not really, because with COLORKEY it's all or nothing, you can't control the % of transparency or colour as you can with LWA_ALPHA.

Take a look at Rashad's solution - one to add to your WinAPI Library?

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


Last edited by IdeasVacuum on Thu Apr 19, 2018 12:03 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Transparent Layered Window -Opaque Title Bar?
PostPosted: Thu Apr 19, 2018 12:02 am 
Offline
Always Here
Always Here

Joined: Fri Oct 23, 2009 2:33 am
Posts: 5774
Location: Wales, UK
Hi Rashad

That is a seriously clever idea, works perfectly!

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


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

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 3 guests


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