Re: Skins - a great solution
From: Dave (dave5398_at_btinternet.com)
Date: 11/02/04
- Next message: Dave: "Re: How do I put my own custom button on the form title bar?"
- Previous message: Mike D Sutton: "Re: Screen Resolution"
- In reply to: Mike D Sutton: "Re: Skins - a great solution"
- Next in thread: Mike D Sutton: "Re: Skins - a great solution"
- Reply: Mike D Sutton: "Re: Skins - a great solution"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 2 Nov 2004 17:50:37 -0000
"Mike D Sutton" <EDais@mvps.org> wrote in message
news:u#AVOqPwEHA.1260@TK2MSFTNGP10.phx.gbl...
> > Thanks, but I think I found a better solution. Try
http://www.thescarms.com
> > Basically you can take any picture - I found a bitmap gives best results
and
> > taking the top left bit as transparent you load it into a picture box
and
> > scan each row of pixels at a time using GetPixel. That way you can
build up
> > a region using CombineRgn with all non-transparent pixels, and set the
forms
> > region to that one, and bingo you're there! It's excellent. No need to
> > worry about rectangular/ rounded or oval regions, it's all automatic -
> > whereever your transparency colour is, there will be a "hole". I
thought
> > the scanning would take a long time, but even in VB it's fast. I
actually
> > built a C++ component to do it quicker and encapsulate all the API
calls.
>
> You think so? Not the case I'm afraid, you're calling exactly the same
code from both languages ;)
>
> > You then cut out areas using something like Photoshop, load them into an
> > array of picture boxes and if you position them over the corresponding
areas
> > in the skin you can get buttons with rollover functionality (using the
> > SetCapture method). It's very effective.
>
> There's a faster version of this technique on
http://www.vbaccelerator.com/
> Incidentally, IIRC the shaped form creator application previously
mentioned also includes a bitmap tracing method which uses the
> same technique.
> One thing to note with this method is that you must use a losslessly
compressed (or uncompressed) image, using a JPEG as the source
> image will not work regardless of high the quality setting was set to when
saving it due to the lossy nature of the compression
> method used with the format.
> Hope this helps,
>
> Mike
>
>
> - Microsoft Visual Basic MVP -
> E-Mail: EDais@mvps.org
> WWW: http://EDais.mvps.org/
>
Thanks Mike.
Yes and no! Yes you are absolutely right that the same API's are called in
both languages. However, C++ loops are obviously faster. Also, as stated,
this is a neat way to encapsulate the API's and avoid all that function
declaring as it's all there in VC++.
I haven't looked at the link yet, but what I wanted to do to speed it up
would be to loop through the pixels in the array, directly, without calling
GetPixel. Clearly, millions of function calls is a big overhead. However,
I don't (yet) know how to get at the byte array from a bitmap handle. If
your link covers that, thanks, if not, could you help me out here?
On the other hand, for all the pix I've tried, even with holes and random
shapes, the form loads fast enough for all purposes, so it may not be
necessary to go the extra step. For elegance, however, you need it!
Finally, JPEGs DO work, "sort of". They are not satisfactory and leave bits
and pieces round the edges. Therefore better to use bitmaps as you say.
Dave
- Next message: Dave: "Re: How do I put my own custom button on the form title bar?"
- Previous message: Mike D Sutton: "Re: Screen Resolution"
- In reply to: Mike D Sutton: "Re: Skins - a great solution"
- Next in thread: Mike D Sutton: "Re: Skins - a great solution"
- Reply: Mike D Sutton: "Re: Skins - a great solution"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|