Friday, February 02, 2007

Of TreeView Nodes and their Fonts


If you ever happen to change (upgrade) the font (increase font size or make the font bold) of a node (Class TreeNode) in the TreeView (System.Windows.Forms.TreeView) and run your program, you will be sorry because the label of your node gets clipped!

The only way to work around this is apparently to set the font of your TreeView to the worst case condition; i.e. if you want to make some of the nodes bold then set the font to be bold. Change the font (from Bold to Regular) of the nodes when you actually add the nodes to the treeview.

Here is a quick example -

'Windows form designer generated code

'TreeView Initialization. I only want the root node to be bold, but I set the default FontStyle to Bold

Me.tvwItems.Font = New System.Drawing.Font _

("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))

Private Sub AddNodestoTreeView()

'Create font object to change FontStyle of the nodes other than the root node

Dim Font As Font

Font = New Font(tvwItems.Font, FontStyle.Regular)

'Child nodes added

'Change FontStyle for the nodes other than the root node

CurNode.NodeFont = Font

End Sub

I’d appreciate your inputs on smarter workarounds to this.

TIA!

Thursday, February 01, 2007

A Case for ClearCase


I think I am beginning to like ClearCase; it is - smart enough to do the things that I want it to do, ‘not-so-simple’ that I take its rate its simplicity as dumbness and cryptic enough to have me spend hours researching to find a solution when I am stuck. I quite enjoy the digging it requires me to do; hopefully it is the learning curve that I am slowly conquering. The journey hasn’t been smooth, just when I think things are rolling, I am faced with a quirky problem. I probably should have documented my notes much earlier, for better clarity and accuracy, oh well; here they are for your consumption anyway.

I use Rational ClearCase Explorer 2003.06.10+. I use ClearCase as the version control and change management solution for my VS.NET projects.

ADDING A VS.NET PROJECT TO SOURCE CONTROL –

  1. This is THE recommended way to add .NET project to source control.
  2. If a project has already been added to source control through some other method, then it is advisable to change the source control mechanism ASAP. To do so select the solution/project in the .NET explorer and click on File-> Change Source Control. In the window that appears select the rows and click Bind. The Connected column status for each row should appear checked and the Status column should display Valid after a successful Bind operation.
  3. The .suo and .vbproj files will NOT be added to source control if the recommended method of adding to source control is followed. These defaults should not be changed.
  4. Some ClearCase specific files will be added to ClearCase after this operation. It should be ensured that these files are not moved or deleted.

The next thing that you need to know to use ClearCase is writing config. specs. Unfortunately, I have not found a comprehensive guide that helps with writing config. specs. Do you know of any? Pl. point if you do…

THE EARLY HURDLES -



If you are working with a dynamic view you are likely to view the error above. To get past this hurdle, you will need to change the security settings of your machine. Alternatively you could switch to snapshot views.

CHANGING SECURITY SETTINGS OF YOUR MACHINE

  • Start the .NET Configuration 1.1 tool
  • Double click on Mscorcfg.msc in C:\WINDOWS\Microsoft.NET\Framework\V1.1.4322.
  • Double click on Microsoft .NET Framework 1.1 Configuration by going to Start->Control Panel->Administrative Tools.
    • Click on Runtime Security Policy. Then click on Increase Assembly Trust. Select “Make changes to this computer” and click next. Browse to . Click on open. Click next. Move arrow to Full Trust. Click next. Click Finish. Select “Adjust Zone Security”. Select “Make changes to this computer” and click next. My Computer and Local Intranet should have Full Trust selected. Click Next. Click Finish. Exit window. Restart computer.

    If not done correctly, you might get rid of the above mentioned error, but your code will break on you with the exception below. Time to re-trace steps and make sure security settings are set correctly. (To be honest, I don’t recollect the exact sequence of operations that led to this error.)



    ACCESS DENIED ERROR –

    To fix this, you will need to download and install the hotfix says Microsoft.

    If you are a command-line person, you will probably like to execute ClearCase Commands by clicking -

    Start->Run->cmd

    Hit Enter




    LINKS –

    ClearCase Commands1

    ClearCase Commands2

    ClearCase Book

    VS.NET metadata files