I need Help for ImageLibExDesktop

Discussion in 'Questions (Windows Mobile)' started by berndgoedecke, Aug 3, 2009.

  1. berndgoedecke

    berndgoedecke Active Member Licensed User

    Hello AGraham,
    I want to create an own report format that repots SQLite- datas on an "A4 - sheet". Because the Desktop is the right platform to do this, I played arround with your ..DesktopEx-Libs.
    Now i have a problem with the ImageLibExDesktop Library. I want to use the FormEx-Lib to get a window with variable position and dimension, place a Panel and an Image on it and activate the Autoscroll-function to work with Images, bigger than the panel. That works.
    But now I want to use the Drawer from ImageLibExDesktop and ui get an error (translated from german): It isn't possible to create a graphics object from an subscripted pixelformated image.
    Attached you find my first try-out. I hope there is a solution for the problem.
    (If you want to see how it works, please rem-out the the Line with this hint:<--------- Here I get the errormessage)
    Best regards

    Bernd Gödecke
     
  2. agraham

    agraham Expert Licensed User

    The error message is incorrect for some reason. The real problem is that you don't have an image assigned to Image1 because BitmapEx does not contain an image. You can see this by

    Code:
    Image1.Image = BmapEx1.Value
       
    Msgbox(IsNull(Image1,image)) ' Displays True
       DrawEx1.New2(Image1.Image)  ' <--------- Here I get the errormessage
     
  3. klaus

    klaus Expert Licensed User

    The problem is that your A4.jpg file has a wrong format.
    I suppose it is a black and white image.
    I transformed your A4.jpg file into a 24bit bitmap and changed it back to A4.jpg, and it works.
    I found the reason because I assigned the DrawerEx.New2(Image1.Image) not to Image1.Image but to DrawerEx.New2(BmapEx1.Value), then I got an error message saying that the image format was not correct. With the new A4.jpg file the program works also with DrawerEx.New2(Image1.Image)

    Attached the new A4.jpg image and a new version of the program with some modifications.

    Best regards.
     
  4. berndgoedecke

    berndgoedecke Active Member Licensed User

    Next try with MDI child

    Hello AGraham and Klaus,
    first thank you, Klaus (Danke!!) for the helpfull hint about the Black/White Image, but for the things I want to do the solution with the panel and the Image is a dead end. (an Image has no transparent property !!)

    In former times i wrote Graphic-Programs in GFA-Basic for Atari there it was easy to draw by multiply the background with the pen and if the position of the pen was changed multiply again and the Image wasn't damaged by the previous position.

    Now it seems that it is necessary to have layers, to prevent a damage for the Image. So I tried to add the AutoScroll property to an MDI child, to use the back- and forelayer of the form.
    I tried : frm1obj.Value = FormEx2.ControlRef (frm1obj as Door object)
    frm1obj.SetProperty("AutoScroll", True)

    and frm1obj.FromControl("Form2")
    frm1obj.SetProperty("AutoScroll", True)

    at different positions in the source before running the parent-form and after but scrollbars apears at the MDI child.
    Is there a way to have AutoScroll property for the -child ????

    Best regards

    Bernd Gödecke
     
  5. agraham

    agraham Expert Licensed User

    FormEx does not have Fore and Back layers, it is a standard Windows Form. A Basic4ppc Form does have layers, they are there so that your drawing is persistent and you don't have to bother with handling Paint events, a Basic4ppc Form handles the painting for you. In a FormEx if you are drawing on the FormEx itself you will need to do your drawing in the Paint event or your drawing will not be persistent.

    I am afraid that I don't understand how Scrollbars relate to drawing layers.:confused:
     
  6. berndgoedecke

    berndgoedecke Active Member Licensed User

    Bad formulated question

    Hello Andrew,
    ok, it was a not well formulated question. I'll try again.
    I want to use the backlayer of a form that is an MDI child to display the Image and the forelayer is used to paint without changing the backlayer image.
    Because th image is larger than the screen of the MDI-child window I need some scrollbars.
    Is this understandable and much more important, is it possible ?

    Best regards

    Bernd Goedecke
     
  7. agraham

    agraham Expert Licensed User

    If you want to use fore and back layer drawing you will need to use a Basic4ppc Form as the MDI child. However layers are always the size of the client area of the form so you can't scroll them.

    To display an Image larger than the client area you will need to use an Image control on a Form or FormEx as the MDI child. I would expect to be able to scroll it if it is bigger than the client area but I haven't tried it so you will have to try it yourself.

    I am afraid that I don't have an answer to drawing on the image then erasing what was drawn other than copying all or part of a copy of the original image back on to it.

    If you need mouse information to draw on an Image control you will need to add the appropriate events with the Door library.
     
  8. klaus

    klaus Expert Licensed User

    Instead of drawing on an Image, you can also draw on a BitmapEx object and copy the desired area of the bitmap on background of the Form. The forelayer can be used for the drawing operations like rubberbanding.

    The bitmap can be bigger than the screen and with 2 ScrollBars you can move the image.
    You can have a look at these programs:
    http://www.basic4ppc.com/forum/share-your-creations/3945-draw-program.html pixel drawing
    http://www.basic4ppc.com/forum/share-your-creations/3674-scaled-maps.html vector drawing

    Best regards.
     
  9. berndgoedecke

    berndgoedecke Active Member Licensed User

    Rubberbanding on FormExDektop

    Hello Klaus,
    first belated thanks for your hints and examples. But how I have seen, all the programs are using B4P forms with back- and forelayers, to have a rubberband drawing. I want to use a FormExForm from Andrews's FormExDesktop library.
    I added two Attempts to realise rubberband drawing on a FormExForm.
    One is called Report the other is Reporta.
    I use an image in Report and the "background" image stands still while drawing.
    In Reporta I draw directly on the Form and the "background" image isn't standing still. In both versions the hole background image must be redrawed by
    drawer.drawimage command. But i don't find the difference to have the same appearance in Reporta as in Report. Do you have any suggestion ???

    PS: The button "Seitenansicht" only works in one way a second click to get the normal view produced an undefiened error like ~~.

    best regards
    berndgoedecke
     
  10. klaus

    klaus Expert Licensed User

    Hallo Bernd,
    I am actually on travel, I'll be back in 2.5 weeks.
    I will have a closer look at your question when I'm back home.

    Best regards.
     
  11. berndgoedecke

    berndgoedecke Active Member Licensed User

    No more need to have a closer look

    Hello Klaus,
    thanks for your helpfull relief. I think it is no more necessary to have a closer look at Report and Reporta, but if you want, have a look at Report02.
    It's a way to draw on Desktop where I can live with. :)

    best regards
    berndgoedecke
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice