Tuesday, August 24, 2010

C# WPF Button Blink Problem

In a WPF application, if a button is clicked, the focus gets put on that button.

Sometimes this will cause the button to constantly blink.

In order to stop the button from blinking, some solutions say to put the 'focus' onto another button.

I think, a cleaner way, is to set the 'Focusable' property to false.  This doesn't seem as 'hacky' as setting focus to another button, and still fixes the problem.

Wednesday, August 18, 2010

HTML 5 Canvas

I wanted to put some HTML 5 Canvas stuff down.

Since HTML 5 is not finalized, some of this stuff might change.

There are a few gotchas that you will need to look out for.

HTML 5 is NOT XHTML.  This means that XHTML standards don't apply.  Attributes do not need quotation marks around values.  Element tags do not need to be closed.  These things are good ideas, but you do not need them.


CANVAS.  Man.  So, if you want to [STYLE] a canvas, there are some things you need to look out for.
To set the "WIDTH" and "HEIGHT" you need to set the "WIDTH" and "HEIGHT" attribute, not the "STYLE".  For instance, instead of style="width:20px; height: 20px;", you set attributes in the tag; like [ width="20" height="20" ].

Tuesday, August 17, 2010

Javascript Charts

This site is full of javascript chart websites.

http://www.articlediary.com/article/25-graph-chart-solutions-for-web-developers-277.html

Don't know if all are good, but www.highcharts.com is awesome.

Thursday, August 5, 2010

C# Stop Form Resize

An easy way to stop a C# WinForm from resizing is to set the 'FormBorderStyle' to any 'Fixed*' property.

(e.g. Fixed3D, FixedSingle, etc).

Tuesday, August 3, 2010

C# Forms Stop Redraw/Paint

I've tried to stop the 'Paint' event on a C# WinForm without overriding the 'Paint' event.

I've done some research and found a lot of people have this problem, but those problems can be easily fixed using the 'DoubleBuffered' property found on the form itself.  The main problem fixed by 'DoubleBuffered' is that the form flickers.

This is not my problem.

I want to stop the 'Paint' event of a 'TreeView', while I expand all the nodes.  This is important when there are many nodes in the tree.  If you 'Paint' while expanding, the form becomes unresponsive and ugly.

The only solution that I can come up with, is to 'Hide()' the control, expand the nodes, then 'Show()' the control again.  I tried this with the 'Form' itself, but it didn't seem natural.  By performing the operation with the control, it's tough to tell if the control is redrawing, or the nodes are just being added.

While this is a 'hacky' solution, I don't know any other way.

BTW: SuspendLayout() => ResumeLayout() doesn't stop the 'Paint' event.