|
I am not going to try to take credit here, and will just link to the article.
I thought it was funny how the Standard Edition would not let me make a windows controls library project, but it is fully possible in SharpDevelop using just the SDK compiler.
I did some googling, and this article came up.
http://www.devcity.net/net/article.aspx?alias=vbnet_se_dll
A great find, and I can finally make Dll user control libraries in the standard edition as well.
PS! although the article is for VB, I have testet it with C# myself, and it works great.
Enjoy!
HalfAsleep
|
|
|
|
|
You can make a Windows control library - there's just to project for it (a template of files and settings). Just start a regular class library and add a class that derives from a control. There's no difference other than the base classes from which your classes derive.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Ah, nice to get that confirmed. I was a bit miffed that the standard version did not have that project template.
If a normal class library template will do, and everything will work as long as you have classes that inherit from controls, that is good news indeed.
Thanks a bunch!!!
By the way, is there any way of adding your own project templates in the "new project" dialogue?
HalfAsleep
|
|
|
|
|
Explore your Visual C# installation directory. The default is C:\Program Files\Microsoft Visual Studio .NET 2003\VC#. There's several directories involved and it's really not too difficult to figure out, but I believe you might find some articles here on CodeProject and elsewhere on the 'net if you try a search.
There is one tutorial in the Visual Studio .NET Product Documentation, but it's targetted at the Enterprise Architect edition which include a project for making projects (it's fairly close to what you need, though).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Anyone know anything about reading the game port in C# ?
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Man, Chris, you write so much interop code and unsafe code (remembering your previous articles about graphic manipulation), you should just use C/C++, or at least switch to MC++!
Have you looked into Managed DirectX at all at http://msdn.microsoft.com/directx[^]. Much of this is encapsulated in a nice object-oriented fashion (and the Managed DirectX libraries are written from the ground-up, not simply interop libraries or 1-to-1 mappings of managed code like some libraries).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Heath Stewart wrote:
or at least switch to MC++!
*grin* I hate the idea of MC++, as far as I am concerned, it's useful only for porting code to .NET. Otherwise, I may as well use the language that was written for .NET. Plus, C# is actually full of some really cool stuff.
Heath Stewart wrote:
Have you looked into Managed DirectX at all at http://msdn.microsoft.com/directx[^]. Much of this is encapsulated in a nice object-oriented fashion (and the Managed DirectX libraries are written from the ground-up, not simply interop libraries or 1-to-1 mappings of managed code like some libraries).
Yes, I am using it. The AudioVideoPlayback namespace is an utter disaster. It occured to me after posting though that it would probably be the way to go for the joystick, DirectInput and all. I just need to make sure we wire our device the same as a joystick, so I get the right messages
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
If you don't want to use DirectX you could also interop the joy* Win32 functions.
There are just a few and they're really easy to use. Basically you call joySetCapture and then start receiving MM_JOY1MOVE , MM_JOY1BUTTONDOWN and the other joystick messages in your overridden WndProc .
The only disadvantage is that WindowsXP messed up the joySetCapture /joyReleaseCapture functions. Trying to open a Joystick a second time in your application (after releasing it first, of course) fails with some obscure error, but only with WindowsXP.
Hope this helped,
mav
|
|
|
|
|
Couple of questions about ListView:
Is there a way to make column headers invisible?
Is there a way to increase the padding between rows?
I have long text inside of some cells. How do I make the text wrap around and the cell height grow to make all the text visible? (instead of having the text all in one line and having to resize the column to read all of it.)
Thanks,
Elena
|
|
|
|
|
The first is simple: set ListView.HeaderStyle to ColumnHeaderStyle.None .
For the latter, I urge you to search CodeProject for "ListView" or something simple and browse the results. There have been several articles detailing this. It's not an easy thing to handle, since you have to go back to handling windows messages, declaring structs, and interoperating with unmanaged code using P/Invoke for functions like SendMessage .
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Is there any way to access and delete cookies obtained by the Microsoft Web Browser Control?
|
|
|
|
|
You need to P/Invoke InternetGetCookie :
[DllImport("wininet.dll", CharSet=CharSet.Auto, SetLastError=true)]
static extern bool InternetGetCookie(string url, string name, [Out] string data,
ref int size); Do not declare the third param using out , be sure to use the OutAttribute as I've done above. A String (C# alias string ) is already a reference type, so you're already passing the address of a string variable. Double referencing will crash the CLR.
To call it, consider a wrapper method since P/Invoke methods should not generally be exposed as public members (depending on if you're writing a library or just using this in an app):
public string GetCookie(string url, string name)
{
int size = 0;
string data = null;
if (!InternetGetCookie(url, name, null, ref size))
{
if (Marshal.GetLastWin32Error() == 122)
{
data = new string('\0', size);
if (InternetGetCookie(url, name, data, ref size))
return data.Trim();
}
}
return null;
} You'll still need to parse the cookie string, though, but that should be simple.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Once I got the cookie, do you know what I would have to do to delete it? Also, let's say I wanted to return all cookies for a specific website. I understand I pass in the homepage of the website as "url", but what do I pass in for "name"? Thank you
|
|
|
|
|
I recommend you read about the WinInet Functions[^] on MSDN Online.
If you want to know more about InternetGetCookie , you should read[^] about it on MSDN Online as well, which is under the WinInet Functions that I posted a link to above.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
hi you all
im working on a paint project and i need some help with the rectangle select tool. id appreciate all the help i can get...
|
|
|
|
|
What help do you need ? I've got a paint program here on CP called Doodle which may have the tool you're looking for. I can't remember, but I suspect it's in C++. It would be dead easy to port tho.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
hi chtristian, thanx for replying .yes id really appreciate it if you send me the doodle program . thanx again
|
|
|
|
|
To reiterate - I have an article here on code project which creates a simple paint program called doodle, you should read the article and download the code, it will probably help you.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
First let me thank you guys, for sharing your knowledge and for responding.
I am a newbie learning .NET, so plz bear with me. my question is, how to bind a CheckedListBox control in a WinForm. I did the binding, but it is not showing any values, it's not giving any error either, I wanted the CheckedListBox control to be populated at the FormLoad Event.
my code is given below. I tried different ways, but still its not working.
lstFacilityType is a CheckedListBox control.
First, I tried this.
-------------------------------------------------------------------------
lstFacilityType.DataBindings.Add(new Binding("Text",ds,"FacilityType"));
-------------------------------------------------------------------------
Second, I tried the code given below, it is returning the table in the dataset.
------------------------------------------------------------------------
lstFacilityType.DataBindings.Add(new Binding("Text",ds.Tables[0],"FacilityType"));
------------------------------------------------------------------------
Thanks, for ur help.
abhi
|
|
|
|
|
If you're trying to bind the actual list, you need to need to fill the Items property manually. Binding the Text only binds the Text property.
You should read about the DataBindings property and the BindingManagerBase class in the .NET Framework SDK.
The code you're doing above needs to bind to the Text property of the control for which the Binding is added (i.e., lstFacilityType ). The rest of your expressions won't work, however, because the Binding only works for PropertyManager , not to bind to an IListSource or IList , of which DataSet and DataTable are (respectively). When you bind to a data-bound control like a DataGrid , it nows how to use the DataSource and, optionally, the DataMember to enumerate the collection and bind a UI element to that row. Binding how you're doing it is not the same. The results you're getting are to be expected since you're binding against an object, not its value.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
I have two treeviews in a windows application.(leftside and right side)
and there are some nodes in these two treeviews.I want to drag a node from the left treeview to another node in the right treeview.
When the user drag- drop it,a line will be drawed between these two nodes.How can I do this?Could you help me pls?
|
|
|
|
|
Dragging and dropping a TreeNode is rather simple. You first pack the TreeNode into a DataObject and call TreeView.DoDragDrop . If both TreeView s were to handle drag and drop, it'd look something like this example:
public class DragDropTreeView : TreeView
{
public DragDropTreeView()
{
AllowDrop = true;
}
protected override void OnItemDrag(ItemDragEventArgs e)
{
TreeNode node = e.Item as TreeNode;
if (node != null)
{
DataObject data = new DataObject("TreeNode", node);
DoDragDrop(data, DragDropEffects.Copy);
}
}
protected override void OnDragOver(DragEventArgs e)
{
if (e.Data.GetDataPresent("TreeNode") &&
(e.AllowedEffect & DragDropEffects.Copy) != 0)
e.Data.Effect = DragDropEffects.Copy;
}
protected override void OnDragDrop(DragEventArgs e)
{
TreeNode node = e.Data.GetData("TreeNode") as TreeNode;
if (node != null)
{
Point p = PointToClient(new Point(e.X, e.Y));
TreeNode parent = GetNodeAt(p);
if (parent != null) parent.Nodes.Add(node);
}
}
} Drawing lines in between is not so easy, but I'll set you on the right course. I don't have the code I once wrote to perform that, and it is definitely a long, drawn-out solution. I do recommend you try searching this site for examples.
Basically, you need to keep track of state. So in OnItemDrag set some bool variable to true . In any override that would stop dragging and dropping (including OnDragLeave for when the mouse moves outside your client area), reset that variable to false .
In an override to OnPaint , if this variable is set (i.e., true ), you convert the current mouse coordinates to client coordinates like I did above to get a nearby TreeNode . From that you offset your line coordinates and draw a line using PaintEventArgs.Graphics (do not call CreateGraphics since you already are given one for the current paint operation). There's a few problems you must handle, though. The offset should be between two nodes and there's lots of properties you have to take into account, otherwise the line may change positions slightly and that wouldn't look good.
Make sure you do this in OnPaint . If you do a one-trime draw using CreateGraphics to get a Graphics object (always dispose of them, except when in OnPaint since the base handler will when finished), then anything covering the screen (including a drag image if you implement one - also not easy) will cause the background to repaint and your line (or part of it) will not show. Also do not try to get around this by drawing a line every time the mouse is moved. That is a very expensive operation and will hog system resources.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
I am writing HTML documentation for a C# project. When I include <see cref="membername"> in the documentation it is rendered exactly that way in the HTLM generated by Visual Studio 2003 "Build Comment Web Pages ..." on the Tools menu. However it is not rendered at all by my IE 6 browser. Anyone have a clue about this?
Gary Hyslop
|
|
|
|
|
Without any specifics, no one can really help you.
If you believe this is a problem with the HTML, please post your questions in the Web Development[^] forum.
I also urge you to check out NDoc[^], a project I've had the pleasure to work on and that is used widely by the industry to generate many different formats from C# (and not VB.NET) comments.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Please anyone help me!! I am doing an Expression Tree Parser project and I would like to demonstrate a tree with nested nodes that holds the operands and operators, it is easy to implement in design time but I failed to implement it at run time please anyone reply to me and give me some hints.
Note: (they must be nested nodes and not separated nodes)
Koko Wawa
|
|
|
|
|