Search  
Thursday, May 24, 2012 ..:: Forum ::.. Register  Login
 Forum Minimize
Pentru a putea posta mesaje trebuie să vă înregistraţi.
Notă: Mesajele cu conţinut jignitor sau ilegal (inclusiv cereri de soft piratat) nu sunt acceptate şi vor fi şterse imediat .

Pentru a primi raspunsuri rapide si corecte, scrieti in mesaj ce intentionati sa faceti, ce mesaj de eroare primiti, in ce context si in urma caror actiuni. De asemenea, mentionati versiunea de FoxPro in care lucrati!
Dacă nu specificați versiunea, se consideră VFP 9.0 SP2.

SearchForum Home
  Visual FoxPro  Win32 API  Text opac/backg...
 Text opac/background transparent
 
 6/17/2011 12:56:59 PM
User is offlinetempuser
2 posts


Text opac/background transparent
 (Romania)
Salut,

Am facut un "news ticker" (banda de stiri din partea de jos a ecranului) in vfp 8, si as vrea sa stiu daca exista vreo posibilitate ca forma sa fie transparenta sau semitransparenta iar textul ce se plimba pe ea opac (sa se vada bine). Stiu ca exista posibilitatea de a crea o forma transparenta, dar si textul de pe ea va fi transparent, deci mai greu de citit.

Multumesc.
 6/17/2011 1:03:47 PM
User is offlineGrigore Dolghin
3590 posts
www.class-software.eu
1st






Re: Text opac/background transparent
 (N/A) Modified By Grigore Dolghin  on 6/17/2011 1:04:16 PM)
Din pacate nu. Transparenta se creaza cu SetLayeredWindowAttributes, al carei prim parametru este handle-ul obiectului caruia i se aplica atributele respective. In VFP controalele nu au handle, deci...

Grigore Dolghin
Visual FoxPro MVP 2006 - 2010
Class Software
My blog
 6/22/2011 1:50:35 PM
User is offlineovidiu cucu
57 posts




Re: Text opac/background transparent
 (N/A)

In Windows exista posibilitatea de a seta transparenta unei ferestre cu stilul WS_EX_LAYERED printr-un apel al functiei SetLayeredWindowAttributes.
Problema e ca, acea fereastra trebuie sa fie una top-level si nu una child (vezi Ce este o fereastra "top-level"?: http://www.codexpert.ro/forum/viewtopic.php?f=31&t=1300 ).


Ovidiu Cucu
Microsoft MVP
Cofondator CODEXPERT.RO
 6/22/2011 1:54:48 PM
User is offlineGrigore Dolghin
3590 posts
www.class-software.eu
1st






Re: Text opac/background transparent
 (N/A)
Corect; problema e ca el vrea fereastra transparenta si textul opac. In VFP nu se poate fiindca textul nu are handle; fereastra aia o sa se faca transparenta cu tot cu controalele de pe ea.

Grigore Dolghin
Visual FoxPro MVP 2006 - 2010
Class Software
My blog
 6/22/2011 2:08:38 PM
User is offlineovidiu cucu
57 posts




Re: Text opac/background transparent
 (N/A) Modified By ovidiu cucu  on 6/22/2011 2:09:53 PM)

Asta mai lipseste in Windows: un handle de tip HTEXT

Well in Windows, de obicei atunci cand se scrie un text, se foloseste un device context (DC) iar daca vrei sa scii ceva fara sa afecteze background-ul, in WinAPI  spui  SetBkMode(hDC, TRANSPARENT).


Ovidiu Cucu
Microsoft MVP
Cofondator CODEXPERT.RO
 6/22/2011 5:27:02 PM
User is offlineGrigore Dolghin
3590 posts
www.class-software.eu
1st






Re: Text opac/background transparent
 (N/A)
Se pare ca nu ne intelegem. In VFP formul este un _bitmap_. Exact, un .bmp. N-ai ce sa-i faci. Nu poti sa obtii un device context la o bucata dintr-un bitmap.

Grigore Dolghin
Visual FoxPro MVP 2006 - 2010
Class Software
My blog
 6/23/2011 2:11:33 PM
User is offlinetempuser
2 posts


Re: Text opac/background transparent
 (Romania)
Mersi mult de raspunsuri. Se pare ca aceasta o limitare a VFP. O sa folosesc metoda clasica de transparenta care functioneaza.
 6/23/2011 3:54:47 PM
User is offlineDaniel Buduru
2333 posts
1st




Re: Text opac/background transparent
 (N/A)
Vezi articolul acesta:
http://weblogs.foxite.com/bernardbout/archive/2008/11/07/7249.aspx

Daniel Buduru
 6/24/2011 9:04:18 PM
User is offlinevicos
139 posts
5th


Re: Text opac/background transparent
 (N/A)
Uite aici un exemplu de pe Foxite:


Publi yform
yform=NewObject("ytransp")
yform.Show
Read Events
Return

Define Class ytransp As Form
Height = 370
Width = 666
ShowWindow = 2 &&or desktop=.t. for showWindow=0,1
ShowTips = .T.
AutoCenter = .T.
BorderStyle = 0
Caption = ""
BackColor = Rgb(255,0,255)
Name = "Form1"

Add Object list1 As ListBox With ;
Height = 181, ;
Left = 12, ;
Top = 12, ;
Width = 180, ;
Name = "List1"

Add Object command1 As CommandButton With ;
Top = 24, ;
Left = 468, ;
Height = 132, ;
Width = 156, ;
Picture =Home()+ "graphics\gifs\morphfox.gif", ;
Caption = "", ;
Name = "Command1"

