|
Well, I did find an article[^] discussing the differences in the timers.
Time to start reading...
--
Marcus Kwok
|
|
|
|
|
Use the windows forms Timer. Basically I would just set some member variable to the image you want to show and then call Invalidate on your form/control in the Tick eventhandler.
In the paint function you could then draw the image according to the field.
|
|
|
|
|
Robert,
Thank you for your advice. I was able to get the System::Windows::Forms::Timer to work, and it works well, and is much cleaner than my threaded solution.
I am now getting some flickering and a little bit of weirdness when painting, but these problems are orthogonal to my original issue so I will do my research and start a new thread (no pun intended) once I figure out some stuff.
Thanks.
--
Marcus Kwok
|
|
|
|
|
Look for double buffering and SetStyle from the Control class .
|
|
|
|
|
Thanks, I will take a look.
--
Marcus Kwok
|
|
|
|
|
I'm making a custom control which has a collection of items. I've inherited this collection from System.Collections.CollectionBase and I've implemented all interface methods. But when I insert new item in design time, new code is not generated in "Windows Form Designer generated code" section.
What do I have to do to make designer gerenate this code?
|
|
|
|
|
Hi All,
In the stuff I'm working on at the moment, I have a C# application which has to make calls via interop to a legacy C dll, and in doing its stuff the C dll uses a lot of memory.
So, an out of memory exception is thrown, but by using various monitoring tools, its seems this is happening around about 500MB, my computer has 3GB of RAM in it. My question is this, is there an upper limit on how much RAM a .NET process can use? Or, is there a limit on how much memory a traditional dll when used via Interop can use? Where is the bottleneck? And is there a way of widening it?
Help as always appreciated.
Regards,
Rob Philpott.
|
|
|
|
|
hello,
I am creating a windows form app using VS.Net and I am having a fundamental problem with window sizing. I would like to specify the exact size of each form programmatically. Despite my efforts, the forms seem to be resizing themselves sometime between when the constructor is run and the window is actually displayed. Does anybody know why or where in the code this is happening? Any insight would be much appreciated.
Thanks!!!
rc
|
|
|
|
|
If you post some code I might be able to help.
Programatically setting the .Size, .Height, or .Width properties of the form works if the values are within the .MaximumSize and .MinimumSize properties.
|
|
|
|
|
Find something like that in Windows Form Designer generated code section.
this.ClientSize = new System.Drawing.Size(30, 373);
But even if you comment this code, designer'll generate it again. It'd be better to override OnLoad methods, where set the size of the form.
|
|
|
|
|
How do I have a form appear with the text in a TextBox selected?
I have a simple dialog window that has a single textbox for user input and two buttons (OK and Cancel). When the dialog window loads, I would like the text in the TextBox to be selected so that the user can start typing as soon as the window comes up, instead of having to manually click on (or tab to) the textbox. I have tried placing the following line:
textbox_sleep_time_ms->Select(0, textbox_sleep_time_ms->Text->Length);
both as the last statement in the constructor for the form, and as the only statement in the form's Load event handler, but neither one will select the text. I don't know if it's relevant, but I have set the default button for the form to the OK button so that the user can just press Enter to accept the value.
--
Marcus Kwok
|
|
|
|
|
OK, I figured it out. I had to use
textbox_sleep_time_ms->Select();<br />
textbox_sleep_time_ms->SelectAll();
--
Marcus Kwok
|
|
|
|
|
Am i right in assuming that the Finalize() method is ONLY invoked by the garbage collector if a type inheriting from Object implements it. And is NOT called if the only implementation of Finalize is Object.Finalize()?
And hence calling GC.SuppressFinalize() on such an object would have no effect?
Just need to settle this in my head.
Cheers
T
-- modified at 9:09 Tuesday 23rd May, 2006
|
|
|
|
|
I think it is always invoked but the implementation of it in object is empty so it doesn't matter if it is called or not.
|
|
|
|
|
Well acording to the microsoft document, the finalize invoke leaves the object hanging around for two GC cycles. Which is inefficient use of resources and extra processing time which should really NOT be required.
I've spent ages trying to figure out if this is the case.
|
|
|
|
|
I think that the garbage collector is smart enough to recognise if it's the Object finalizer that would be called, and skip the call in that case.
I have nothing to back up my theory, though. It's only based on what I would have done myself, and that the MS guys has put quite some work in the GC and missing something that obvious would be rather silly...
---
b { font-weight: normal; }
|
|
|
|
|
As far as I know, your are correct. Garbage collection will call Finalize on ONLY those instances which contain a Finalize in their class. Otherwise, Finalize is NOT called.
Finalize does add some extra overhead to the garbage collector. When a class is constructed which contains a Finalize method, a reference is placed in a special Finalize-related queue. There is also a queue called f-reachable which pertains to finalize as well.
Microsoft's documentation recommends to not use Finalize very often as it takes a large hit to the garbage collection.
Here is an interesting article from the Microsoft site. Perhaps you have already read it. Good information!
http://msdn.microsoft.com/msdnmag/issues/1100/gci[^]
|
|
|
|
|
Hi Guys,
I have a datagrid that, to cut a long story short, has a very expensive paint event that adversly affects responsiveness. Therefore I want to disable the paint event when scrolling with the vertical scrollbar until after the user has released the scrollbar button. I have tried to add event handlers to the vscrollbar (which for some reason is hidden in the editor), but they never seem to fire. Any ideas will be warmly received...
Thanks,
Luke
|
|
|
|
|
Oh, I forgot to mention that I am working on a custom datagrid control, which inherits from the standard dot net 1.1 framework datagrid control. The inherited scroll bar in question is 'VertScrollBar'.
|
|
|
|
|
Try to catch it from WndProc:
<br />
protected override void WndProc(ref Message m)<br />
{<br />
switch (m.Msg)<br />
{<br />
case 0x0115:<br />
break;<br />
}<br />
base.WndProc (ref m);<br />
}<br />
|
|
|
|
|
Thanks Alexander. I also found another way of doing it, using the scrollEventArgs.ScrollEventType argument (never noticed this one before). Removing the scroll event handler when the bar is scrolled using the button resulted in the behaviour I was looking for.
Private Sub VertScrollBar_ScrollHandler(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs)<br />
<br />
Static scrollEventDisabled As Boolean<br />
<br />
If e.Type = ScrollEventType.ThumbTrack Then<br />
scrollEventDisabled = True<br />
RemoveHandler Me.VertScrollBar.Scroll, AddressOf Me.GridVScrolled<br />
Else<br />
If scrollEventDisabled Then<br />
AddHandler Me.VertScrollBar.Scroll, AddressOf Me.GridVScrolled<br />
scrollEventDisabled = False<br />
End If<br />
End If<br />
End Sub
|
|
|
|
|
hello,
i have decompiled a dll and i want to create a dll again is this possible because the decompiled program created several seperates files for example AssemblyInfo.il, Unknown.il, etc
greetings
Gedrain
|
|
|
|
|
Looks like you just specify multiple files on the command-line like for CSC , take a look at this which is where I made my assumption. (I don't have time to check if it works though).
You know you're a Land Rover owner when the best route from point A to point B is through the mud.
Ed
|
|
|
|
|
I'm no expert, but I've never heard of the ildasm.exe creating more than one .il file. There can be multiple .resources files, and a .res file. But, as far as I know, all you need to supply when recompiling is the .il and .res file names.
ilasm /OUT:Assembly.dll AssemblyInfo.il /RESOURCE:AssemblyInfo.res /DLL
Try this after disassembly, without changing the .il code, and see if the resulting DLL is the same size as the original.
----------
There go my people. I must find out where they are going so I can lead them.
- Alexander Ledru-Rollin
|
|
|
|
|
well i did that and it says this:
Assembled method NET_Dispose_Delegate::.ctor
Assembled method NET_Dispose_Delegate::Invoke
Assembled method NET_Dispose_Delegate::BeginInvoke
Assembled method NET_Dispose_Delegate::EndInvoke
***** FAILURE *****
greetings
Gedrain
|
|
|
|