|
Unfortunately, this does pretty much what my code already does--designing the forms in *code* (rather laboriously I might add in my case). I'm really looking for something that will allow the report to be created via a designer of some sort.
|
|
|
|
|
How long can you wait?
(I am adding visual designers stuff to it based on the "Shapes" sample but it is not going smoothly at present...)
'--8<------------------------
Ex Datis:
Duncan Jones
Merrion Computing Ltd
|
|
|
|
|
I'm a patient man
I'd be very interested in trying it when you get the designers working. Being able to use a visual designer to arrange a header, body & footer for a form, with text and picture fields would go a long way to avoiding code-based forms.
|
|
|
|
|
There is some limited designer support in this version in GotDotNet[^] - i.e. when you change the properties of a section in design mode it redraws the page to show the change.
It does not do selectiong / dragging / resizing though...yet
'--8<------------------------
Ex Datis:
Duncan Jones
Merrion Computing Ltd
|
|
|
|
|
Hi,
Uhm, I've got a small little app, at the moment, not even 1,000 lines. This is a GDI intensive application, I can't declare more than 26 LinearGradientBrush types.
Error: Exeception of type 'System.OutofMemory.Exception' in system.drawing.dll
How can I increase the memory limit? The app is not even 64kb, mem usage according to the task manager is arround 20MB (due to allot of other things that is loaded as well), and the code itself, isn't even over 1,000 lines.
26 drawing objects is not even a third of all the objects I need (this is a mere 50% of my background only).... I need to get this sorted
Can anyone give some insight???
Thanks,
Chris.
|
|
|
|
|
You're exceeding the number of GDI handles allowed for one process. Make sure you call Dispose() on all Pens, Brushes, Graphics etc. you create.
The garbage collector only manages the memory, so it doesn't notice when you're running out of handles and does not collect soon enough.
|
|
|
|
|
Like the other poster said, you're not running out of memory and there is no way to increase the limits you're running into.
Yes, you MUST Dispose of any and all GDI objects when you're done using them. The sole exception being a Graphics object that was passed to you, one that your code did not create.
Create, draw, Dispose... It's that simple. You CANNOT get away with creating a bunch of objects and using them "globally" throughout your code. It's very bad practice. You've bumped into one reason why.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hmm, then I have a problem.
I do already dispose of everything... It's really a matter of setup a pen, setup a brush, draw the line, and dispose of both the objects - through the entire drawing....
<br />
Dim Brush27 As New LinearGradientBrush(New Point(212, 267), New Point(212, 297), Color.Black, Color.Black)<br />
Dim BrushPen27 As New Pen(Color.Black, 5)<br />
BrushPen27.Brush = Brush27<br />
PCRT.DrawLine(BrushPen27, New Point(212, 267), New Point(212, 297))<br />
BrushPen27.Dispose()<br />
Brush27.Dispose()<br />
That's how every single line is drawn. Brush1 through to Brush27, and BrushPen1 through to BrushPen27. For interest sakes, do I need both????
The moment I Dim brush28, memory error... I do really have a crapload of things still to draw, and they need to move arround aswell (animation)... Please tell me there is a solution?
<br />
Private Function GetGraphicsObject(ByVal bp As PictureBox) As Graphics<br />
Dim bmp As New Bitmap(bp.Width, bp.Height)<br />
Dim Grph As Graphics<br />
Dim sm As SmoothingMode<br />
<br />
bp.Image = bmp<br />
Grph = Graphics.FromImage(bmp)<br />
Grph.InterpolationMode = InterpolationMode.HighQualityBicubic<br />
Grph.SmoothingMode = SmoothingMode.HighQuality<br />
Return Grph<br />
End Function<br />
<br />
Private Sub DrawPCRT()<br />
' Top two nodges<br />
Dim Brush1 As New LinearGradientBrush(New Point(210, 20), New Point(210, 48), Color.FromArgb(255, 255, 255), Color.FromArgb(255, 255, 255))<br />
Dim BrushPen1 As New Pen(Color.FromArgb(255, 255, 255), 4)<br />
BrushPen1.Brush = Brush1<br />
PCRT.DrawLine(BrushPen1, New Point(210, 20), New Point(210, 48))<br />
Brush1.Dispose()<br />
BrushPen1.Dispose()<br />
<br />
* Allot of code removed, all drawing different lines *<br />
The above is drawn from my Form1_Load routine, drawn on a PictureBox.
form_load
<br />
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
PCRT = GetGraphicsObject(PictureBox1)<br />
DrawPCRT()<br />
If PFD.Initialize = True Then<br />
RemoteClassMainThread.Start()<br />
End If<br />
End Sub<br />
Thanks guys,
--
Chris.
-- modified at 16:26 Sunday 8th January, 2006
|
|
|
|
|
Ok... Saw what I'm doing now... Optimised, and on we go :P
Only have 8 Pens so far, no gradients.
On a different note now... Will it be better (faster) to do the first, or the second. What's going to be best as far as performance goes...
<br />
Dim myPen As New Pen(Color.White, 20)<br />
g.DrawLine(myPen, New Point(50,1), New Point(50,21))<br />
or...
<br />
Dim myPen As New Pen(Color.White), 1)<br />
For i As Integer = 1 to 20<br />
g.DrawLine(myPen, New Point(50,1), New Point(50, 1 + i)<br />
Next<br />
The second example is perhaps not accurate as far as co-ordinates go, but the idea is there. The tradeoff as I see it is use one pen for each color, vs. use one pen for each color + width.
Therefore, on the later, you will use less memory because you have less pens declared, but, I would suspect you will loose speed, because you'll have allot more drawing to do.
Which is best - especially considering that I have *allot* of drawing to do...
Thanks for the help. Not only is my code base significantly smaller now, but my memory / file handles issue is also something of the past now. The question is just for now long
--
Chris.
|
|
|
|
|
The first is obviously faster. Creating/destroying a pen is not THAT expensive, you just need to do it. In C#, we have the using keyword, does VB.NET 2005 have that now ? I know 2003 didn't.
Also, if you're drawing with one pixel wide pens, don't create them, use Pens.White, for example.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi Christian,
Thanks for the help and input. *really* stupid of me I know, but I figured out I can actually re-use pens... Change width / color on the fly etc... I'm optimising the entire routing now to use only one pen, and draw like I would normally.
So far there's a remarkable improovement... I can just see the memory waiting for something else to complain about again now -grin-
Thanks for the help, I'll shout if there's something else.
--
Chris
|
|
|
|
|
I think I have found a flaw in Visual Basic 6.0 Learning Edition when it is used for development on a Windows XP Professional based PC.
In my first post: "Application doesn't show up on the Windows Taskbar when running." I wanted to know how come the application wouldn’t show up on the Windows task bar while the application was running. There is a property called ShowInTaskBar that when set to true will show the application running in the taskbar, but this doesn’t seem to work if you have more than one form on your application. All forms with the exception of the Splash and Login the ShowInTaskBar property is set to true, so logically any form running on this project should minimize to the taskbar when running. In short the project application should minimize to the taskbar regardless of the number of forms it may contain.
I experimented with a project in VB that contains only three forms, Splash, Login and the Main form. When the project starts it shows the Splash screen for five seconds. Next the login screen will allow the user to log in. After the user is logged on the Application’s name should show up in the taskbar. It does not. I can only assume that there is a flaw in either VB or Windows XP that causes this problem.
I have an application with multiple forms, How do I set up the project so that everything is bundled into ONE application that minimizes to the Windows taskbar when executed?
Thank you,
Quecumber256
Quecumber256
|
|
|
|
|
VB6 works just fine. The Learning Edition uses the exact same runtime version and compiler. There is no flas in VB6 or in XP. The number of forms has never been a problem in the past. We've all had applications with many forms that don't have this problem.
You're project IS in one .EXE.
I still your problem is in your Splash screen or Login form code. But we can't tell because we've never seen it.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I'll be happy to send the Code. The application starts with the Sub Main. BTW, the problem is showing up on another application that contains multiple forms. Is there some Windows API I should be using?
Quecumber256
|
|
|
|
|
Quecumber256 wrote: I have an application with multiple forms
The number of forms should be irrelevant.
Quecumber256 wrote: How do I set up the project so that everything is bundled into ONE application
Write it that way
Quecumber256 wrote: that minimizes to the Windows taskbar when executed?
I bet you $5 that this google search will work 'VB6 taskbar download source'.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I'll give it a try.
Quecumber256
|
|
|
|
|
i want to ask if there is any code that help to compine my program with a picture
please i need this for my university in my project, try to answer me ASAP
|
|
|
|
|
Combine a program with a picture?? I don't understand what you're tyring to do here.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I meant, after doing the program, i want to compine it with picture, so, when i open the picture, the progem works
|
|
|
|
|
Well, you could do something along the lines of a PKUnzip self-extrator, where the .ZIP file is appended to the end of the .EXE unzip code. The resulting file will not be usable as an image file though. It will have an .EXE extension since it's an executable with data attached to the end of it. You will NOT be able to save any changes back to the file though, since the .EXE file will be locked when you launch it.
Other than that, if you want to save any changes to the image, the file MUST be seperate from the .EXE editing it.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
can not i make it .jpg for example
|
|
|
|
|
No you can't. If you attach ANY code to the image file, you'll invalidate the image data and it won't be loadable in any application.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
last question, os there any command to change the extension of a file
|
|
|
|
|
File.Move will rename a file. All you have to do is supply it with the original name and the new name. Unfortunately, you can't change the name of a file if it's open, like an .EXE while it's running.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
how can i make a tabcontrol tab to come in focus if it is not in focus.
plz help
i mean if i click at button if the tab is not in focus & some other
tab of the same tabcontrol is in focus how should i bing a particular tabcontrol panel in focus.
Plz code me out help in vb.net
-- modified at 10:00 Sunday 8th January, 2008
|
|
|
|
|