Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

[VB/C#] Matrix Fall | GDI+ Matrix-Grid-ish Control

I feel like this thread, along with other GDI threads, isn't getting the attention it deserves.
Maybe it's just me, but I think things like this are really cool.
Odus, trvp did this with numbers as well. Maybe add that?

riperino animefanerino
(Sep 12, 2016 04:11 PM){Nexus} Wrote:  If the FBI come knocking I'm gonna spew information out my ass about Aeon.

They'd have to tell me to stop giving them information.

Odus is my son, I think I deserve a shoutout too!
Filthy GDI peasants still using timers and .FillRectangle
WPF master race

Lelelelelelele
(Jun 26, 2015 01:58 PM)SubGenius Wrote:  Filthy GDI peasants still using timers and .FillRectangle
WPF master race

Lelelelelelele

There was a time a while ago where I made a thread to take requests for GDI controls.

https://hackforums.net/showthread.php?ti...id36989738

[Image: image.jpg]

Let's not get cocky. ;)
(Jun 26, 2015 02:14 PM)Hawk HF Wrote:  There was a time a while ago where I made a thread to take requests for GDI controls.

https://hackforums.net/showthread.php?ti...id36989738

[Image: image.jpg]

Let's not get cocky. ;)

🤫
Hey, that was like 1.5 years ago...
Great release man 🙂 Nice looking 😉
Stupid question but with your example. How would we go about using a combobox to change the color and also change the size of the objects?
(Jun 24, 2015 07:20 PM)Oliver Sykes Wrote:  Odus, trvp did this with numbers as well. Maybe add that?

I was actually going to 1up him and allow a custom array of characters, will update OP shortly.




(Jun 28, 2015 06:53 PM)AustinPape10101 Wrote:  Stupid question but with your example. How would we go about using a combobox to change the color and also change the size of the objects?

Not at all. The Colors property is of type color array, so you can change the colors using that.

In the demonstration, I used a Dictionary of String & Color() to hold my colors and set the ComboBox's data source to the dictionary. So the keys (string) front the ComboBox items but the value is really your colors (color()). Like so:

Code
Dim cd As New Dictionary(Of String, Color()) From {
    {Color.Red, Color.IndianRed, Color.DarkRed},
    {Color.Green, Color.GreenYellow, Color.LawnGreen}
}

ComboBox1.DataSource = New BindingSource(cd, Nothing)

ComboBox1.DisplayMember = "Key"
ComboBox1.ValueMember = "Value"

When using, I just cast the selected item to a KeyValuePair and set the Colors property to its value:

Code
MatrixFall1.Colors = DirectCast(ComboBox1.SelectedItem, KeyValuePair(Of String, Color())).Value

For the objects' size, use the BlockSize property which is of type Size. So in your NumericUpDown ValueChanged event, set the BlockSize to their values:

Code
MatrixFall1.BlockSize = New Size(Convert.ToInt32(NumericUpDown1.Value), Convert.ToInt32(NumericUpDown2.Value))

This was for a demo so I didn't bother changing the control names. I'm glad so many people like it though!


Possibly Related Threads...
Thread / Author Replies Views Last Post
[.NET] by ๖ۣۜMephobiaNov 14, 2025 07:54 PM 171 21,479 Nov 14, 2025 07:54 PM
Last Post: ProxyLand
[.NET] by QuobiAug 6, 2022 02:23 PM 0 407 Aug 6, 2022 02:23 PM
Last Post: Quobi
[.NET] by PolarisGangJun 21, 2022 10:09 AM 1 353 Jun 21, 2022 10:09 AM
Last Post: gigajew