Change fill color of a rectangle at runtime (c++)
Hi all 
Subject says it all--I'm simply trying to change the fill color of a rectangle at run time via c++. Seems like a simple thing but I'm having no luck. Obviously I'm overlooking the obvious
Thanks for any help...

Subject says it all--I'm simply trying to change the fill color of a rectangle at run time via c++. Seems like a simple thing but I'm having no luck. Obviously I'm overlooking the obvious

Thanks for any help...
Re: Change fill color of a rectangle at runtime (c++)
This should work:
If not, tell me more about your scenario please.
Code: Select all
Ptr<Brush> fill = *new SolidColorBrush(Color::Red);
rectangle->SetFill(fill.GetPtr());
Re: Change fill color of a rectangle at runtime (c++)
Based on your example, I used this so I could precisely set the color:
But yes, works great. Your Noesis::Ptr handles the cleanup, yes? I don't have to delete that "*new"?
Thanks again...
Code: Select all
Noesis::Ptr<Noesis::Gui::Brush> Fill = *new Noesis::Gui::SolidColorBrush(Noesis::Drawing::Color(0, 255, 0));
rectangle->SetFill(Fill .GetPtr());
Thanks again...

Re: Change fill color of a rectangle at runtime (c++)
Yes, the Ptr handles the memory automatically for you.
Re: Change fill color of a rectangle at runtime (c++)
Cheers. Thanks again for the help...
Who is online
Users browsing this forum: Ahrefs [Bot] and 33 guests