Results 1 to 4 of 4

Thread: Top left pixel of shape is not drawn

  1. #1

    Thread Starter
    Member
    Join Date
    May 2017
    Location
    The Netherlands
    Posts
    42

    Top left pixel of shape is not drawn

    Hi everyone,

    I've encountered some weird VB6 behavior, and searching the internet doesn't help much. I doubt that I'm the first with this problem though.

    Anyway. Here's how to reproduce it:

    1. Create a new VB6 project.
    2. Add a new UserControl to the project.
    3. Set the BackStyle of this UserControl to 0 - Transparent.
    4. Place a rectangle Shape on the UserControl, with, solely for the sake of convenience, Left and Top close to the Left and Top of the UserControl.
    5. Don't touch any of the Shape's other properties.
    6. Put an instance of the UserControl on the Form and run the project.

    The top left pixel of the shape is not drawn. How can this be fixed?

    Thanks!
    Cooz

  2. #2

    Thread Starter
    Member
    Join Date
    May 2017
    Location
    The Netherlands
    Posts
    42

    Re: Top left pixel of shape is not drawn

    An acceptable workaround is the addition of a 1 pixel high and wide line in this top left corner.
    Problem solved as far as I'm concerned - although the behavior remains strange.

    Kind regards,
    Cooz

  3. #3
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,853

    Re: Top left pixel of shape is not drawn

    Interestingly, it seems to only be a problem with the combination of a UC and a shape. It's not just lightweight controls either, as I tried with a label and it works fine. It works fine with a textbox too. It also works fine if you push a line into the top-left corner of a UC.

    And, just to say it, a shape works fine if it's not on a UC.

    That one is truly a mystery.

    Best Regards,
    Elroy

    EDIT1: A refresh of the shape on the UC doesn't help either. It just repaints it, still with the missing pixel. It's also strange that it's not a problem in the IDE design-mode. It's only during runtime that there's a problem.
    Last edited by Elroy; Jun 7th, 2018 at 07:43 AM.
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  4. #4
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Top left pixel of shape is not drawn

    Don't know what other controls you plan on adding to that UC. But setting the Windowless property to True fixes that specific problem.

    Another option could be to simply use APIs to draw a rectangle, oval, circle.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width