|
I'm sure many of you have experimented with the code commenting features in C#. For those of you who haven't it works like this - above a function you can place some code comments using a special identifier "///" in xml format, like this:
/// <summary>
/// Logs the user into the system
/// </summary>
/// <param name="UserName">User's name</param>
/// <param name="Password">User's password</param>
/// <returns>Boolean value indicating success (true) or failure (false)</returns>
/// <exception cref="LoginException">User name or password was incorrect</exception>
The C# compiler provides you with the option to generate an xml file containing all of these comments in a nicely structured format. VS.NET provides a utility to generate web pages from this xml file. These web pages are rather nice, and could be bundled into a .chm file for distribution. However, this tool doesn't generate pages of the same quality as msdn. The pages look pretty yukky and only certain info is included - for example exceptions are not shown, which is a problem as consumers need to know what exceptions might be thrown.
So after that whole essay - does anybody know of a tool which can generate nice documentation (up to the standard of msdn), and then package that documentation automatically into .chm files? If not, would this be a valuable article? If so, would somebody be willing to collaborate with me on this effort?
Cheers
|
|
|
|
|
Take a look at nDoc, it has an option to produce output almost exactly like MSDN
James
Simplicity Rules!
|
|
|
|
|
James!
You don't know how much easier you have made my life; nDoc is EXACTLY (a good start anyway) what I was looking for...
Thanks,
Neil A. Van Note
|
|
|
|
|
>>nDoc is EXACTLY (a good start anyway) what I was looking for...
I concur, thank you James!
Is a society built on greed better than a society built on survival?
|
|
|
|
|
How can I create an outlook bar in C#, is it very complicate ?
BTW i don't know if it's only a problem with my VS .NET version ( I Have full release) but the splitter control seems to have a bug, anybody can help me on this ?
|
|
|
|
|
Its going to be as complicated as creating it with any other toolkit :-P
What is your problem with the splitter?
James
Simplicity Rules!
|
|
|
|
|
But how can I create one Outlook Bar ?
Splitter = why this control have to be docked somewhere to work ? in VC++ you can place it anywhere on the screen no ?
Thanks J
|
|
|
|
|
Creating one is a bit different, but might not be too hard to do. Essentially each pane in the outlook bar consists of a Panel, a Button, and a List View set in Large Icon or Small Icon mode.
Instead of a list view you can also create your own control which uses flat buttons instead.
Clicking on a button tells the outer-most control that it needs to move the panels above to the top so only the button can be seen, and move the panels beneath the one selected to the bottom (changing the height of the panel so as not to obscure the other buttons). Then resize the panel that was clicked on so that it fills the rest of the area (DockStyle.Fill )
Off the top of my head anyway
If I get around to it I may actually write an Outlook Bar component someday
MFC differs a bit from .NET because it doesn't have any builtin layout engine. In .NET you get some aspects built in, which is why I think it requires docking. Usually though docking isn't a problem, you just have to figure out the combination of splitters and other controls to get it to look the way you want.
James
Simplicity Rules!
|
|
|
|
|
k I think I got it.
BTW I have another question how can I create a custom control on C#, I search over MSDN but I didn't got good result. The example in the .NET show us how create a user control make from existing control like a panel with 3 buttons and this will be a futur control I can use. But what I want to do it's to create a control by the beginning at the drawing stage or derived an existing one.
Do you have good tutorials for this or reference anything which I can use to help me ??
Thanks Again James
Jonathan
|
|
|
|
|
To create your own control simply create a new class and derive from System.Windows.Forms.Control; or in VS.NET choose to add a new item and choose Custom Control from the box.
You can then handle the events you want (overriding OnPaint is going to be one of them )
Here's a simple control that creates a very lightweight label
using System;
using System.Drawing;
using System.Windows.Forms;
public class LightLabel : System.Windows.Forms.Control
{
public LightLabel() : base()
{
}
public override void OnPaint(PaintEventArgs e)
{
Brush textBrush = new SolidBrush(ForeColor);
Brush background = new SolidBrush(BackColor);
Graphics g = e.Graphics;
g.FillRectangle(background, Bounds);
g.DrawString(Text, Font, textBrush, Bounds);
textBrush.Dispose();
background.Dispose();
}
} I didn't actually compile the code but that is the general idea behind creating your own control. You'll also want to look at the ControlPaint class for lots of cool drawing effects you find on controls (the etched border, drawing a 'disabled' image, etc).
If you want to get really fancy with your control you'll need to look at Designers which is something I haven't looked at in-depth yet.
James
Simplicity Rules!
|
|
|
|
|
I had a similar problem with a Toolbar - I did not want it locked so I put this in the Constructor after it initializes eg DockStyle.None . This is possible but you can forget about using the designer as it will not understand that the component is no longer docked and other coomponents eg a fill component will overwrite it so I had to use Dock to Bottom for the Fill Panel.
Ben
|
|
|
|
|
i send a RowData object from a DataSet (dataset.getTable().Rows[x]) to a form that then displays that row in unbound controls. That form has a navigate forward and back button.
how do i find out the row's index in a dataset so that i may 'movenext' or even iterate from that point? the problem is that the form does not know the row index and it cannot call back to the owner form.
burnt
|
|
|
|
|
You'll have to somehow pass the row index to the child form.
I would work with the DataTable object in the child form, then you could do your iteration through that, as well as add new rows to the table. You can get the DataTable object from the DataRow object by the DataRow's Table property.
James
Simplicity Rules!
|
|
|
|
|
but i dont have the index and can not change the api i am using.
the question is, and remains, how do i get the index of a row in a dataset given a DataRow object, and a DataSet object, and NOT the index of the current RowData object.
if i can say dataset.Table().rows[20] and get a DataRow object, shouldnt i be able to easily code dataset.Table().rows[_row.rowID + 1] ?
the rowID property shows up in the watch window, but why is private? how do i get to it?
|
|
|
|
|
Hi,
I'm wondering if it is possible to save an instance of a class to a file (as is) and vice versa.
I have a class that can contain about 2000 ethernet packages. I would like to save this entire class to a file, but also be able to open it again for later use. Something like: MyClass = (MyClassType)FileStream ???
Any ideas??
G
|
|
|
|
|
You need to look at something called serialization.
Heres a simple example
using System;
using System.Runtime.Serialization.Formatter.Binary;
using System.IO;
[Serializable()]
public class MyClass
{
public int MyInt;
private int privateInt;
public MyClass(int pub, int pri)
{
MyInt = pub;
privateInt = pri;
}
public void PrintOut()
{
Console.WriteLine("MyInt = {0}, privateInt = {1}", MyInt.ToString(), privateInt.ToString());
}
}
public class Driver
{
public static void Main()
{
MyClass myClass = new MyClass(4, 2);
FileStream stream = new FileStream("C:\\myclass.bin", FileMode.CreateNew, FileAccess.Write);
IFormatter formatter = new BinaryFormatter();
formatter.Serialize(myClass);
stream.Close();
myClass = null;
stream = new FileStream("C:\\myclass.bin", FileMode.Open, FileAccess.Read);
myClass = (MyClass) formatter.Deserialize(stream);
stream.Close();
myClass.PrintOut();
}
} If you want to customize what is saved in the serialization process refer to the documentation on the ISerializable interface
HTH,
James
Simplicity Rules!
|
|
|
|
|
With File.GetLogicalDrives() I can get name of drives,but how can I check if they are CD-ROM or Floppy drives?
Mazy
"The path you tread is narrow and the drop is shear and very high,
The ravens all are watching from a vantage point near by,
Apprehension creeping like a choo-train uo your spine,
Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
|
|
|
|
|
Mazy,
Someone has already written a detailed article about this here on CP. Here is the link:
DriveComboBox
HTH
Nick Parker
|
|
|
|
|
Thank you,I'll check it as soos as I go home.
Mazy
"The path you tread is narrow and the drop is shear and very high,
The ravens all are watching from a vantage point near by,
Apprehension creeping like a choo-train uo your spine,
Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
|
|
|
|
|
I have a file and waana check if it has ReadOnly attribute,if its true change it to write in it. I use this code:
if(File.GetAttributes(filename) == FileAttributes.ReadOnly)
File.SetAttributes( filename , FileAttributes.Normal );
FileStream myfile = File.Open( filename ,System.IO.FileMode.Open , System.IO.FileAccess.ReadWrite );
But when it reached to readonly file it does not change the ReadOnly attribute.
Mazy
"The path you tread is narrow and the drop is shear and very high,
The ravens all are watching from a vantage point near by,
Apprehension creeping like a choo-train uo your spine,
Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
|
|
|
|
|
Try this instead
if( (File.GetAttributes(filename) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly )
James
Simplicity Rules!
|
|
|
|
|
Thank you,I'll check it as soos as I go home.
Mazy
"The path you tread is narrow and the drop is shear and very high,
The ravens all are watching from a vantage point near by,
Apprehension creeping like a choo-train uo your spine,
Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
|
|
|
|
|
Anybody knows how to attack F1 Help with the controls in C#? Example if you press F1 in a Text Box a message pop up with the help text.
|
|
|
|
|
Use the HelpRequested event (HelpEventHandler is the delegate instead of HelpRequestedEventHandler).
James
Simplicity Rules!
|
|
|
|
|
Hello, i was wondering if there are functions to deal with the AVI in C# like CAVIEdit in C++, functions like AVIFileOpen,.......
Thanx in advance
|
|
|
|