Memory use of Dynamically expanding TreeView

I created a tool a few years ago that uses a WPF TreeView with huge numbers of nodes. The branching factor is pretty high (the number of branches per level), and the depth can be several hundred levels. Of course, creating the whole tree would consume huge amounts of memory and processing time. This is…

0

Use gravity to generate Cartoon animation frames

I wrote a cartoon animation program around 1982 in C. The Honolulu Academy of Arts asked me to demo the program in their Focus on Computer Graphics. The program allows the user to draw lines of a cartoon frame using the mouse. The user then saves that frame and draws another. To animate, the program…

1

Use C++ and no managed code to create a WPF form

In Use the power of Reflection to create and manipulate managed objects I showed how to create a WPF form with a StackPanel, Button and Textbox from a C# console app, using reflection. The code adds text to the textbox and sets some properties on it. Using reflection works, but makes the code 5 time…

1

Create your own Process Explorer

I was playing around with showing some resizable content in a WPF window. I wanted 2 variable sized Lists, one on top of the other. The lists had various lengths, but also various widths: the user could adjust the size of the columns. This smelled like a GridSplitter. That means I need 3 rows in…

0

Export your data to Excel using CSV and all data appears in one column

In many prior posts, I export data to Excel via writing to a TEMP file and just starting that TEMP file, which starts Excel, if Excel is on the machine.   var tempFileName = System.IO.Path.ChangeExtension( System.IO.Path.GetTempFileName(), "csv"); System.IO.File.WriteAllText( tempFileName, SomeText); If the format of the output is comma delimited, with the first row having column…

0

Fish vs Sharks: Predator Prey simulation

Many years ago, A.K. Dewdney wrote an article in Scientific American Magazine (December 1984) about a world called Wator, which is a world of fish and sharks. The world is a cellular automaton with each cell being in one of three states: empty, a shark, or a fish. The world is calculated repeatedly, each cycle…

0

Logo Turtle Graphics in WPF

Logo is a programming language that somehow involves a turtle. Imagine a turtle on a large piece of paper on the floor. The  turtle has a pen. You can command the turtle to go forward, turn right, then repeat 4 times to draw a square. The last time I wrote about Logo (in 2006) I…

2

DPI Aware Sample

Last time I showed a way to use immediate mode graphics in WPF by showing balls bouncing around in a window. This time, we’ll add a few features. I’ve made the program DPI (Dots Per Inch) Aware. On most machines it works correctly. However, on my brand new Surface Pro 3 (really nice!), the screen…

0

WPF immediate mode graphics

Windows Presentation Foundation (WPF) is a retained mode graphics system (see Retained Mode Versus Immediate Mode). That means when you write code to draw something, you’re actually declaring a set of graphics objects (like lines or shapes) to use. The graphics library then creates a model in memory. This model changes in response to your…

1

Manipulate managed and native objects in C++ to show the registry in a WPF TreeView

Last time, we looked at how easy it is to add managed code to your existing C++ application. (Call managed code from your C++ code) The sample below shows a more substantial C++ program which Liberally intermixes both native and managed objects in C++ code for demo purposes. Reads the registry recursively using native C++…

0