Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Skins In VFP Forms ??? Please Reply Fast !!! 2

Status
Not open for further replies.

VFP7

Programmer
Jan 17, 2001
15
IN
Hello Friends

Will any one tell me how to use skins on a VFP Form and Does it possible to create irregular shape forms in VFP ?

Thanks in advance.
 
Skins? You can add pictures to a form, and under the XP OS it will use "Themes".

How about a sample "Circle" form?

Code:
oForm = CREATEOBJECT("frmcircle")
oForm.windowtype = 1 && modal
oForm.show()

oForm = .Null.

DEFINE CLASS frmcircle AS form

   Height = 400
   Width = 400
   DoCreate = .T.
   AutoCenter = .T.
   BorderStyle = 0
   Movable = .F.
   TitleBar = 0
   BackColor = RGB(0,0,255)
   Name = "frmCircle"

   PROCEDURE DblClick
      ThisForm.Release()
   ENDPROC

   PROCEDURE Init
   LOCAL nhWnd, nWidth, nHeight, nRegion

   DECLARE INTEGER CreateEllipticRgn IN gdi32 ;
      INTEGER X1 , INTEGER Y1 , INTEGER X2 , INTEGER Y2
   DECLARE INTEGER SetWindowRgn IN user32 ;
      INTEGER HWND, INTEGER hRgn , INTEGER bRedraw

      nhWnd = This.HWnd
      nWidth = This.WIDTH / 3 && change ratio
      nHeight = This.HEIGHT / 2 && change ratio
      nRegion = CreateEllipticRgn(0, 0, nWidth, nHeight)
      SetWindowRgn(nhWnd, nRegion, 1)
   ENDPROC

ENDDEFINE
*
*-- EndDefine: frmcircle

Rick
 
Thanks rgbean.

But is it possible to use standard freeware Skins (as they call it) to use in VFP form.

Like circle, can we make irregular shape forms.


Thanks again.
 
030471

That was a fast reply. A year later!!!
Better late then never. ;-)
Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first
 
You can also check out VFP-Skin 2.0 at universalthread.com under the VFP zone download section.
 
shangrilla

There are 4 samples (2 spanish versions and 2 english verions). In the english, one is just the class, the other a sample projects. Just look at the readme file, it expalins the step to make it work. Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first
 
I tried out vfpskins2 and I'm fairly impressed with what they have accomplished. So much so, that I've opened a dialog with them.

It works with VFP5 through VFP7.

Their code is full of api calls, so It's a good example of the power of VFP with API interfacing.

I highly recommend checking it out.

Caveat: Run on a fast machine.

Darrell 'We all must do the hard bits so when we get bit we know where to bite' :)
 
Error: Can't find config file or it is empty. Also whats with the picture property of the class. It says c:\myApp\skin1\ - am I supposed to do something there?
 
Shangrilla,

Error: Can't find config file or it is empty. Also whats with the picture property of the class. It says c:\myApp\skin1\ - am I supposed to do something there?

The config files come with the demo. They are text files (one of which is called br.txt), in the skinname property you would put "c:\myProject\br" no quotes no extensions. That's it. And if you you VFP7 you would put .t. at the VFP7 property. Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first
 
You need to extract the contents of the demo version into the same folder that your project is in.

Although I like vfpskins, there are a number of assumptions he made that cause annoyances.

So, the form must be in the same folder as all vfpskin files.

Add the class vfp-skin2.vcx to a form, set the property skinname(ie. alien, commander, etc.) and rebuild.

You can also use the method changeskin() to change the appearance at runtime.

I'm in communication with him and he's working on a number of changes, so I expect some pretty good changes down the road. I've also been analyzing his code and making some changes that I feel are helpful.

I'm excited about the possibilities of this class, so drop him a line and thank him for the hard work.

Darrell
'We all must do the hard bits so when we get bit we know where to bite' :)
 
HI

The following was a copy I got from somewhere..
*****************************************************
** Copy the following code as a PRG and run
** Click on the form to see holes in thee form..
** Move the form by holding the mouse press
** on the title bar and see behind objects accesible
** thru the hole.
****************************************************
PUBLIC frm
frm = CreateObject ("Tform")
frm.Visible = .T.
* end of main

DEFINE CLASS Tform As Form
Width = 500
Height = 300
AutoCenter = .T.
BackColor = Rgb(192,224,192)
Caption = "Combining regions"

ADD OBJECT lbl1 As Tlabel WITH;
Caption="It only looks like shapes upon the form...",;
Left=10, Top=10

