Workspace & Transparency?

Topics: CAB & Smart Client Software Factory
Dec 16, 2007 at 2:32 AM
Hi all,

I have a dock user control (from infragistics) which has it's style set to office 2007 which by default displays a blue-ish background for each pane. In each of the pane, I have various deckworkspaces in which I load various smartparts.

The various views I use all have their background set to transparency as I want them to have the same background color as their pane, but as they are now directly stored on the panes but instead are stored in the deckworkspaces contained in each of the panes, the color does not apply as it takes the background color of the deckworkspace.

I tried to set the deckworkspaces' background color to transparent, but it's giving an error that transparency is not supported by deckworspaces, so my question is, is there a different way to achieve this?

Does this make sense?


Dec 18, 2007 at 5:36 PM

DeckWorkspace does not support transparent BackColor, so what you could do is:
  • Create a new class (i.e.: ExtendedDeckWorkspace) and make it inherit from DeckWorkspace.
  • Modify the constructor as follows in order to make the new control support transparent BackColor:
        public ExtendedDeckWorkspace()
            : base()
            this.SetStyle(System.Windows.Forms.ControlStyles.SupportsTransparentBackColor, true);
  • You should also create a new class (i.e.: DeckWorkspaceSmartPartInfo) that would inherit from SmartPartInfo and add to it this property:
        private Color _backColor;
       public Color BackColor
            get { return _backColor; }
            set { _backColor = value; }
  • Once you have done this, override the OnApplySmartPartInfo() method as follows:
        protected override void OnApplySmartPartInfo(System.Windows.Forms.Control smartPart, SmartPartInfo smartPartInfo)
            DeckWorkspaceSmartPartInfo deckSmartPartInfo = smartPartInfo as DeckWorkspaceSmartPartInfo;
            if (deckSmartPartInfo != null)
                this.BackColor = deckSmartPartInfo.BackColor;
            base.OnApplySmartPartInfo(smartPart, smartPartInfo);
  • Finally, override the OnShow() method to call the OnApplySmartPartInfo() method:
        protected override void OnShow(System.Windows.Forms.Control smartPart, SmartPartInfo smartPartInfo)
            this.ApplySmartPartInfo(smartPart, smartPartInfo);
            base.OnShow(smartPart, smartPartInfo);
Please let me know if this helps.

Ignacio Baumann Fonay
Jan 3, 2008 at 1:18 PM
Hi Ibaumann,

I'm sorry I never set the e-mail notification on this and I didn't realised that someone had got back to me on this. Many thanks.

I'll try it in a bit and will revert back.

Thanks again.

Jan 31, 2008 at 1:11 AM
Hi Ignacio,

My apologies for taking so long to get back to your post.

I've finally got a chance to give it a shot and I've got one comment and one question.

boldComment:bold I must point out that my knowledge in smartclient is still not where it should be and when reading your answer, I got confused when reading from the section "Once you have done this, override the boldOnApplySmartPartInfo()bold method as follows:" as I thought you were talking about adding this to the SmartPartInfo class when in fact it was to be added to the newly created boldExtendedDeckWorkspacebold class. No bad on your part, but I just thought due to my lack of knowledge in smartclient that I highlighted if anyone else was in my position, so they'll be aware of it.

Now, onto my question

What you explain is for deckworkspace to support transparency but what about SCFS dialogboxes?

I call the following to display a view in a scfs dialog box:

WorkItem.Workspaces(Constants.WorkspaceNames.ModalWindows).Show(_batchPropertyPageView, Info)

which turns calls the class WindowsWorkspace. How do I apply the same to this class as the deckworkspace. It also has the

Protected Overrides Sub OnApplySmartPartInfo(ByVal smartPart As System.Windows.Forms.Control, ByVal smartPartInfo As Microsoft.Practices.CompositeUI.WinForms.WindowSmartPartInfo)

which is called when the dialogbox gets created. I've posted a snapshot at so you can see the dialog box problem I'm having. As you can see from the snapshot (, it has that horrible grey border around it. Ideally I'd like to make the back color the same color as my backcolor of my tab but this another day's work as I'll need to get in touch with Infragistics which the third-party tool I use.

Thanks again.

Jan 31, 2008 at 1:12 AM
Sorry about the formatting!! Doooh! I've just coped on how to use it! Ah well, next time...

Feb 4, 2008 at 4:16 PM

To set the BackColor of the dialog window form, I recommend you to try to use the WindowWorkspace class located in the UI folder of the Infrastructure.Library project, together with the WindowWorkspaceSetting class and the WindowSmartPartInfo class (located in the same folder).

  • First, declare a new constant string for the BackColor in the WindowWorkspaceSetting class:
Public Const BackColor As String = "BackColor"
  • Secondly, add the following code to the OnApplySmartPartInfo(ByVal smartPart As System.Windows.Forms.Control, ByVal smartPartInfo As Microsoft.Practices.CompositeUI.WinForms.WindowSmartPartInfo) in the WindowWorkspace class in order to set the BackColor of the form to the one set to the Keys collection in the WindowSmartPartInfo class.
If (spi.Keys.ContainsKey(WindowWorkspaceSetting.BackColor)) Then
                    Windows(smartPart).BackColor = CType(spi.Keys(WindowWorkspaceSetting.BackColor), System.Drawing.Color)
  • Once you have done this, add an instance of this WindowWorkspace class to the RootWorkItem.
  • Add a reference to the Infrastructure.Library project in the module that contains the views you want to display as dialogs.
  • Now, to use this, you must do as follows when showing a view:
Dim oMyView As MyView = WorkItem.SmartParts.AddNew(Of MyView)()
Dim wspi As New MySolution.Infrastructure.Library.UI.WindowSmartPartInfo
wspi.Keys.Add(MySolution.Infrastructure.Library.UI.WindowWorkspaceSetting.BackColor, CType(myView, UserControl).BackColor)
WorkItem.Workspaces(WorkspaceNames.ModalWindows).Show(myView, wspi)
Now, if you are trying to set the BackColor of the Form, I must say that it does not support transparent BackColor. This is a Windows Forms limitation.

Please let me know if this helps.

Ignacio Baumann Fonay