GDI+ questions

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi,

I'm using GDI+ api to draw a day time planning into a picture, it's great,
very fast and import of png with transparency is very neat.

I have one problem, 90% of the time, I don't need to redraw all the picture,
the background is the same and only the items on it changes.

I would like to make a copy of this background and when I need it redraw it
using GdipDrawImageRectRectI (which I use to draw items on my planning and
work very well) instead of redrawing completly the background using
rectangle, line, ... functions.

I tried a lot of thing to save a copy of my background before drawing the
items (GdipCreateBitmapFromGraphics, GdipSaveImageToFile, ...) but I'am not
able to get this background saved. For example, the function
GdipCreateBitmapFromGraphics send back 0 (everything ok) but when I try to
draw the resulting image, nothing. (actually, I save the picture box on the
disk using dev tools native function and redraw the background using
GdipLoaImageFromFile/GdipDrawImageRectRectI combo wich is quite slow)

Do you have any idea of what I am doing wrong ?

My second problem is to refresh the screen after drawing. I tried API like
InvalidateRect, InvalidateRgn, ... to no avail, if I move another windows on
top of my program and then remove it ... the screen refresh correctly (my
software development tools don't have redraw property, I must use an API)

Any help will be much apreciated.

As English is not my native language, if you need me too explain better,
please ask.

Many thanks,

Albert P.


.



Relevant Pages

  • Re: Text and picture
    ... Just draw your picture into a VB Picture Box (use PaintPicture or the API ...
    (microsoft.public.vb.general.discussion)
  • Re: How to save a picture drawn in applet as a "BMP" file
    ... > draw a picture, how to write code for saving that picture to a file? ... I think u need> 1.4 for that, just have a look at the API. ...
    (comp.lang.java.gui)
  • Re: Custom ScaleMode setting problem
    ... It sets up a picture box in the way that you require. ... In this way you can draw the finished graph at any physical location and size you require, opaquely or transparently, and you can draw it to the printer in a way that takes full advantage of the printer's high resolution. ... Private pOffsetX As Single, pOffsetY As Single ...
    (microsoft.public.vb.general.discussion)
  • Re: lines dont stay on form...
    ... Personally for such jobs I would draw ... On way to achieve what you're after and still use your existing "picture ... Private xCentre As Single, yCentre As Single ... Private Sub Label1_DblClick ...
    (microsoft.public.vb.general.discussion)
  • Re: poplog-dev Re: pop-forum Overlapping moving picture objects [Was:
    ... you redraw the whole window, but if you redraw only parts near the ... So you don't draw *anything* when an object moves. ... As I said, it's conceptually very simple and robust, and not ... I suspect that dragging behind other objects would be tricky using the ...
    (comp.lang.pop)