Hi Bruce,
Thanks for reply.
I did the search for C# UML as well before posting but that didn't give
links where I can find UML diagram for "c# api" you know. I am not
really looking for UML generation or design features in IDE, I am
looking for diagram of the system api itself :(
But I get what you are saying, it will take time to get used to this
MSDN stuff.
I will keep looking.
Now as we are on this thread, I would ask one more question, actually I
am trying to develop Windows Forms application (not Web.UI stuff), and
I wanted to put LinkLabel in the DataColumn of DataGrid but I am not
able to do so. I got this below link where the guy extended
DataGridColumnS tyle to have combobox but I can't figure out how to put
LinkLabel instead of combobox used there.
http://www.c-sharpcorner.com/winform...ataGridSKJ.asp
The issue with that example code is I have to setup too many things to
run it as its using Sql. I appreciate his sharing but I wish he would
have done it more simplistically to show an example rather than having
those sql things in there.
I copied his code and all and tried to understand by putting Enum
object in combobox but all in vein...though I now understand those
DataSet and all upto some extent. So at the end I decided to extend the
DataGridColumnS tyle to put LinkLabel and copied Paint method from his
code and have mixed things right now. Here is the code which is not
working, :)
namespace TestUIApplicati on
{
public class LinkColumn:Data GridColumnStyle
{
int xMargin = 5;
int yMargin = 5;
private LinkLabel linkLabel;
//
// Create a new column - DisplayMember, ValueMember passed by string
//
public LinkColumn(Link Label linkLabel)
{
this.linkLabel = linkLabel;
}
protected override void Abort(int RowNum)
{
MessageBox.Show (new Form(),"in Abort()");
}
protected override bool Commit(Currency Manager DataSource,int RowNum)
{
MessageBox.Show (new Form(),"in Commit()");
return true;
}
protected override void ConcedeFocus()
{
MessageBox.Show (new Form(),"in ConcedeFocus()" );
}
protected override void Edit(CurrencyMa nager Source ,int
Rownum,Rectangl e Bounds, bool ReadOnly,string InstantText, bool
CellIsVisible)
{
MessageBox.Show (new Form(),"in Edit()");
}
protected override int GetMinimumHeigh t()
{
return linkLabel.Prefe rredHeight + yMargin;
}
protected override int GetPreferredHei ght(Graphics g ,object Value)
{
System.Diagnost ics.Debug.Write Line("GetPrefer redHeight()");
return FontHeight+yMar gin;
}
protected override Size GetPreferredSiz e(Graphics g, object Value)
{
MessageBox.Show ("GetPreferredS ize():"+linkLab el.Text);
Size Extents = Size.Ceiling(g. MeasureString(l inkLabel.Text,
this.DataGridTa bleStyle.DataGr id.Font));
Extents.Width += xMargin * 2 + DataGridTableGr idLineWidth ;
Extents.Height += yMargin;
return Extents;
}
protected override void Paint(Graphics g,Rectangle
Bounds,Currency Manager Source,int RowNum)
{
Paint(g, Bounds, Source, RowNum, false);
}
protected override void Paint(Graphics g,Rectangle
Bounds,Currency Manager Source,int RowNum,bool AlignToRight)
{
string Text = linkLabel.Text;
PaintText(g, Bounds, Text, AlignToRight);
}
private void PaintText(Graph ics g ,Rectangle Bounds,string Text,bool
AlignToRight)
{
Brush BackBrush = new SolidBrush(this .DataGridTableS tyle.BackColor) ;
Brush ForeBrush= new SolidBrush(this .DataGridTableS tyle.ForeColor) ;
PaintText(g, Bounds, Text, BackBrush, ForeBrush, AlignToRight);
}
private void PaintText(Graph ics g , Rectangle TextBounds, string
Text, Brush BackBrush,Brush ForeBrush,bool AlignToRight)
{
System.Console. WriteLine("in paint");
Rectangle Rect = TextBounds;
RectangleF RectF = Rect;
StringFormat Format = new StringFormat();
if(AlignToRight )
{
Format.FormatFl ags = StringFormatFla gs.DirectionRig htToLeft;
}
switch(this.Ali gnment)
{
case HorizontalAlign ment.Left:
Format.Alignmen t = StringAlignment .Near;
break;
case HorizontalAlign ment.Right:
Format.Alignmen t = StringAlignment .Far;
break;
case HorizontalAlign ment.Center:
Format.Alignmen t = StringAlignment .Center;
break;
}
Format.FormatFl ags =Format.FormatF lags;
Format.FormatFl ags =StringFormatFl ags.NoWrap;
g.FillRectangle (BackBrush, Rect);
Rect.Offset(0, yMargin);
Rect.Height -= yMargin;
g.DrawString("m aulin", this.DataGridTa bleStyle.DataGr id.Font,
ForeBrush, RectF, Format);
Format.Dispose( );
}
private int DataGridTableGr idLineWidth
{
get
{
if(this.DataGri dTableStyle.Gri dLineStyle ==
DataGridLineSty le.Solid)
{
return 1;
}
else
{
return 0;
}
}
}
}
}
And here is the method that loads things,
private void Form1_Load(obje ct sender, System.EventArg s e)
{
listBox1.DataSo urce = this.coloursCol lection;
DataSet ds = new DataSet("Colour sSet");
DataTable dt = ds.Tables.Add(" ColoursTable");
dt.Columns.Add( "ColoursColumn" ,typeof(LinkLab el));
LinkLabel ll = new LinkLabel();
ll.Name = "maulin";
ll.Text ="Maulin";
DataRow dr = dt.NewRow();
dr["ColoursCol umn"] = ll;
dt.Rows.Add(dr) ;
GridTableStyle = new DataGridTableSt yle();
GridTableStyle. MappingName = "ColoursSet ";
GridTableStyle. GridColumnStyle s.Add(new LinkColumn(ll)) ;
GridTableStyle. GridColumnStyle s[0].MappingName =
"ColoursTab le";//EDIT ME
GridTableStyle. GridColumnStyle s[0].HeaderText = "test";
GridTableStyle. GridColumnStyle s[0].Alignment =
HorizontalAlign ment.Left;
GridTableStyle. GridColumnStyle s[0].Width = 700;
GridTableStyle. GridColumnStyle s[0].NullText = string.Empty;
dataGrid1.DataS ource = ds;
dataGrid1.DataM ember = "ColoursTab le";
dataGrid1.Table Styles.Add(Grid TableStyle);
}
Please ignore my table,column names and all , its all the code after
much playing around so far and names might not make sense...
Do you have any idea how to do this? If you wish I can repost this same
thing so it appears in people's search as it would be in appropriate
thread...otherw ise somebody might just go into abysmal I am in...:)
Thanks ton for helping.
Regards,
Maulin
Bruce Wood wrote:
I typed "C# UML diagram" into Google and came up with a bunch of
hits.
As well, VS2005 is coming with a bunch of code refactoring and code
design features in it, including (correct me if I'm wrong), UML-to-C#
and C#-to-UML features.
When I moved from Java to C#, it too cost me time and a bit of
frustration getting my head around the MSDN documentation format.
It's now second nature to read the stuff and figure out how to do things.
The only thing I miss is knowing--for sure--which exceptions the
various methods and properties throw. :(