Re: Bitmaps as buttons?



Hi Cor,

Thanks for that. I see that you can use a string as a graphicspath which
acts like a mask, but it still doesn't allow me to use a bitmap (i.e. I can
use a string or draw the points of a shape). Correct me if I have
interpreted your code or what you are saying wrongly.

Whilst I was looking at your code, Mick Doherty has sent a link to some code
that does draw a 'transparent' control based on the color of the bottom left
pixel being the transparent color. This is close to what I mean - I need to
code this into a button control.

Take a look and see what I mean:
http://www.dotnetrix.co.uk/custom.html

Thanks,

Flashster


"Cor Ligthert [MVP]" <notmyfirstname@xxxxxxxxx> wrote in message
news:ObRxCrR8FHA.3660@xxxxxxxxxxxxxxxxxxxxxxx
> Flashster,
>
> It is not that difficult to do it.
>
> I have only a sample for a complete region form to how you how simple it
> is.
>
> http://www.vb-tips.com/default.aspx?ID=72f58d3f-2cb5-4d51-b148-a2eda88e06ee
>
> I hope that this gives an idea.
>
> Cor
>
>
> "Flashster" <flashster2003@xxxxxxxxxxx> schreef in bericht
> news:OoH6BUR8FHA.2040@xxxxxxxxxxxxxxxxxxxxxxx
>> Hi Cor.
>>
>> The application I am developing is for a very specific set of people. It
>> will only be run on Windows XP or possibly Windows 2000, and the graphics
>> on the user interface are to match a similar application (written on an
>> entirely different platform, using different technology).
>>
>> I clearly need to specify the region of the button, but wondered if there
>> was any way of doing it besides drawing the bitmap shape, point by point.
>>
>> If using some sort of mask (i.e transparency) would cause problems in 24
>> bit displays (as I think you are saying) , then am I right in assuming
>> that drawing the region point by point (as suggested in Herfried's
>> earlier message) would avoid this problem and display correctly on any
>> system?
>>
>> I just hoped there was an easier way to specifiy a region, perhaps by
>> using a masking bitmap.
>>
>>
>> "Cor Ligthert [MVP]" <notmyfirstname@xxxxxxxxx> wrote in message
>> news:u2D4UFR8FHA.3416@xxxxxxxxxxxxxxxxxxxxxxx
>>> Flasher,
>>>
>>> You make me curious, how do you want to make non square buttons without
>>> to tell what the region should be of that button. You can use the bitmap
>>> solution, however I would not to that because you are than direct in
>>> trouble with a W98/Me or with more than 24bits screen color setting, and
>>> those who don't have today still not 32bits are probalby not so
>>> interested in your shaped button.
>>>
>>> Just my thought,
>>>
>>> Cor
>>>
>>> "Flashster" <flashster2003@xxxxxxxxxxx> schreef in bericht
>>> news:uGmzcBR8FHA.1280@xxxxxxxxxxxxxxxxxxxxxxx
>>>> Hi Dennis,
>>>>
>>>> The problem with using the picture box is again that its square. If I
>>>> have an irregular shaped bitmap that changes color when the mouse moves
>>>> over it (for example) then a transparent square behind it will cause
>>>> the bitmap to change colour even when the mouse cursor is not over it
>>>> (i.e. it will be over the transparent square but not the bitmap shpae
>>>> that the user sees).
>>>>
>>>> What I need is a similar technique as is used to shape forms - i.e. use
>>>> some sort of masking shape.
>>>>
>>>> Anyone any suggestions?? Surely there's a way of doing this besides
>>>> drawing each point in a Region to match the bitmap?
>>>>
>>>> "Dennis" <Dennis@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>>>> news:E179BF9F-3213-46F1-A32D-9D4D8DA53A28@xxxxxxxxxxxxxxxx
>>>>> You could also use a picture box for the button...it has click events.
>>>>> --
>>>>> Dennis in Houston
>>>>>
>>>>>
>>>>> "Flashster" wrote:
>>>>>
>>>>>> Is there a way of specifying the 'Region' using a mask of the bitmap
>>>>>> or
>>>>>> similar method?
>>>>>> I would prefer not to have to draw the region programmatically for
>>>>>> each and
>>>>>> every point on a button shape if possible.
>>>>>>
>>>>>>
>>>>>> "Herfried K. Wagner [MVP]" <hirf-spam-me-here@xxxxxx> wrote in
>>>>>> message
>>>>>> news:uIeG9zO8FHA.3044@xxxxxxxxxxxxxxxxxxxxxxx
>>>>>> > "Flashster" <flashster2003@xxxxxxxxxxx> schrieb:
>>>>>> >>I want to create buttons in the shape of bitmaps - i.e. without a
>>>>>> >>square
>>>>>> >>around them.
>>>>>> >
>>>>>> >
>>>>>> > Create a class which inherits from 'Button'. Then create a
>>>>>> > 'Region'
>>>>>> > object of appropriate shape and assign it to the control's 'Region'
>>>>>> > property at runtime, and override the control's 'OnPaint' method to
>>>>>> > draw
>>>>>> > the bitmap onto the button.
>>>>>> >
>>>>>> > --
>>>>>> > M S Herfried K. Wagner
>>>>>> > M V P <URL:http://dotnet.mvps.org/>
>>>>>> > V B <URL:http://classicvb.org/petition/>
>>>>>>
>>>>>>
>>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>


.


Loading