DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Tue, 24 Jul 2007 11:12:38 -0400,    posted on: microsoft.public.dotnet.framework.drawing        back       

Thread Index
  1    active
          2    Michael C
                 3    active
                        4    Michael C
                               5    active
                               6    Michael C
                               7    active


Ncp = Bm.Palette clones Bm.Palette?   
Dim Ncp As ColorPalette = Bm.Palette



From a test I ran I think that the above statement does not cause Ncp to 
reference Bm.Palette but instead produces a new palette and Ncp points to 
it.



Is that true?

If so, is the new palette a clone of Bm.Palette?



Thanks
Date:Tue, 24 Jul 2007 11:12:38 -0400   Author:  

Re: Ncp = Bm.Palette clones Bm.Palette?   
" active"  wrote in message 
news:uOwaTUgzHHA.5052@TK2MSFTNGP04.phx.gbl...

> Dim Ncp As ColorPalette = Bm.Palette
>
>
>
> From a test I ran I think that the above statement does not cause Ncp to 
> reference Bm.Palette but instead produces a new palette and Ncp points to 
> it.
>
>
>
> Is that true?
>
> If so, is the new palette a clone of Bm.Palette?


Yes, it copies the palette. In order to change the bitmap's palette you need 
to pass it back in. I have not tested but presumably this code would do 
nothing:

bm.Palette[0] = Color.Red;

Michael
Date:Wed, 25 Jul 2007 09:51:09 +1000   Author:  

Re: Ncp = Bm.Palette clones Bm.Palette?   
"Michael C"  wrote in message 
news:O7XnD1kzHHA.3400@TK2MSFTNGP03.phx.gbl...

>" active"  wrote in message 
>news:uOwaTUgzHHA.5052@TK2MSFTNGP04.phx.gbl...
>
....
>  In order to change the bitmap's palette you need to pass it back in.


What did you mean by this?


thanks
Date:Tue, 24 Jul 2007 20:34:26 -0400   Author:  

Re: Ncp = Bm.Palette clones Bm.Palette?   
" active"  wrote in message 
news:uslHPOlzHHA.3564@TK2MSFTNGP04.phx.gbl...

>>  In order to change the bitmap's palette you need to pass it back in.
>
> What did you mean by this?


Dim ncp As ColorPalette = Bm.Palette
ncp[0] = Color.Red
Bm.Palette = ncp; //<----- Passing back in

Michael
Date:Wed, 25 Jul 2007 11:37:27 +1000   Author:  

Re: Ncp = Bm.Palette clones Bm.Palette?   
That will work?
If Bm.Palette returns a reference to a copy of the palette, rather than a 
reference to the bitmap's palette, seems that Bm.Palette = ncp would not 
change the bitmap's palette, but the thing Bm gives out as a palette.


Am I wrong?

thanks


"Michael C"  wrote in message 
news:uVD6awlzHHA.2484@TK2MSFTNGP06.phx.gbl...

>" active"  wrote in message 
>news:uslHPOlzHHA.3564@TK2MSFTNGP04.phx.gbl...
>>>  In order to change the bitmap's palette you need to pass it back in.
>>
>> What did you mean by this?
>
> Dim ncp As ColorPalette = Bm.Palette
> ncp[0] = Color.Red
> Bm.Palette = ncp; //<----- Passing back in
>
> Michael
> 
Date:Tue, 24 Jul 2007 22:22:53 -0400   Author:  

Re: Ncp = Bm.Palette clones Bm.Palette?   
" active"  wrote in message 
news:OajXcLmzHHA.2484@TK2MSFTNGP06.phx.gbl...

> That will work?
> If Bm.Palette returns a reference to a copy of the palette, rather than a 
> reference to the bitmap's palette, seems that Bm.Palette = ncp would not 
> change the bitmap's palette, but the thing Bm gives out as a palette.


When you pass the palette back in via the Palette property it will replace 
the bitmap's palette. The palette is likely stored in a block of memory that 
represents the bitmap, when you retrieve the palette it would copy data from 
memory into the palette object. When you pass in a palette it will copy data 
from that palette back into that block of memory, hence replacing the 
palette for the bitmap.

Michael
Date:Wed, 25 Jul 2007 14:01:21 +1000   Author:  

Re: Ncp = Bm.Palette clones Bm.Palette?   
That clears it up.

thanks

"Michael C"  wrote in message 
news:%23Nis0AnzHHA.3400@TK2MSFTNGP03.phx.gbl...

>" active"  wrote in message 
>news:OajXcLmzHHA.2484@TK2MSFTNGP06.phx.gbl...
>> That will work?
>> If Bm.Palette returns a reference to a copy of the palette, rather than a 
>> reference to the bitmap's palette, seems that Bm.Palette = ncp would not 
>> change the bitmap's palette, but the thing Bm gives out as a palette.
>
> When you pass the palette back in via the Palette property it will replace 
> the bitmap's palette. The palette is likely stored in a block of memory 
> that represents the bitmap, when you retrieve the palette it would copy 
> data from memory into the palette object. When you pass in a palette it 
> will copy data from that palette back into that block of memory, hence 
> replacing the palette for the bitmap.
>
> Michael
> 
Date:Wed, 25 Jul 2007 09:09:00 -0400   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us