|
This is where the .NET ComponentModel comes into play. Read Enhancing Design-Time Support[^] in the .NET Framework SDK for starters, as well as the System.ComponentModel namespace classes.
Filtering the properties (or even "creating" properties) can be done in many ways, such as implementing a designer, a TypeConverter , or implementing the ICustomTypeDescriptor on your object.
As far as the CultureInfo goes, you need to set Thread.CurrentUICulture to the CultureInfo you want on the thread that owns the PropertyGrid instance (the thread that created it).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
There are few examples in Code project dealing this. You can please refer these.
|
|
|
|
|
I was playing with the managed WebBrowser control wrapper included in .NET 2. One seemingly huge bit of missing functionality is when the NewWindow event is launched, I want to open the new window in my code using my control, not using the default browser! What's the deal here, did they forget?
I can use the messy COM interfaces to do this I know, but wow, did they actually forget this functionality or am I missing something?
#include "witty_sig.h"
|
|
|
|
|
They've left quite a bit of stuff out - just like every other class in the BCL. The major functionality is supported, though. You wouldn't want a bloated BCL now, would you?
I would recommend posting this feature request before it's too late by using the new MSDN developer center for VS 2005 and .NET 2.0. Browse to http://lab.msdn.microsoft.com/vs2005/Default.aspx[^]. You'll need a Passport, but you can post bugs and feature requests. This is primarily for VS 2005, but I've seen several .NET 2.0 bugs/requests slip in. You could always use the MSDN newsgroups, too.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
*prust*
Is it possible to implement a own shell-view for the Windows Explorer??
I don't want to create my own Explorer, but I need a special view to present the content of a folder to the user. Its possible to add a column to the details view of the Explorer window, but I need more.
I wrote a programm that analyses methods out of Java-Source files (*.java). Each found method in a file should get its own entry in a listview. Therefore I can not use the details view of the explorer. I need my own view.
I don't know if that is possible. But if its possible, how should I implement this "owner-drawn" view????
Shir Khan, the tiger
GVT
|
|
|
|
|
MSDN Magazine had an article[^] in the January 2004 edition about writing shell extensions in .NET. I'm not sure that it is 100% applicable, but perhaps it can provide a starting point.
Hope that helps a bit.
--Jesse
|
|
|
|
|
Shir Khan wrote:
Its possible to add a column to the details view of the Explorer window, but I need more.
That is correct, you can do this through a shell extension (Mike Dunn has written a nice article here[^]). However since you need more I would suggest you read Dino Esposito article on MSDN titled: More Windows 2000 UI Goodies: Extending Explorer Views by Customizing Hypertext Template Files[^]. I would caution you that soemthing like this would probably best be written in an unmanaged language, otherwise you are looking at a lot of additional work. Good luck.
- Nick Parker My Blog | My Articles
|
|
|
|
|
I am writing a DataBase layer DLL and I am having toruble reading the Config file to get the ConnectionString etc. To enable me to read the Config file with:
_connectionString = ConfigurationSettings.AppSettings[ "ConectionString" ];
from within my DataBase layer DLL what do I need to call the Config file and where do I put it so that it will read from this Config file both while debugging and when running the .exe which will create an object of the DataBase layer.
My Config file is as follows:
<?xml version="1.0" encoding="utf-8" ?><br />
<configuration><br />
<appSettings><br />
<add key="ConectionString" value="testing"/><br />
</appSettings><br />
</configuration>
|
|
|
|
|
The default executable loader does not load .config files into the AppDomain for DLLs - only EXEs. You either need to create your own loader or shim, or document that the host application must define an appSetting named "ConnectionString" in its .config file (which is a common approach, or error out).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi all. I am working on a project where we have an embedded IE control on a Windows form, and one of the features we have been requested to produce is a " find on this page", where the user can type in a term, and if it exists, the browser control will scroll to it (similar to the existing functionality of IE's Edit->Find( on this page), without the dialog). the problem I am getting is that I see no elegant way of doing this, without parsing the HTML returned in the browser control, or wrapping a Javascript in some form of COM interop. Seems that there should be some method exposed in the Windows Browser control (mshtml.dll) for doing this, but I can't find it. All we need is for the method to take a string, and look for it on the displayed page. If it finds it, show it, otherwise, pop up a message box.
Any help in this matter will be greatly appreciated.
|
|
|
|
|
If you haven't already, you'll need to interop MSHTML. If you've installed VS.NET, Microsoft.mshtml.dll should already be in the GAC. You just need to add a reference (this contains all the automation interfaces for the DOM).
Get the IHTMLDocument2 reference by casting WebBrowser.Document to the interface. Then get the body property (an IHTMLElement ). Cast this to an IHTMLBodyElement and call createTextRange . This gives you an IHTMLTxtRange . You're almost done.
Call findText on the IHTMLTxtRange . Documentation for this method can be found in the Web Develoment -> Programming and Reusing the Browser section in MSDN Library[^]. If the text is found (it returns a bool ), the IHTMLTxtRange is modified to beginand end with the text that was found. Then simply call scrollIntoView on the IHTMLTxtRange , passing either true or false to position the text at the top or bottom of the window, respectively.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks so much, this works great. I have one other quick question, how can I cycle down the document if more then one instance of the string is found? Say if they hit the button agai, it goes to the next instance, until findText returns false?
|
|
|
|
|
I again encourage you to read the MSHTML Reference[^] documentation I mentioned earlier if you haven't already.
The easiest way would be to call IHTMLTxtRange.moveStart to move to the end of the range, then call IHTMLTxtRange.moveEnd to move to the end of the body (there's many ways to do this). Then call findText again and repeat the process.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi!
I'm looking for any information on how to limit the internet bandwidth used by my program. I have found that this can be done by delaying ACK packet, but how can I do it from .NET framework (I dont want to use any unsafe code)
Thanks in advance
Piotrek
|
|
|
|
|
The .NET Framework languages we're not designed for such low level work. You would have to P/Invoke many API's and declare bunches of constants and structs to do it. There is no support in the .NET Framework for doing what your talking about. Everything about this project would be unsafe code...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks
Is it possible to limit (control) bandwidth in this way:
1. set socket buffer through the SetSocketOption and SocketOptionName.ReceiveBuffer to small value
2. do not take data from function call by the BeginReceive and/or do not call BegineReceive again
This should (I think) make full all buffers and the system should send same delaing packets waiting for me to make empty the buffers.
If it isnt possible could You point out some articles/codes about bandwidth limiting, please?
Thanks in advance
Piotrek
|
|
|
|
|
Those articles are few and far between. I actually haven't been able to find any that deal with an entire NIC, just a single application.
You idea works, if your application is the one you want to limit the bandwidth on, but it will NOT work for just the Internet and will NOT work for all bandwidth on a NIC. You can't modify the buffer sizes of the TCP/IP stack globally using your method, not can you modify the buffer sizes of other applications.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I'm sorry that I didn't mention it before, but I want to limit only my application.
Thanks for help.
|
|
|
|
|
In, Aspx page, I would like to add programmatically a new element(c# or VB.NET) in the header of my aspx page.
Add element=toto,atribut=coucou value =”Y”
Example
<title>Default
<toto coucou="”Y”">
Thank you a lot
bye
-=zoltx=-
|
|
|
|
|
That makes no sense. Can you try explaining again what you want to do.
Also, this should really go in the ASP.NET[^] forum
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
|
|
|
|
|
I would like to add a tag in the header in my aspx page
as <base href="http/....." />
for example
.....generate by VS
<base href="http://localhost/test1" />
......
Thank you
-=zoltx=-
|
|
|
|
|
I have an app that draws graphs. I want a tooltip that says the x and y value for the axis the mousepointer is over. That is not the main problem. The real problem is that the panel redpaints itself when the tooltip moves. (It now just shows the X and Y coordinate of the pointer) The tooltip moves on panel_Navigate which makes it repaint at every little mouse movement. I have read a little about Double buffering. Is there an easy way of implementing this? This did not work:
this.SetStyle(ControlStyles.UserPaint, true);
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.SetStyle(ControlStyles.DoubleBuffer, true);
I have a form with a usercontrol with the panel to draw graphs inside it. I tried to make my own little derived panelclass which overrides the OnPaint method, but I just could not make it work properly because I have to draw the graphics inside the override method. That makes things a little tricky.
Any suggestions? Maybe I'm doing something wrong with the code above? I tried putting it inside all of the constructors, but nothing happend.
- Atle
|
|
|
|
|
First of all, the ControlStyles enumeration is flagged (attributed with the FlagsAttribute ), meaning that you can use bitwise operators on it. In the Microsoft .NET BCL assemblies (base class library), any enumeration with a plural ending does (the power of naming conventions and consistency).
You can save many instructions by changing the three lines to the following:
SetStyle(ControlStyles.UserPaint | ControlStyles.DoubleBuffer
| ControlStyles.AllPaintingInWmPaint, true); This has to be called before the handle is created, so it's best you do this in the constructor.
Second, double-buffering isn't a blanket fix for any drawing problems. More than likely, the entire graph area is being invalidated or your redrawing the entire graph every time OnPaint is called (or your Paint event handler, which ever way you're doing it - although overriding OnPaint is faster and gives you greater control).
Instead of drawing the entire region, use the PaintEventArgs.ClipRectangle passed to the OnPaint method to determine which area needs repainting. If you repaint the entire area for a complex drawing (like a graph), double-buffering will not help much (a little, but not much).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I have a TreeView tv1, I am adding nodes and their child nodes. I am storin the values (no. of nodes) in a 2D array. like.. I have a 2D array called
int nodes[][], and a var called int parents , (both global & static),am storing the no of the parent in nodes[0][0], and the number of children that parent has in nodes[0][1].
Ex.
Say I add two parents
then:
nodes[0][0] = 1;
nodes[0][1] = 0;
nodes[1][0] = 2;
nodes[1][1] = 0;
then say I add two children to the first node-
then:
nodes
nodes[0][0] = 1;
nodes[0][1] = 2;
nodes[1][0] = 2;
nodes[1][1] = 0;
This works fine but removal of nodes is the problem. I can remove a child and say
nodes[tv.SelectedNode][1]--;
I can remove a parent without children by:
nodes[tv.SelectedNode][1] = 0;<br />
parents--;
The problem is in removing the parents with children:
I tried to make another function called CopyNodes(int [][],int selectednode)
where I make a temmp 2D array and when I encountered the var selectednode I skipped that part to copy array elements through 2 for loops (like you copy 2D arrays) But somithing is wrong & the array cannot remove the parent with children, & decrement the no. of elements of the array.
I did my best..
Please HELP ME!!
PLEASE!!
_____________________________________________________
Yea! I could be wrong...
|
|
|
|
|
Why are you even bothering? The TreeView already stores the hierarchy of TreeNodes and you can easily get the count at any level using TreeView.Nodes.Count or TreeNode.Nodes.Count . This can even be done recursively very quickly.
What you're doing is not only unnecessary but very error prone as you've already experienced. Don't bother; the TreeView already maintains the node count so use it.
Microsoft MVP, Visual C#
My Articles
|
|
|
|