Add Object optiongroup1 As OptionGroup With ;
AutoSize = .T., ;
ButtonCount = 2, ;
Value = 2, ;
Height = 46, ;
Left = 288, ;
Top = 312, ;
Width = 95, ;
Name = "Optiongroup1", ;
Option1.Caption = "Transparent", ;
Option1.Value = 0, ;
Option1.Height = 17, ;
Option1.Left = 5, ;
Option1.Top = 5, ;
Option1.Width = 85, ;
Option1.AutoSize = .T., ;
Option1.Name = "Option1", ;
Option2.Caption = "Opaque", ;
Option2.Value = 1, ;
Option2.Height = 17, ;
Option2.Left = 5, ;
Option2.Top = 24, ;
Option2.Width = 61, ;
Option2.Name = "Option2"

Add Object label1 As Label With ;
AutoSize = .T., ;
FontBold = .T., ;
FontSize = 14, ;
Caption = "X", ;
Height = 25, ;
Left = 636, ;
Top = 0, ;
Width = 15, ;
ForeColor = Rgb(0,0,255), ;
BackColor = Rgb(255,0,255), ;
Name = "Label1"

Add Object label2 As Label With ;
AutoSize = .T., ;
FontBold = .T., ;
FontSize = 14, ;
Caption = "-", ;
Height = 25, ;
Left = 612, ;
Top = 0, ;
Width = 8, ;
ForeColor = Rgb(0,0,255), ;
BackColor = Rgb(255,0,255), ;
Name = "Label2"

Add Object shape1 As Shape With ;
Top = 312, ;
Left = 600, ;
Height = 49, ;
Width = 49, ;
Curvature = 15, ;
MousePointer = 15, ;
BackColor = Rgb(0,255,0), ;
Name = "Shape1"

Add Object image1 As Image With ;
Picture = Home()+"graphics\cursors\4way03.cur", ;
BackStyle = 0, ;
Height = 32, ;
Left = 609, ;
MousePointer = 15, ;
Top = 320, ;
Width = 32, ;
ToolTipText = "Move form", ;
Name = "Image1"

Add Object ylab As Label With ;
FontName = "Tahoma", ;
FontSize = 12, ;
Caption = "", ;
Height = 132, ;
Left = 216, ;
Top = 168, ;
Width = 348, ;
ForeColor = Rgb(128,0,64), ;
BackColor = Rgb(255,255,185), ;
Name = "yLab"

Procedure ytransp
#Define LWA_COLORKEY 1
#Define LWA_ALPHA 2
#Define GWL_EXSTYLE -20
#Define WS_EX_LAYERED 0x80000
Local nExStyle, nRgb, nAlpha, nFlags
nExStyle = GetWindowLong(ThisForm.HWnd, GWL_EXSTYLE)
nExStyle = BitOr(nExStyle, WS_EX_LAYERED)
= SetWindowLong(ThisForm.HWnd, GWL_EXSTYLE, nExStyle)
= SetLayeredWindowAttributes(ThisForm.HWnd, ThisForm.BackColor, 190,LWA_COLORKEY+LWA_ALPHA)
EndProc

Procedure yopaque
#Define LWA_COLORKEY 1
#Define LWA_ALPHA 2
#Define GWL_EXSTYLE -20
#Define WS_EX_LAYERED 0x80000
Local nExStyle
nExStyle = GetWindowLong(ThisForm.HWnd, GWL_EXSTYLE)
nExStyle = BitXor(nExStyle, WS_EX_LAYERED)
= SetWindowLong(ThisForm.HWnd, GWL_EXSTYLE, nExStyle)
ThisForm.Cls
ThisForm.BackColor=ThisForm.BackColor
ThisForm.Refresh
EndProc

Procedure Init
This.TitleBar=0
TEXT to this.ylab.caption noshow
this form can be made transparent with Apis.
it must be -top level form (showWindow=2)
-desktop=.t. for showWindow=0,1
can make one color transparent in the API and
set the transparency level (0-255)
ENDTEXT
EndProc

Procedure Load
Declare Integer GetWindowLong In user32;
INTEGER HWnd, Integer nIndex

Declare Integer SetWindowLong In user32;
INTEGER HWnd, Integer nIndex, Integer dwNewLong

Declare Integer SetLayeredWindowAttributes In user32;
INTEGER HWnd, Integer crKey,;
SHORT bAlpha, Integer dwFlags
EndProc

Procedure optiongroup1.InteractiveChange
Do Case
Case This.Value=1
ThisForm.ytransp()
Case This.Value=2
ThisForm.yopaque()
EndCase
EndProc

Procedure label1.Click
ThisForm.Release
EndProc

Procedure label2.Click
ThisForm.WindowState=1
EndProc

Procedure image1.MouseDown
LParameters nButton, nShift, nXCoord, nYCoord
Declare Integer GetFocus In WIN32API
lnHandle = ThisForm.HWnd
param1 = 274
param2 = 0xF012
Declare Integer ReleaseCapture In WIN32API
Declare Integer SendMessage In WIN32API Integer, Integer, Integer, Integer
bb=ReleaseCapture()
bb=SendMessage(lnHandle, param1, param2,0)
EndProc
Procedure Destroy
Clea Events
EndProc

EndDefine

  Visual FoxPro  Win32 API  Text opac/backg...

Search  Forum Home         

 Google Ads Minimize

    

Copyright 2002-2010 Profox   Terms Of Use  Privacy Statement