|
No way.
The way the TreeView works _is_ that you have the node icons in an imagelist and _only_ reference them by index.
Of course, you can add images to the imagelist at runtime and then set the new index, but you can't do it directly.
Regards,
mav
|
|
|
|
|
Hey!
I have a log program that logs all data from serial port in a textbox. This works good. But I’m not sure how it will react if it adds data to the textbox for days with out removing any data. Maybe textbox will be to slow especially with word-wrap?
To remove rows from a textbox is not too good, probably the textbox will redraw a couple of times witch I don’t have performance to.
If I use BeginUpdate and EndUpdate on a listbox maybe it could be faster? And if it is a listbox, then I can simply let there only be 400 rows or something like that.
I have tested RichTextBox, and just over some min the performance meter is going up, the text box is holding a stable level.
BestRegards
SnowJim
|
|
|
|
|
I wrote a similar application and used Listbox because I needed the data formatted like a grid. I did run into trouble with slow performance when I had about 10,000 lines (my app logged about 800,000 lines). So what I did was to limit the number of lines displayed to 1000 and when it reached 1000 I removed a line from top and added new line to bottom; however, the entire set of data was still being saved in memory using MemFile (C++). That is my input about listboxes. I haven't experienced with too many lines using textboxes; however, note that textboxes have a "Lines" property which holds an array of all lines in the textbox so I imagine you could remove lines from it if necessary.
|
|
|
|
|
Saving very long texts in a TextBox or a ListBox _only_ isn't a very good idea IMO.
If I had to do it, I'd show the last n entries (n=100 perhaps, configurable) in a ListBox and when more entries are added I'd remove the ones at the beginning of the list.
But I'd also log the data to a file, otherwise - apart from possible performance problems - all your log data is lost when the app ends (unexpectedly).
Regards,
mav
|
|
|
|
|
Hey!
I have a textbox that logs searten events, this text box will be filled over days and maybe weeks. The data flow in to this textbox can be fast.
The question is now: Will this result in memory overflow if no data is removed from the textbox? Or handles .NET this?
Best Regards
SnowJim
|
|
|
|
|
I believe a textbox has a maximum size. Certainly, you may want to set a maximum size, and trim from the string until it fits that size. If you want a full log, you should do it to disk, where it can be written and forgotten about.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Yes it is written to disk, but there most be a visible log there you can see the current dataflow.
textbox have e a maximum size, but what happens when it is full? will it remove from the begining or will it result in a memory overflow or somthing??
Best Regards
SnowJim
|
|
|
|
|
Like I said, set a maximum size, and keep removing text from the oldest record on, so it doesn't get out of control. As to your question, the obvious thing is to try it and see. You can write a loop that just keeps adding text to a textbox, can't you ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hello there!!!
How can make the mouse move by it self... Question 1
How can I make the mouse click by it self... in any place of the screen out side of the application... Question 2
well if any one knows
thanks
Mateus
|
|
|
|
|
Solution I can think of involves timer and P-Invoke SetCursorPos API[^].
Is there managed solution?
oakcool wrote:
How can I make the mouse click by it self... in any place of the screen out side of the application... Question 2
Unmanaged:
P-Invoke GetDesktopWindow[^] to get handle to desktop... then again P-invoke SendMessage[^] and pass it desktop handle. See details of API on MSDN or google or whatever.
Hope it helps.
David
Never forget: "Stay kul and happy" (I.A.)
David's thoughts / dnhsoftware.org / MyHTMLTidy
|
|
|
|
|
dnh wrote:
Is there managed solution?
Yes there is. The System.Windows.Forms.Cursor.Position property gets or sets the cursor's position in screen coordinates.
www.troschuetz.de
|
|
|
|
|
|
Man I just did not get the way to do the clicking...
Well I want to click in a IE window that I openned before.
I have to click in a specific region of the page.
If you could help with a sample code... it would br nice.
thanks
|
|
|
|
|
Actualy I hoped you will do some research yourself...
oakcool wrote:
Well I want to click in a IE window that I openned before.
Why you didn't say that before??? If you need to control IE from your application, there is different way to do it.
Look at this Article[^] if you can have browser in YOUR APPLICATION. If it must be external IE window then e.g this link[^] should give you some idea... Or just type "IE Automation C#" into search engine.
Sorry I won't write any example now... I am sure there are many on the web.
David
Never forget: "Stay kul and happy" (I.A.)
David's thoughts / dnhsoftware.org / MyHTMLTidy
|
|
|
|
|
Instead of the SetCursor API mentioned by dnh, you can use the managed System.Windows.Forms.Cursor.Position property , which gets or sets the cursor's position in screen coordinates.
www.troschuetz.de
|
|
|
|
|
I have a RichEditBox which I would like to automatically size vertically to match the length of text (no scroll bars) as the user types. How can I resize the RichEditBox this way in real time?
Thanks in advance.
|
|
|
|
|
Hello. Anyone here know if Kelly Blue Book has an API that can be used in C#?
Doesnt actually have to be Kelly Blue Book but just anything that grabs vehicle pricing information from a query of make and model.
Thanks
Steve Welborn
Software Architect
|
|
|
|
|
|
Excellent thank you very much for the info.
Steve Welborn
Software Architect
|
|
|
|
|
Hi! i have a question about C# and Active Directory. I've been searching all over the place, and i have yet to find what i am looking for.
first, I need a list of the basic objectCategory categories. Mainly the NTID, Phone number, and e-mail address. If there is a method that exports a list of the categories in the selected schema, that would be even better.
second, I need to know how to set the AD properties for the logged on account, based on text input boxes.
Any help would be AMAZING! Also, if there are any really good books on programming for AD, i'd really like to know which one is worth the price.
|
|
|
|
|
|
// the original c++ has those struct:
typedef struct
{
long id;
} StructA;
typedef struct
{
long price
StructA[4] idArray
}StructB
typedef struct
{
long date;
StructB priceArray
}StructC
// a function use those struct
void foo(StructC* quote)
//=============================================
// c# correspoding type
//=============================================
[StructLayout(LayoutKind.Sequential)]
struct StructA;
{
int id;
}
[StructLayout(LayoutKind.Sequential)]
struct StructB
{
long price
[MarshalAs(UnmanagedType.ByValArray,SizeConst=4 )]
StructA[] idArray
}
[StructLayout(LayoutKind.Sequential)]
struct StructC
{
long date;
StructB priceArray
}
// c# function
void foo(ref StructC quote)
It always complain StructB doesnt have layout info...
stuck for whole day
, really need help.
|
|
|
|
|
Sorry, just saw some post ,
currently , struct array as a member of struct is not supported.
But use flat stuct , member like this: arr1, arr2.... sounds not a good idea, Who can give a good work around?
|
|
|
|
|
Just to give you an idea, try changing the line in structB
From: [MarshalAs(UnmanagedType.ByValArray,SizeConst=4 )]
To: [MarshalAs(UnmanagedType.ByValArray, ArraySubType=UnmanagedType.LPStruct, SizeConst=4 )]
Basically you may need to specify the type of data that you have in the array. In this case I used LPStruct but you can try other types. I don't understand why we wouldn't be able to pass other structures after all, it's just a bunch of bytes that have to be marshaled into your managed structures.
|
|
|
|
|