Konu: form başlığının rengi
form başlığının (Captionun yazılı olduğu yerin zemin rengi) rengini RGB() veya renk değeri olarak program içerisinde nasıl öğreniriz.
pencere renkleri Windows işletim sistemine göre değişiyor, onu arıyorum.
Giriş yapmadınız. Lütfen giriş yapın yada kayıt olun.
form başlığının (Captionun yazılı olduğu yerin zemin rengi) rengini RGB() veya renk değeri olarak program içerisinde nasıl öğreniriz.
pencere renkleri Windows işletim sistemine göre değişiyor, onu arıyorum.
"win32api change title bar color foxpro"
kelimelerini kullanıp aradım. Biraz kelimelerle oynayıp sende arayabilirsin.
Alttakileri buldum. Bilmem ne kadar işine yarar. Muhtemelen win32api lerle yapılır bu iş.
http://www.foxite.com/archives/change-the-color-of-the-title-bars-0000198202.htm
http://support.microsoft.com/kb/159271/en-us
http://books.google.com.tr/books?id=wKNfTHRNkLAC&pg=PA454&lpg=PA454&dq=win32api++Title+Bar+color+foxpro&source=bl&ots=__9XlVViXJ&sig=KSloVVEtDrc2tk_caHNDnz37YLo&hl=tr&sa=X&ei=ht68UJOXNumE4gTDrYCwBw&ved=0CDUQ6AEwAg#v=onepage&q=win32api%20%20Title%20Bar%20color%20foxpro&f=false
http://www.news2news.com/vfp/?search=title&x=0&y=0 bu sitede belki sana yardımcı olabilir.
Soruyu yanlis anlamis olabilirim. Bu kod ekranda mouse'un oldugu yerdeki rengi almak icin (vakti zamaninda beyin cerrahi bir arkadasim, beyin MR'larda gozle ayirmanin zor oldugu noktalarda mouse ile dolasarak sayisal gorebilir miyiz demisti. Oyle basladi bu hale geldi).
_Screen.Visible = .F.
oForm = Createobject('MyForm')
oForm.Show
Read Events
_Screen.Visible = .T.
Define Class myForm As Form
Top = 0
Left = 0
Height = 148
Width = 233
ShowWindow = 2
DoCreate = .T.
BorderStyle = 0
Caption = "Color Discovery"
posx = 0
posy = 0
pixelcolor = 0
rgbcolor = ''
HexColor = ''
Name = "Form1"
Add Object lblxpos As Label With ;
Caption = "XPos", ;
Height = 17, ;
Left = 13, ;
Top = 15, ;
Width = 31, ;
Name = "lblXpos"
Add Object lblypos As Label With ;
Caption = "Ypos", ;
Height = 17, ;
Left = 14, ;
Top = 45, ;
Width = 30, ;
Name = "lblYpos"
Add Object lblcolor As Label With ;
Caption = "Color", ;
Height = 17, ;
Left = 12, ;
Top = 75, ;
Width = 32, ;
Name = "lblColor"
Add Object lblrgbcolor As Label With ;
Caption = "RGB", ;
Height = 17, ;
Left = 12, ;
Top = 101, ;
Width = 32, ;
Name = "lblrgbColor"
Add Object lblhexcolor As Label With ;
Caption = "Hex", ;
Height = 17, ;
Left = 12, ;
Top = 126, ;
Width = 32, ;
Name = "lblhexColor"
Add Object txtxpos As TextBox With ;
FontBold = .T., ;
ControlSource = "thisform.PosX", ;
Height = 23, ;
Left = 52, ;
ReadOnly = .T., ;
Top = 12, ;
Width = 100, ;
Name = "txtXpos"
Add Object txtypos As TextBox With ;
FontBold = .T., ;
ControlSource = "Thisform.PosY", ;
Height = 23, ;
Left = 52, ;
ReadOnly = .T., ;
Top = 42, ;
Width = 100, ;
Name = "txtYpos"
Add Object txtcolor As TextBox With ;
FontBold = .T., ;
ControlSource = "Thisform.PixelColor", ;
Height = 23, ;
Left = 52, ;
ReadOnly = .T., ;
Top = 72, ;
Width = 100, ;
Name = "txtColor"
Add Object txtrgbcolor As TextBox With ;
FontBold = .T., ;
ControlSource = "Thisform.RGBColor", ;
Height = 23, ;
Left = 52, ;
ReadOnly = .T., ;
Top = 98, ;
Width = 100, ;
Name = "txtrgbColor"
Add Object txthexcolor As TextBox With ;
FontBold = .T., ;
ControlSource = "Thisform.HexColor", ;
Height = 23, ;
Left = 52, ;
ReadOnly = .T., ;
Top = 123, ;
Width = 100, ;
Name = "txthexColor"
Add Object timer1 As Timer With ;
Top = 0, ;
Left = 156, ;
Height = 23, ;
Width = 23, ;
Interval = 100, ;
Name = "Timer1"
Add Object colorshower As Container With ;
Top = 33, ;
Left = 167, ;
Width = 49, ;
Height = 49, ;
Name = "ColorShower"
Procedure Load
Declare Sleep In Win32API Integer
Declare short GetCursorPos In win32api String @ lpPoint
Declare Integer GetWindowDC In Win32API Integer HWnd
Declare Integer GetPixel In win32API ;
integer hdc, Integer nXPos, Integer nYPos
Endproc
Procedure QueryUnload
Clear Events
Endproc
Procedure Color2RGB
lparameters tnColor
local lnRed,lnGreen,lnBlue
lnRed = bitrshift(bitand(tnColor, 0x0000FF),0)
lnGreen = bitrshift(bitand(tnColor, 0x00FF00),8)
lnBlue = bitrshift(bitand(tnColor, 0xFF0000),16)
return trans(lnRed)+","+trans(lnGreen)+","+trans(lnBlue)
EndProc
Procedure timer1.Timer
lpPoint = Space(8)
With Thisform
If GetCursorPos(@lpPoint)#0
.posx = Asc(Substr(lpPoint,1))*256^0+;
asc(Substr(lpPoint,2))*256^1+;
asc(Substr(lpPoint,3))*256^2+;
asc(Substr(lpPoint,4))*256^3
.posy = Asc(Substr(lpPoint,5))*256^0+;
asc(Substr(lpPoint,6))*256^1+;
asc(Substr(lpPoint,7))*256^2+;
asc(Substr(lpPoint,8))*256^3
.pixelcolor = GetPixel(GetWindowDC(0), .posx, .posy)
.RGBColor = .Color2RGB(.PixelColor)
.HexColor = STUFF(TRANSFORM(.PixelColor,'@0'),3,2,'')
.colorshower.BackColor = .pixelcolor
.Refresh()
Endif
Endwith
Endproc
Enddefine
Not: Title'in rengi isletim versiyonuna gore degisiyor dedigin gibi. Mesela windows 7'de aero ile yari seffaf title var, dolayisiyla title barin her tarafi farkli zamanda farkli renkte olabilir.
DECLARE INTEGER GetSysColor in User32.dll Integer
? _screen.BackColor=GetSysColor(3) && titel bar açık kısmı
? _screen.BackColor=GetSysColor(2) && titel bar koyu kısmı
*yukardaki değerleri acele deneme /yanılma ile buldum - kullanacaklar bir daha gözden geçirirler
Yardımlara teşekkürler.
ilgili makaleler:
http://msdn.microsoft.com/en-us/library/aa930986.aspx
http://msdn.microsoft.com/en-us/library/aa979294(v=vs.71).aspx
----
düzenleme 2: meğerse elimizin altında imiş
DO FORM "c:\program files\microsoft visual foxpro 9\samples\solution\solution.scx"
DO FORM "c:\program files\microsoft visual foxpro 9\samples\solution\winapi\syscolor.scx"
---
düzenleme: Çetin'in koduna ^ (şapka çıkarma işareti - her eve lazım cinsinden)
Ali abi, Sana ( ve bize ) o şapkalardan daha çok lazım
Her eve lazım bir kod.