For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic > August 2005 > Borderstyle promlem









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Borderstyle promlem
Ian Davies

2005-08-29, 7:55 am

I have my forms border styles set to 0 (No border)
However, to give my app some variety I have a button which changes the look
to the user interface where I want the forms to display as sizable
(borderstyle = 2)

in the 'on click' event of a button on my main form which opens form two I
have

form2.Show
form2.BorderStyle = 2

However this does not change the bordersytle of the form2. It stays as 0 (no
border). Thinking that maybe it will not work as it is not in form2's own
module, I put it in form2's 'Load' event but it still did not work

Any ideas why

Ian


Tom Esh

2005-08-29, 6:55 pm

On Mon, 29 Aug 2005 12:17:13 GMT, "Ian Davies" <iandan.dav@virgin.net>
wrote:

>I have my forms border styles set to 0 (No border)
>However, to give my app some variety I have a button which changes the look
>to the user interface where I want the forms to display as sizable
>(borderstyle = 2)
>
>in the 'on click' event of a button on my main form which opens form two I
>have
>
>form2.Show
>form2.BorderStyle = 2
>
>However this does not change the bordersytle of the form2. It stays as 0 (no
>border). Thinking that maybe it will not work as it is not in form2's own
>module, I put it in form2's 'Load' event but it still did not work


Won't work. VB's BorderStyle prop is read-only at runtime. However you
can do this fairly easily with the Api. Karl Peterson has a nice
example on his site that wraps it all up in a small class mod.
See the "FormBdr" example at:
http://vb.mvps.org/

One minor thing to keep in mind is VB decides what items to put on the
system (ControlBox) menu based on the BorderStyle, MinButton,
MaxButton, etc properties you set at ~design~ time. When you change
those styles with the Api at runtime the sys menu will not be updated
accordingly. For that reason you may want to start with a form in
design mode with a BorderStyle of something other than "none". That
way it's sysmenu will be populated. (The sysmenu can also be
manipulated at runtime with the Api, but it's a lot easier to remove
unwanted items than add new ones and make them actually work.)


-Tom
MVP - Visual Basic
(please post replies to the newsgroup)
Norm Cook

2005-08-29, 6:55 pm

Try Karl's code here:
http://vb.mvps.org/samples/project.asp?id=FormBdr

"Ian Davies" <iandan.dav@virgin.net> wrote in message
news:d1DQe.3879$n4.851@newsfe2-win.ntli.net...
> I have my forms border styles set to 0 (No border)
> However, to give my app some variety I have a button which changes the

look
> to the user interface where I want the forms to display as sizable
> (borderstyle = 2)
>
> in the 'on click' event of a button on my main form which opens form two I
> have
>
> form2.Show
> form2.BorderStyle = 2
>
> However this does not change the bordersytle of the form2. It stays as 0

(no
> border). Thinking that maybe it will not work as it is not in form2's own
> module, I put it in form2's 'Load' event but it still did not work
>
> Any ideas why
>
> Ian
>
>



Ian Davies

2005-08-29, 6:55 pm

Norm/Tom

Yes I can use that. That will do the trick
Thanks

Ian

"Norm Cook" <normcookNOSPAM@cableone.net> wrote in message
news:11h628ksjp2lk29@corp.supernews.com...
> Try Karl's code here:
> http://vb.mvps.org/samples/project.asp?id=FormBdr
>
> "Ian Davies" <iandan.dav@virgin.net> wrote in message
> news:d1DQe.3879$n4.851@newsfe2-win.ntli.net...
> look
I[color=darkred]
> (no
own[color=darkred]
>
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com