Archive for August, 2009

Exposing Inner Control Event in WPF UserControl

// August 16th, 2009 // 10 Comments » // Programming

When you have controls inside your custom UserControl you can’t call directly to any controls inside user control in WPF. There’s a way to expose them.. First you can add RoutedEvents to a custom control you can declare a public static RoutedEvent in your class and use EventManager.RegisterRoutedEvent() method to register these events. EventManager.RegisterRoutedEvent() has some parameters: the event name, routing strategy, type of RoutedEventHandler and type of the custom control.

(more…)

Acessing WinAPI from C#

// August 16th, 2009 // 2 Comments » // Programming

The Windows API, informally WinAPI, is Microsoft’s core set of application programming interfaces (APIs) available in the Microsoft Windows operating systems. It was formerly called the Win32 API; however, the name Windows API more accurately reflects its roots in 16-bit Windows and its support on 64-bit Windows.

When declaring APIs in C#, use the following syntax:

using System.Runtime.InteropServices;

...

[DllImport( dll_filename )]
[public|private] static extern ret_type function( [type para, ...] );

(more…)

Unsafe in C# and Image Processing

// August 15th, 2009 // 1 Comment » // Programming

From my last projects, I write many custom class to manipulating image. Today I will share basic code to write C# code when you focusing on Image Processing.

When I use Bitmap function GetPixel and SetPixel, oh.. .NET is bad for Image Processing.. and that’s not 100% right. We still have pointers on C# like on C++. To use it just go to Project->Properties->Build than check “Allow unsafe code”.

Now, go ahead and try to understand how to use unsafe code in C# and implement it on Image Processing.
(more…)

Kohonen for Motion Estimation

// August 15th, 2009 // 1 Comment » // Research

Kohonen for Motion Estimation i’ts my fiinal project research on D4 PENS-ITS, actually it has full name “Neural Network for 3-D Motion Estimation from Sequential Image Frames in Drum Game”. Thanks for Nana Ramadijanti, S.Kom, M.Kom and Rizky Yuniar Hakkun, S.Kom as my lecturer that help me finish this project on time.
(more…)

Serialize Collection of Object in C#

// August 14th, 2009 // 2 Comments » // Programming

Today i’ve create a simple project… finally I find way to serialize collection of object in C#.

As luck would have it, most of the types found within the System.Collections and System.Collections.Generic namespaces have already been marked as [Serializable]. Therefore, if you wish to persist a set of objects, simply add the set to the container (such as an ArrayList or a List) and serialize the object to your stream of choice. Other choice is make a class that inherits from collection…

first we can create a simple SoundData class like this :

[Serializable]
public class SoundData
{
   private int soundId;
   private string soundName;

   public int SoundId
   {
        get { return soundId; }
        set { soundId = value; }
    }

   public string SoundName
   {
        get { return soundName; }
        set { soundName = value; }
   }

   //You will get error if you miss this constructor ^_^
   public SoundData()
   { }

   public SoundData(int soundId, string soundName)
   {
       this.soundId = soundId;
       this.soundName = soundName;
   }
}

(more…)

PHVsPjxsaT48c3Ryb25nPndvb19hYm91dDwvc3Ryb25nPiAtIDwvbGk+PGxpPjxzdHJvbmc+d29vX2Fib3V0bGluazwvc3Ryb25nPiAtICM8L2xpPjxsaT48c3Ryb25nPndvb19hZHNfcm90YXRlPC9zdHJvbmc+IC0gZmFsc2U8L2xpPjxsaT48c3Ryb25nPndvb19hZF9pbWFnZV8xPC9zdHJvbmc+IC0gaHR0cDovL3d3dy53b290aGVtZXMuY29tL2Fkcy93b290aGVtZXMtMTI1eDEyNS0xLmdpZjwvbGk+PGxpPjxzdHJvbmc+d29vX2FkX2ltYWdlXzI8L3N0cm9uZz4gLSBodHRwOi8vd3d3Lndvb3RoZW1lcy5jb20vYWRzL3dvb3RoZW1lcy0xMjV4MTI1LTIuZ2lmPC9saT48bGk+PHN0cm9uZz53b29fYWRfaW1hZ2VfMzwvc3Ryb25nPiAtIGh0dHA6Ly93d3cud29vdGhlbWVzLmNvbS9hZHMvd29vdGhlbWVzLTEyNXgxMjUtMy5naWY8L2xpPjxsaT48c3Ryb25nPndvb19hZF9pbWFnZV80PC9zdHJvbmc+IC0gaHR0cDovL3d3dy53b290aGVtZXMuY29tL2Fkcy93b290aGVtZXMtMTI1eDEyNS00LmdpZjwvbGk+PGxpPjxzdHJvbmc+d29vX2FkX3VybF8xPC9zdHJvbmc+IC0gaHR0cDovL3d3dy53b290aGVtZXMuY29tPC9saT48bGk+PHN0cm9uZz53b29fYWRfdXJsXzI8L3N0cm9uZz4gLSBodHRwOi8vd3d3Lndvb3RoZW1lcy5jb208L2xpPjxsaT48c3Ryb25nPndvb19hZF91cmxf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