|
A timer fire periodically, a timing measures the time something takes.
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
|
Couldn't agree more
|
|
|
|
|
Luc... you're our only hope.
|
|
|
|
|
Now I beg to differ.
|
|
|
|
|
Hi, I want to use the javascript function in c#.net window application. Is it possible? If yes, then how?
|
|
|
|
|
|
I'm currently writing a custom control for use with a WinForms application - basically, it's a hex editor control, which displays offsets, rows of bytes, a text column, and some other information.
I'm doing all the drawing inside OnPaint, but I've started to notice that rendering becomes a little laggy when the control is large (and thus a lot of bytes are being drawn). In extreme cases it can take around 20 to 30 milliseconds to draw the entire control. This isn't terrible, but it makes dragging selections feel very slightly sluggish, and I'm sure it's much worse on lower-end machines.
The control is entirely text based - aside from a couple Graphics.DrawPath/FillPath calls, the bulk of the GDI+ calls are to Graphics.DrawString (one for each byte displayed, to allow for custom column spacing). These DrawString calls end up taking up the vast majority of the rendering time.
Is there any faster way to do text drawing in GDI+? It seems that it would be a good move to try to reduce the number of DrawString calls, but how can I do that while still maintaining control over the spacing of characters?
Perhaps there's another, simpler way of rendering text for this purpose that I'm just unaware of? Any advice would be appreciated.
|
|
|
|
|
Check the clipping of the graphics object that you get in the Paint event. It should be clipped to the area that needs redrawing, and if that area is smaller than the control, you only have to draw the cells needed to cover that area.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
I did try only invalidating the regions that need to be redrawn, and it helped a bit, but not a whole lot. I guess I'll try also only computing and calling DrawString for the invalid cells too; thanks for the suggestion.
|
|
|
|
|
It is a hard art to master, but text can be drawn very fast under GDI+. There is just too much detail to go into, but you can look at my 'AdvancedTextBox' control in xacc.ide. The source code is on sourceforge.
To summarize:
- Tokenize data
- Optimize tokens by grouping similar ones (store this and 'invalidate' if the 'line/text' changes)
- Paint the groupings
I would also suggest sticking to monospace fonts. Then only 1 call is needed to get the width of a character.
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
So, basically you're talking about ways to reduce the number of DrawString() calls, right? Tokenizing isn't a problem since it's just a series of bytes; some sections can be rendered differently because of selection or other highlighting, but this wouldn't be hard to keep track of.
This still leaves me with the problem of maintaining a precise layout, though. If I draw the text in this fashion, I'm limited by the default spacing (both space character width and line height) of the font, which often puts columns and lines way too far apart to be visually pleasing in a hex editor. Is there some method of controlling the way GDI performs text metrics?
|
|
|
|
|
Mr. Accident wrote: In extreme cases it can take around 20 to 30 milliseconds to draw the entire control.
To add: Only paint what you see, there is no need to paint the invisible parts of the control.
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
Also, avoid creating new objects (pens, brushes, fonts, ...) in your Paint handler.
What I typically do is have some class members to hold those, inside the Paint handler null-check them
and create new objects if necessary, and everywhere else set them back to null when they will have
to be replaced.
And lastly, whatever disposable object you create, don't forget to call Dispose() on it when
you no longer need it.
The net result is painting does not cause unnecessary GC activity.
|
|
|
|
|
...programatically?
many thanks!
----------------------------------------------------------
"unzip; strip; touch; finger; mount; fsck; more; yes; unmount; sleep" - my daily unix command list
|
|
|
|
|
Process.Start(@"video.avi"); will do it. If there is no program associated with the extension you will get an exception.
|
|
|
|
|
When should we use Application.Run(form1) or form1.ShowDialog()?
Thanks
|
|
|
|
|
Usually, Application.Run is called only once by Main(). ShowDialog is used to show a form in an already running application.
|
|
|
|
|
Thats not the question you have in mind, i believe you want to know the difference between .show() vs .showdialog().
.show() - opens a new form like the old form
.showdialog() - opens a new form but you can only select the old form when you close the new.
Try it.
nelsonpaixao@yahoo.com.br
trying to help & get help
|
|
|
|
|
i have created the dataset ,bindingsource, dataadapter and filled the dataset with data using the adapter, but the problem is how can i bind the data source to the textbox dynamically.
i tried this code segment but got an error
textBox1.DataBindings.Add(bindingSource1);
before comming this point i checked the dataset and it's count equal to the no of records in the table.
|
|
|
|
|
is there any one who can help me with this problem.i want to read data from the db and keep store them (in memory or HD ) and let user to navigate the data. i want to do this programmatic ally.i created the dataset, dataadapter and the bindingsource, but the problem is i failed to get the data to the textbox. i'm trying to navigate data using movenext(),moveprevius() methods in the bindingsource.
|
|
|
|
|
hii all
I have made the setup of my project. My problem is
I want before installation of my project the setup will first install the dot net framework. I have a exe of dot net framework.
Please help
Thanks in advance.
|
|
|
|
|
Goto setup project properties. There you will find a prerequisites button. There you can select Framework installation as prerequisite.
|
|
|
|
|
which installation Location i have to specify in the prerequisites.
Thanks
|
|
|
|
|
I guess its same location as my application option.
|
|
|
|