Thanks a lot for your answering my question, but you are saying that I didn't write enough info. About my problem so what info. Do you suggest on me to include for making my question clearer, beside I’ll be so grateful for you if you include a code snippet even if it had been written in C++, I can handle it. Thanks again for answering
you are saying that I didn't write enough info. About my problem so what info. Do you suggest on me to include for making my question clearer,
You didn't tell us anything about how you've structured your program or the data you want to display. You need to capture the data you want to display and keep it available to your program. Maybe the "Form" but I don't do VB, only C++, so I'm not sure of that terminology. The program has to be structured so the data can be displayed entirely from the data structure in response to a WM_PAINT message. I think in VB you have a paint handler function where you need to do this (OnPaint?). It sounds like you aren't accounting for drawing your "dynamic links" there. A common mistake is to let the user draw interactively on the window and not capture the data into a structure for redisplay. In your case, you get a WM_PAINT message, at least under the covers, when you restore the main window from being minimized.
Yes, the way Tim just stated the problem is correct. Even though we code in C++, the windows object model is the same (but, the syntax is very different). We have no idea if you are drawing to a form, as in NET Framework or a normal window (Win32). We have no idea how you did the previous drawing operation, or where you derived the data. It never hurts to provide lots of code, and describe your thinking as if we were from another planet.
Essentially, Tim is correct about preserving the data structures that your drawing code depends on. How is that done? What kind of a presentation are you ultimately trying to achieve?
Yeah, sorry, I just click the buttons without looking at the context.
Norxnor, I think you got the idea. Hell if you have written an application that displays the flow chart correctly, rewriting the the drawing method should be easy.
Have created a EMF file using corel / Illustrator software.
But this emf file does not have antialising effect applied on its image.
Just need some pointers on how the emf file records can be edited programmatically to include the antialising and other quality enhancing information.
Any links to source code are welcomed.
I wanted to show an animated gif on a Windows Form (C#). Using the ImageAnimator class I was able to animate the gif, but the every other frame is skipped. There are eight frames to the animation and only four are shown.
When the gif in previewed with another program every frame is displayed smoothly.
Has anyone here any experience working
with the MetaDraw component from Bennet-Tec.
I'm starting a new project and I'm looking
for a component that allows users to draw and later
to move shapes around - like in Visio but without every
user needing to purchase Visio ( required when using Visio ActiveX ).
MetaDraw seems to fit but I'd like to know if anyone
has experience using it. Also how is their support ?
Hi. I'm coding a C# application and I know nothing about GDI. I have a mdi parent form which has mdi child forms bigger than the screen. I overcome the form screen size limitation using the following code I've found on the net but now I have a problem: setting form.Location property doesn't work. Can you please tell me how to fix this?
Here's the code:
publicstaticexternint SetWindowPos(int hwnd, int hWndInsertAfter, int x, int y, int cx, int cy, int wFlags);<br />
protectedoverridevoid SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)<br />
SetWindowPos((int)this.Handle, 0, 0, 0, width, height, 0);<br />
This is really a NET Framework question, rather than a GDI question, but,...
I'm just guessing here, but, when you set or get a value for Location in your NET Form class, the framework at some point probably interops to the underlying Win32 API to do the actual work (probably SetWindowPos). And, by importing the original function with the System.Runtime.InteropServices.DllImport("user32") attribute, (Check out: PInvoke, SetWindowPos[^]) you are just short-circuiting the NET class implementation, which probably maintains a complex Form instance data structure somewhere in garbage-collected memory, and has a conflict now because the data are NOT what it expects, or something similar. Almost all of the NET Framework still interops its function calls, and it can be confusing from a developers point of view to maintain a consistent implementation.
The simplest method would be to use Form.Location property in the first place to set and maintain the correct value for your form's display. The MSDN documentation Control.Location[^] doesn't really explain that, though.
You might find this interesting: NET Framework Interoperability[^]
The article advises: "Before you decide to call a flat API using either of these interop technologies, you should determine whether there is equivalent functionality available in the .NET Framework. It is suggested that, whenever possible, you use .NET Framework functionality instead of calling unmanaged APIs."
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
I have a winform which has a UserControl in it that I use for drawing. The only drawing it does is creating rectangles made by user using mouse. Now, I need to add two comboboxes next to each rectangle. I created a UserControl which has two comboboxes in it. When a rectangle is done I create a new UserControl and it to the page, placing next to the new rectangle. Now this works fine but after a few rectangles (and combobox UserControls) the cpu usage goes off the charts while drawing new rectangle. While idle there's no cpu usage but drawing becomes impossible. With UserControl without comboboxes or without any UserControls (only drawed rectangles) this problem doesn't happen. Also I only have one Graphics, I use the only one comes with PaintEventArgs.
I'm not sure how your invalidating your form but if your invalidating the entire area everytime the dynamic rectangle is resized then you will see a performance hit. If your not familiar with Clipping an invalidation area, I suggest you do a google search on "Invalidation+Clipping".
If you could rent a programmer a hour and a half for a dollar and a half, how much would he charge for 10 hours?
I'm not sure how your invalidating your form but if your invalidating the entire area everytime the dynamic rectangle is resized then you will see a performance hit.
The UserControl displays an image as background. I use Refresh() at:
1. When new image is assigned
2. New rectangle is added
3. Rectangle is resized
Also on OnPaint() event I use graphics.DrawImage for the image and graphics.DrawRectangle for all the rectangles. Combobox UserControls are added with this.Controls.Add() and I don't do anything specific to draw them.
The form and UserControl size doesn't change at all.
I set double buffering true on drawing UserControl and on combobox UserControl.
I tend to never use Refresh(), I call Invalidate() instead.
Refresh is Invalidate+ImmediateRepaint which typically is more than what is really
necessary, so I suggest you try with Invalidate().
If that results in some parts not being updated, then your architecture is wrong;
Refresh() should be used only when it is essential to have something redrawn right away
say for better esthetics, not to get it right.