PhotoShop-Like ToolBox in VB.NET

Grafix

Member
Joined
Sep 13, 2006
Messages
10
Location
Singapore
Programming Experience
Beginner
Hi friendz,

I've been using Adobe's PhotoShop since version 5.0LE till today, now am in programming field and want to imitate their interface in my final year project.

Now I create an MDI application "like Photoshop" with menubar taht opens child forms. I want to add a ToolBox like the one in PhotoShop but my tool box will only cotain Icons and/or text that will trigger my forms not brushes and merquee toool:)

Can anyone help me if its possible in VS.NET 2003.

tnx n your help is really appreciated.
 
What you are describing is a fairly simple collection based control. Just imagine a toolbar that is docked to the side of the form as opposed to the top. There quite a bit of work involved but i'd be happy to walk you through it, and by the end we should have something that looks reasonably like what you want. So... how far have you got?
 
I tried a bit :)

Thanx 4 prompt reply vis, :)

I've no idea on hw to change the docking orientation of the ToolBar. I'd be most greatfull if you can help me through this coz am really curious to differentiate my project from others.

Though, after staring this thread, I tried a bit to create a form with disabled menu controlls, TopMost=True, with buttons to call the forms, all inside single MDI. but it look crappy:p as compared with that of PhotoShop.

Hop u can help me with s'thing more professional:cool:.

twice again, tnx ...
 
Ok, well how about we forget about modifying the built in toolbar and instead we'll build one from scratch? Are you up to the challenge??:)

It will be a good tutorial for anyone who wants to know how to create collection based controls with rich design time support and you'll get what you want in the end, everyone's a winner in my book.

Plus you'll have something that no-one else will!!!

Step 1:

Create a new solution in VS and add a new windows control library to the solution and also add a standard windows application as well. Delete the custom control that is automatically added to the library project and add a new class... this is the point where you get to name your new control, call what ever you like...

Your class should now look like this...


VB.NET:
Imports System.ComponentModel
Imports System.Drawing
Public Class 'Whatever you want to call it
Inherits System.Windows.Forms.Control


Public Sub New()

'I haven't used these for a while but as I remember we can treat 
the controlstyles enum as a set of bit flags and set them like this. 
What we are doing here is telling the base class that we want 
our control doublebuffered to reduce flicker when repainting, 
AllpaintingInWm_Paint tells our base class to intercept the 
WM_EraseBackground message, and the userpaint bit 
tells our base class that we want our control to handle it's own painting.

Mybase.Setstyle(ControlStyles.DoubleBuffer Or _ 
ControlStyles.AllPaintingInWM_Paint Or ControlStyles.UserPaint, True)

Me.Dock = DockStyle.Left

End Sub
'We can put all this in a partial class if we wanted to but to be honest it's out of the scope of this tutorial.

Now's a good a time as any to build the project, add our control library project as a reference in the windows application but add it as a project reference. Then customize the toolbox browse to the folder where our new .dll is stored double click it and you will then see your new control in the toolbox. Drag it onto the form and voila, you will see practically bugger all, just a square block. The reason we do it likethis is becuase now any changes you make to our new control will be reflected directly to that control on the form every time we re-build the project. Now the fun begins...
 
Just noticed that you are usng VS 2003 So OptimizedDoubleBuffer won't be there but DoubleBuffer will so i've changed my previous post to reflect that.
 
Back
Top