End of day 3, and yet again another “late” finish, with me finally putting it to rest at 1.30am :)

Today was interesting, I decided to see what I could come up with for the user interface (Mainly the form aesthetics, not the controls inside it) and remembered something called AlphaBG I had seen a while back but never got around to trying.

So I came up with a pretty nice design (In my opinion, heh) in Photoshop and used that with the AlphaBG class to create a layered alpha-blended form. Here was the original program.cs code.


frmMain frmMain = new frmMain();
AlphaBG frmMainBG = new AlphaBG(Properties.Resources.ClipboardManager, frmMain, AlphaBG.Settings.DrawControls | AlphaBG.Settings.MovementFade);
Application.EnableVisualStyles();
Application.Run(frmMainBG);

Then the problems started… After I had implemented AlphaBG, my form no longer seemed to be able to respond to Clipboard messages, although it was receiving some messages as a few Console.WriteLine calls confirmed.

After two hours of head scratching, it turns out that after creating an instance of the AlphaBG class and passing it my frmMain,the Handle of frmMain changes, causing it to no longer be classed as a registered Clipboard Viewer (Since it gets registered as a Clipboard Viewer in the constructor… when it’s Handle is in it’s original state).

The solution, was to remove the Clipboard Viewer registration from the constructor and into it’s own public method, and then call this method after the instance of AlphaBG has been created, and thus after the frmMain’s Handle has been changed. The code then becomes:


frmMain frmMain = new frmMain();
AlphaBG frmMainBG = new AlphaBG(Properties.Resources.ClipboardManager, frmMain, AlphaBG.Settings.DrawControls | AlphaBG.Settings.MovementFade);
frmMain.RegisterAsClipboardViewer();
Application.EnableVisualStyles();
Application.Run(frmMainBG);

After that, all was back to normal again :)

Here is a picture of the applications new design, the DataGridView control will most likely be changed but for now it will do for prototyping purposes.

Clipboard Manager

So until next time!

Add This!