Newbie having trouble with brush1.New1()

Discussion in 'Questions (Windows Mobile)' started by mjcoon, May 25, 2008.

  1. mjcoon

    mjcoon Well-Known Member Licensed User

    I grabbed a coding example from the forum that includes the line


    But whatever I do with the parameter (using a varable or RGB()) I get a pop-up saying that the "parameter is not valid".

    What could be causing this, please?

    (I am a complete newbie with Basic4PPC trial edition, hoping to make enough progress to justify a purchase. But I have decades of programming experience in multiple languages.)

  2. Cableguy

    Cableguy Expert Licensed User

    Hi Mike,

    Could you post your code?
    What version of Basic4Ppc are you using?
    Is the error relative specificaly to that code line?
    Did You had the necessary DLL in the components, and the apropiate object?

    Last edited: May 25, 2008
  3. klaus

    klaus Expert Licensed User

    After having installed the library and added a brush object, you must initialize the object with:
    brush1.New1(cBlue) or
    brush1.New1(RGB (100,124,55))

    Afterwards you can modify it's color whenever you want with:
    brush1.Color = cRed or
    brush1.Color = RGB (100,100,100)

    Best regards.
  4. mjcoon

    mjcoon Well-Known Member Licensed User

    Thanks for your prompt replies.

    The code isn't "mine"; as I said I just got it from a tutorial so I had to work out how to create the matching objects.

    Sub Button1_Click
    drawer.New2(bitmap1.Value, B4PObject(5)) 'The drawer will draw on bitmap1
    brush1.Color = cBlue
    rect1.Width = 40
    form1.DrawImage(bitmap1.Value,10,10) 'Draws bitmap1 on form1
    End Sub​

    If I try retyping the offending line, the hint I get does not include any NewX() with a color parameter. Example: New2(width, height) instead. If I change the code then I get past the problematic line to the next one (which also fails).

    I cannot believe that you-all would publish sample code that does not work, so what is happening?

    Cheers, Mike.
  5. Erel

    Erel Administrator Staff Member Licensed User

    I don't see any problem with this code.
    You can download and test it.
  6. mjcoon

    mjcoon Well-Known Member Licensed User

    Thank you Erel, I have tried your and it works just as you say. Also when I alter the "brush1.New1()" line the hint says that the parameter is just "color", which fits the code. I shall just have to go back and try to repeat what I was doing before more carefully!

    Cheers, Mike.
  7. mjcoon

    mjcoon Well-Known Member Licensed User

    Yes, I eventually verified that I had created my brush1 as the wrong type of object. In the desktop that could easily be seen but I don't know how to see it on the device. I just checked the hint list of methods which didn't match Brush. Could the object type be displayed somehow, perhaps in the Delete-object list?
  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