Resizing WindowWorkspace

Topics: CAB & Smart Client Software Factory
Jan 11, 2007 at 8:31 AM
Hello everybody!

I'm developing an application wich needs to show some smartParts into WindowWorkspaces. Someone knows how to resize the workspace to fit the SmartPart that it shows and how to fix the windowworkspace's border for avoiding user to resize the window?

Thank's a lot for your attention.
RoTTeN
Jan 11, 2007 at 6:55 PM
You need to use a WindowSmartPartInfo object. What you do is create one of these objects, and then set properties like width, height, location, buttons, etc. on the WindowSmartPartInfo object. Then when you call MyWindowWorkspace.Show(), pass in the info object as a parameter. There is help available in the CAB help file for this.
Jan 12, 2007 at 6:43 AM
Hello again!

I have had done it this way, but in the WindowSmartPartInfo object I didn't found any property/method to avoid user resizing the window, like a FixedBorder property or Dock or Autosize method.

Thanks a lot
Jan 15, 2007 at 6:44 PM
You are correct, the WindowWorkspace and associated WindowSmartPartInfo object has some limitations. If you want to do anything beyond the basics, you will probably have to create your own Windows.Forms.Form object to gain full control. I talk a little bit more about this issue in this thread:

http://www.codeplex.com/smartclient/Project/DisplayThread.aspx?ForumId=3111&ThreadId=3264&ANCHOR#LastPost
Jan 17, 2007 at 7:13 AM
Thanks a lot for your help

RoTTeN
Jan 21, 2007 at 9:29 AM
- "You are correct, the WindowWorkspace and associated WindowSmartPartInfo object has some limitations. If you want to do anything beyond the basics, you will probably have to create your own Windows.Forms.Form object to gain full control."

For those that don't have the time to check the other thread, take the time to learn how to override WindowSmartPartInfo, and you can add whatever attributes you like. You absolutely do not need to, and should not use Windows.Forms. The whole point of CAB of a composite series of SmartParts, as soon as you add a Windows Forms, you're removing the 'Composite' in CAB. You might as well not be using it.

Jan 21, 2007 at 3:54 PM
I'm guessing that's in there for the Mobile Smart Client Software Factory, as Compact Framework has many limitations that using separate forms can get around.
Jan 22, 2007 at 4:10 AM
quote
You absolutely do not need to, and should not use Windows.Forms. The whole point of CAB of a composite series of SmartParts, as soon as you add a Windows Forms, you're removing the 'Composite' in CAB. You might as well not be using it.
/quote

I came across this post while trying to answer this exact question: Why shouldn't I use a Form for my modal dialogs? I use the MVP recipe, then change my SmartPart to inherit from Form instead of UserControl. This has worked fine for me. The fact that there IS a WindowsWorkspace and threads like this one makes me really want to understand WHY I shouldn't use a Form and rather use a WindowWorkspace.

I would really appreciate it if someone could shed some light on this for me.

Also, as for the original post: You want to set the border style to FixedToolWindow (or something like that) - check the bank branch example, I think it shows how to do this.

-Steve