Pages
-
Recent Posts
Archives
Author Archives: Jonathan
C# Snippet for Accessing Bitmap Data with Unsafe Code
Since GetPixel is slow and I keep having to access bitmap data with unsafe code, I thought it would be a nice thing to make into a snippet.
Posted in .net, C#, Programming
Tagged .NET, C#, pixel, Programming, Snippet, unsafe, Visual Studio
Leave a comment
Image.Clone does not unlock the file
Turns out, copying an image using Clone really does make an exact copy. You can’t just open an image, clone it, then safely close it as you might expect, because it also copies the file lock. Instead, copy the image … Continue reading
Posted in .net, C#, Programming, Uncategorized
Tagged .NET, C#, Clone, delete, Image, lock, Programming, unlock
1 Comment
Automatically Fill a ComboBox with an Enum
This is a really nice little feature. If we have an enumerator, say: public enum MyEnumerator { Oranges, Apples, Hedgehogs, Laptops, Budgies, Other } Having a form with a ComboBox called comboBox1, put this in the constructor/form load etc: this.comboBox1.DataSource … Continue reading
Things I can’t code without in Visual Studio
Here’s a quick list of essential plug-ins and tools for Visual Studio. All of them are free, and this is mainly so the next time I reinstall windows I won’t spend ages trying to remember what that thing I use … Continue reading
The DirectSound Capture Buffer
A CaptureBuffer is a buffer of a specified length that reads audio from a Capture object which represents the capture (or input) device, into a one-dimensional array of bytes with a specified WaveFormat.
Posted in .net, DirectSound, Programming
Tagged buffer, capture, capturebuffer, DirectSound, directx, notify
3 Comments
An Explanation of Output Buffers in DirectSound
A DirectSound Buffer is a one-dimensional array of bytes which represent sound waves in a digital form. The data is laid out in a specified Microsoft.DirectX.DirectSound.WaveFormat which specifies the format type, number of channels, number of samples per second and … Continue reading
Posted in .net, DirectSound, Programming
Tagged buffer, DirectSound, directx, primary, secondary
Leave a comment
Number of Selected Items in a Multiple Select Box with jQuery
With the html: <select name=”my_list” multiple=”multiple”> <option value=”one”>1</option> <option value=”two”>2</option> <option value=”three”>3</option> <option value=”four”>4</option> <option value=”five”>5</option> </select> One way to find the number of options selected: $(“select[name='my_list']>option:selected”).length
TextRenderer is slow, DrawString is wrong
After struggling with WinAPI code and hacks in .NET 1.0 I was really looking forward to the TextRenderer class when I first heard about it. But as it turns out, not only is TextRenderer horrible at measuring character size it … Continue reading
Posted in .net, C#, Programming
Tagged .NET, api_functions, drawing, DrawString, google, hacks, Programming, string_array, TextRenderer
1 Comment