ADD OBJECT lbl2 As Tlabel WITH;
Caption="...but these are holes. Put something behind.",;
Left=20, Top=150

PROCEDURE Load
THIS.decl
ENDPROC

PROCEDURE Resize
* THIS.RemoveRegions && does not make any difference
ThisForm.ApplyRegions
ENDPROC

PROCEDURE Activate
ThisForm.ApplyRegions
ENDPROC

PROCEDURE RemoveRegions
= SetWindowRgn (GetFocus(), 0, 1)
ENDPROC

PROCEDURE ApplyRegions
#DEFINE RGN_AND 1
#DEFINE RGN_OR 2
#DEFINE RGN_XOR 3
#DEFINE RGN_DIFF 4
#DEFINE RGN_COPY 5

#DEFINE radius 84
#DEFINE interspace 12

LOCAL hRgnBase, hRgn, hwnd, x0,y0,x1,y1
DIMEN hRgnExclude [5] && an array to store elliptical regions

* create a rectangle region
* and set it by the rectangle of the form
hRgn = CreateRectRgn (0,0,1,1)
hwnd = GetFocus() && get window handle for the form
THIS.GetRect (hwnd, @x0,@y0,@x1,@y1)
hRgnBase = CreateRectRgn (0,0,x1-x0,y1-y0)

x0 = 20
y0 = 70
y1 = y0 + radius
* create several elliptical regions
FOR ii=1 TO 5
hRgnExclude[ii] = CreateEllipticRgn (x0,y0, x0+radius,y1)
x0 = x0 + radius + interspace
ENDFOR

* combine elliptical regions into one region
= CombineRgn (hRgn, hRgnExclude[1], hRgnExclude [2], RGN_OR)
= CombineRgn (hRgn, hRgn, hRgnExclude [3], RGN_OR)
= CombineRgn (hRgn, hRgn, hRgnExclude [4], RGN_OR)
= CombineRgn (hRgn, hRgn, hRgnExclude [5], RGN_OR)

* subtract the resulting region
* from the region defined by the rectangle of the form
= CombineRgn (hRgn, hRgnBase, hRgn, RGN_XOR)

* apply final region to the form
= SetWindowRgn (hwnd, hRgn, 1)

* free system resources
= DeleteObject (hRgn)
FOR ii=1 TO 5
= DeleteObject (hRgnExclude[ii])
ENDFOR
= DeleteObject (hRgnBase)
ENDPROC

PROCEDURE GetRect (hwnd, x0,y0,x1,y1)
LOCAL lpRect
lpRect = SPACE (16)

= GetWindowRect (hwnd, @lpRect)
x0 = THIS.buf2dword (SUBSTR(lpRect, 1,4))
y0 = THIS.buf2dword (SUBSTR(lpRect, 5,4))
x1 = THIS.buf2dword (SUBSTR(lpRect, 9,4))
y1 = THIS.buf2dword (SUBSTR(lpRect, 13,4))
ENDPROC

FUNCTION buf2dword (lcBuffer)
RETURN;
Asc(SUBSTR(lcBuffer, 1,1)) + ;
Asc(SUBSTR(lcBuffer, 2,1)) * 256 +;
Asc(SUBSTR(lcBuffer, 3,1)) * 65536 +;
Asc(SUBSTR(lcBuffer, 4,1)) * 16777216
ENDFUNC

PROCEDURE decl
DECLARE INTEGER CreateEllipticRgn IN gdi32;
INTEGER nLeftRect, INTEGER nTopRect,;
INTEGER nRightRect, INTEGER nBottomRect

DECLARE INTEGER CreateRectRgn IN gdi32;
INTEGER nLeftRect, INTEGER nTopRect,;
INTEGER nRightRect, INTEGER nBottomRect

DECLARE INTEGER CombineRgn IN gdi32;
INTEGER hrgnDest, INTEGER hrgnSrc1,;
INTEGER hrgnSrc2, INTEGER fnCombineMode

DECLARE SetWindowRgn IN user32;
INTEGER hWnd, INTEGER hRgn, SHORT bRedraw

DECLARE SHORT GetWindowRect IN user32;
INTEGER hwnd, STRING @lpRect

DECLARE INTEGER DeleteObject IN gdi32 INTEGER hObject
DECLARE INTEGER GetFocus IN user32
ENDPROC
ENDDEFINE

DEFINE CLASS Tlabel As Label
FontName="Times New Roman"
FontSize=18
AutoSize=.T.
BackStyle=0
ENDDEFINE
****************************************************
The credit goes to the creator.. I am only a gateway.

:)
ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top