|
the float data needs to be drawn once if there is resize event in the form. the data is drawn to memg graphics object. from which it is drawn to a form if it is obscured and then released by another window.
if the form itself resized the data plot needs to be redrawn to fit changed dimensions of the form.
this is double buffer. the float data is put into memg object wich then is painted to a form, so we dont see flick due to clearing the form and ploting data directly to a form.
Graphics *g = CreateGraphics();
creates graphics objects of the form in OnPaint event and the memg object is painted into it.
paint() and resize() is just stubs for OnPaint() and OnResize() events
9ine
|
|
|
|
|
Sorry, my fault I missed the g vs. memg variable.
Did you try only redrawing the Bitmap when the data changes and let DrawImage() scale the image to the size of the window? That way your plotting code would not execute during resizing of the window.
led mike
|
|
|
|
|
it is not possible, we need to plot a resized version of the plot like in magnifying the 1D plot by means of incresing size of the canvas
9ine
|
|
|
|
|
Sorry, I am not following that. Using DrawImage you can scale to whatever size you want.
led mike
|
|
|
|
|
The short answer is the .NET GDI runs in a way which precludes parts of it from being accelerated by a graphics card. The second issue is the extensive marshalling that goes on between .NET and the Win32 GDI layer.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Thats very silly, having so much of the product developed and failed to beat simple builder C++ application??? Consider even compilation times! I noticed that builder compiled app 1D plotting runs faster on modern video cards compared to simple ones from the last century.
I think there is another reason is the Bitmap object itself. In builder you can ajust bitmap canvas properties by simply adjusting its size without deleting the bitmap!
However in .NET Bitmap object it can be created only of the fixed size! and you can not change its dimensions during run-time. The possible sollution is to delet it and allocate a new one to fit the form during the resize method. But in __gc compiled resources you can not delete them the garbage cleaner do it. So if rely on the garbage cleaner to delete all the allocated Bitmaps during form resizing events you end up without free mem
Very silly.
9ine
|
|
|
|
|
probably the best application of the VC is the console ones
9ine
|
|
|
|
|
9ine wrote: In builder you can ajust bitmap canvas properties by simply adjusting its size without deleting the bitmap!
Some helper class is doing this, and probably deleting/recreating the bitmap in the background. Bitmaps are a fixed size, like any allocation of memory.
9ine wrote: . But in __gc compiled resources you can not delete them
You can Dispose them, which is the same thing, the unmanaged resource is cleaned up.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
dispose is of no help. consider resizing a window it is about dozen resize messages and you end up with no free mem. it does not delete the Bitmap object immediatly once executed!?
Thats the great disadvantage of .NET objects you can not resize them once allocated nor delete them
Simple Borland Builder posses all these features, the only disadvantage is its debugging process, VC provides more useful quickwatch.
9ine
|
|
|
|
|
9ine wrote: consider resizing a window it is about dozen resize messages and you end up with no free mem. it does not delete the Bitmap object immediatly once executed!?
Like I said, you can delete the bitmap every time, Dispose does this.
9ine wrote: Thats the great disadvantage of .NET objects you can not resize them once allocated nor delete them
NOR DOES BORLAND BUILDER !!!
9ine wrote: Simple Borland Builder posses all these features
You're just plain wrong. Borland cannot change the nature of Windows, it cannot create a world where you can resize a bitmap without deallocating and reallocating it. All it can do is hide the facts from you.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
then the builder is more succesfull in hiding windows facts from me than the native VC does.
dispose results in delayed memory deallocation
9ine
|
|
|
|
|
Yes, that is precisely what a wrapper does. MFC doesn't wrap bitmaps in a way to hide these facts. It's no different to std::vector or CArray. Using those, you'd never guess that you can't create an array and then just keep adding stuff to it without it having to reallocate memory. The class hides this task from you.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I wonder if builder is using a DIB Section below the surface.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
What is it. and is it useful?
The problem is to render promptly floating array of data to a window.
Once you created bitmap in Builder you can alter its size without deleting it. So without a flick you can plot the data you want.
.NET graphics is good for ploting image files not some floating array to fit a window.
Probably the only solution to a lame .NET graphics is opengl one?
9ine
|
|
|
|
|
http://www.3dsoftware.com/Programming/WindowsAPI/DIB_Section/[^]
Realize that builder isn't just alerting the size; it is recreating bitmaps below the surface and copying the old data to the new one. Using DIB Sections you could do this copy fairly quickly.
One solution is to write the code you want at the Win32 layer with C++/CLI. Another is to look around and see if any company is selling a toolkit that does what you want. I'd also suggest working with .NET some more and thoroughly understanding the graphics layer to make sure there isn't a great third solution I haven't thought of. (Oh, and you may need to rethink how you are doing your application. Perhaps a different algorithm on your part would make a purely .NET solution viable.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Hi All,
I am New user for vc.net,
My code is
String ^str1=L"1",^str2=L"2",^str3=L"3";
String ^str=String::Format("{0}{1}{2}",str1,str2,str3);
MessageBox::Show(str);
But I want Increase the String length like
in VC++;
CString str;
str.Format("%25s%15s%15s",str1,str2,str3);
I want modify above code like that
Plz suggest me
Nagaraju
|
|
|
|
|
You need to look into formatting support in .NET. String.Format does not do formatting just template placement. ToString() supports formatting. Also see IFormatProvider and NumberFormatInfo etc.
String ^str=String::Format("{0}{1}{2}",str1->ToString(IFormatProvider),str2,str3);
led mike
|
|
|
|
|
What! no printf style formatting support? What kind of C based language does not somehow provide printf style formatting.
Last I heard, even Java 1.5 or 5.0 or whatever it is added printf style formatting to their string class.
-- modified at 12:46 Tuesday 8th August, 2006
|
|
|
|
|
bob16972 wrote: What kind of C based language
If you are doing mixed mode you can still use the C++ formatting libraries.
bob16972 wrote: Last I heard, even Java 1.5 or 5.0 or whatever it is added printf style formatting to their string class.
Have not done any Java in the past couple of years, don't know if I ever will again.
led mike
|
|
|
|
|
just a disclaimer... That wasn't meant toward you. I was gasping aloud so my apologies if that came off as somehow blaming you. When I reread it, it just doesn't sound right so again, my apologies.
|
|
|
|
|
I knew that but thanks for the concern, Also see George Jacksons reply which shows how String.Format uses format specifiers. He picked up my slack.
led mike
|
|
|
|
|
You can do this:
String ^str = String::Format("{0,25}{1,15}{2,15}", str1, str2, str3);
for with the values right-aligned and this:
String ^str = String::Format("{0,-25}{1,-15}{2,-15}", str1, str2, str3);
for values left-aligned.
-- modified at 15:35 Tuesday 8th August, 2006
|
|
|
|
|
Thank U very Much George,
I wish u all the best
Nagaraju
|
|
|
|
|
Hi..
Has anyone wrapped the ODBC Native API into a managed C++ class. From what I have researched natiive ODBC API is still the fastest way to fecth records.
Sk8tz
.NET Rules
|
|
|
|
|
Code Project Articles[^]
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|