Saturday, September 26, 2009

Antialiasing graphics GDI+ in .NET

Was looking for this.
All you need to do is set the smoothing mode on your graphics object :

g.SmoothingMode = SmoothingMode.AntiAlias;

Thats all folks. Enjoy!

Thursday, September 24, 2009

Passing Large Arrays (Lists) Via WCF

Was getting the error "The underlying connection was closed: The connection was closed unexpectedly" when passing arrays from large datasets to the client.

This is the solution:

Basically requires adding the following to both the server and the client config files (web.config / app.config)

<dataContractSerializer maxItemsInObjectGraph="2147483646"/>

Wednesday, September 23, 2009

Best Feature of C# 4

Optional Parameters. For real ... C++ had it ... python had it...... Excel required it (which meant that when using excel COM via c# you need to lookup the documentation and put in the default values yourself...) and .. VBA (and therefore had it. Sure you had function overloading.... but still this is more fun!

Details of how it works here:


Sunday, September 20, 2009

Learning videos for expression suite

I simply admire the Expression Teams effort. Like all microsoft products soon after the release you will find tons of useful video tutorials. For Expression suite you can find them here:


Thursday, September 17, 2009

VSTO video tutorials

Here are two great videos from microsoft about the VSTO in VS2008.

Taking Office Development to the Next Level
The second url is from the entire sequence of VS2008 videos :

Monday, September 14, 2009

Setting up validation with DevExpress XtraEditors combobox

DevExpress gives a lot of features for the amount of money that you are required to spend. Fact. I like the way everything looks so consistent.

So generally for all controls:
  • Drag and drop DxValidationProvider onto your form.
  • Click the provider.
  • Set validation mode to manual.
  • You will also be get a smart tag for "Customize Validation Rules"
  • Select your control and setup the validation rules.
  • When you want to validate (e.g. on OK button) use something like the following code:
this.DialogResult = DialogResult.OK;

Done :)

Now for setting up a combobox with valid values as no values along with a list do the following:
  • Select your combobox
  • In its properties expand the properties section.
  • set your selectables in its items collection (with a blank newline as the first line for the empty string)
  • Delete its edit value
  • Launch its validation editor (from DxValidationProvider).
  • Set "Contition Validation" along with "Conditional Operator" as "AnyOf". Edit the values and paste the same items as you did in the items collection.