Results 1 to 13 of 13
  1. #1
    Lhoj is offline Advanced Beginner
    Windows 10 Access 2013 64bit
    Join Date
    Jun 2021
    Posts
    92

    Adding form borders without title bar


    Is there any way to hide the title bar on pop up forms while still being able to add a thin border to them? I don't see any option to set up a border that doesn't bring the title bar back. I've tried manually setting up a thin rectangle around the form but I can't seem to add it to the whole form, just to the header and detail sections separately. Using Access 2013.

    Thanks!

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    title bar will appear except if no border specified.

    there are two solutions that immediately come to mind

    method 1
    1. set the back colour for header, footer and detail to the colour of your border
    2. create a box in each section with a white (or other colour) back colour and border set to transparent and sized to the width less a bit for the border to show, full height for detail and allow for border width for top and bottom
    3. send them all to back
    4. set the form border to none

    method 2
    1. create a new form, detail section only
    2. set the back colour to the colour of the border
    3. drag your form onto this new form as a subform and size to leave a border
    4. set the subform border to transparent if required
    5. set the new form border to none

  3. #3
    Lhoj is offline Advanced Beginner
    Windows 10 Access 2013 64bit
    Join Date
    Jun 2021
    Posts
    92
    Thanks for the answer, Ajax. Hadn't think of #1, it seemed a clever workaround, but for some reason even if there's no visible gap at the bottom of the header or top of the details section on the design view there's still a thin line of the background (border) colour on the form between the header and the details section. Either I'm not adjusting it perfectly, my custom form placement function is somehow stretching either section a bit or it just adds a thin line of background no matter what. Method #2 sounds like it would work much better but it would require a handful of extra forms to accommodate every form of the application as a subform. Not discarding it but will probably leave that as a last resort.

    I was certainly expecting there would be a cleanlier way to do that. Removing the title bar and still wanting to add a border seems like a normal thing to me that Microsoft should have covered. Maybe I'll just try to set a background colour for the header and details that would stand out against most possible backgrounds. The thing is I'm removing Access UI for my application so they could stand on top of literally anything the user might have on the screen. Either that or redesign my forms so that they don't look absurd when maximized, but I'd rather use your #2 method before that.

  4. #4
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    I just use a transparent rectangle almost the same size as the Detail section with its border width = Hairline & colour the same as the Header/Footer sections.
    For example:

    Click image for larger version. 

Name:	Capture.PNG 
Views:	22 
Size:	31.3 KB 
ID:	45519

    That works perfectly for me whether or not the Access UI is hidden

    I use borderless forms a lot. In my opinion, a bigger issue with borderless forms is that you cannot normally move them on the screen by dragging with a mouse. However I have code that uses APIs to make borderless forms movable.
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  5. #5
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    For method 2 you only need the one parent form, just change the source object for the subform control - but you may need code to resize the form and subform depending on the size of the source object

    With regards the boxes use code in the form resize event

    Hdrbox.top=60
    Hdrbox.height=header.height
    Detbox.height =0
    Etc

  6. #6
    Lhoj is offline Advanced Beginner
    Windows 10 Access 2013 64bit
    Join Date
    Jun 2021
    Posts
    92
    Thank you both for the suggestions. You're right Ajax, I could reuse the same container form, it would be too much work for the benefit though. Tried isladogs suggestion and it worked well, had to programmatically adjust the box and footer sections (because the bottom border wasn't showing at all) after placing my form and for some reason the left border is a little thinner than the rest but with the following it's working pretty good:
    Code:
        
        CentrarFormulario Me    'Custom placement function
        Me.Borde.Left = 0
        Me.Borde.Top = 0
        Me.Borde.Width = Me.Form.InsideWidth
        Me.Borde.Height = Me.Form.InsideHeight
        Me.Section(acFooter).Height = 30
    Click image for larger version. 

Name:	Border.PNG 
Views:	23 
Size:	46.6 KB 
ID:	45524

    If any of you know of a way of adjusting that left margin separately (because tweaking the box placement to push it further to the right always results in a error telling the element is too big for the container). I tried setting the box's width to the inside width minus the border width and placing the box left side at 0 plus the border width and still got the same error.

    Anyway, I'm content as it is so I consider it solved regardless if I can make all borders equal or not. Thank you very much!

  7. #7
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    perhaps something like

    Me.Borde.Left = 1
    Me.Borde.Width = Me.Form.InsideWidth-1 (or -2), Colin will be using something like 200

    and/or perhaps adjust the border width to 1 or 2 points

  8. #8
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    Quote Originally Posted by Lhoj View Post
    If any of you know of a way of adjusting that left margin separately (because tweaking the box placement to push it further to the right always results in a error telling the element is too big for the container). I tried setting the box's width to the inside width minus the border width and placing the box left side at 0 plus the border width and still got the same error.

    Anyway, I'm content as it is so I consider it solved regardless if I can make all borders equal or not. Thank you very much!
    If you remember, I wrote:
    I just use a transparent rectangle almost the same size as the Detail section
    The trick is to set the box left position VERY slightly greater than 0 e.g. 0.011cm and reduce the box width accordingly e.g. form width - 0.011cm
    (I tend to just use the property sheet for this rather than use code but the idea is the same either way. If using code: 0.011cm = approx 6 twips)

    That's what I did in the screenshot above...if you look very carefully, I didn't quite get the right edge perfectly aligned in that form...but its good enough in my opinion!

    I don't have the bottom border issue you describe as I always use a small form footer. I just think the overall effect looks neater even if there is nothing in the footer
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  9. #9
    Lhoj is offline Advanced Beginner
    Windows 10 Access 2013 64bit
    Join Date
    Jun 2021
    Posts
    92
    Thank you both. I was fixated on doing it reducing the width by the Borde.Borderwidth value and setting the left property to the same value and I either got the error telling the container was to small or didn't see any difference at all. Turns out the borderwidth value is 2 (points) and the left property takes twips as the unit, so moving it 2 twips did barely anything. Changed it to Left = 10 and width = innerwidth -10 and now it's pretty much equal everywhere, just had to reposition form's fields a bit and it looks exactly as I wanted it to.

    Again, thank you both so much, it was just an aesthetic thing but it was driving me nuts having my forms borderless

  10. #10
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    In case you don’t know, there are 1440 twips to an inch and 96 pixels. Ergo you need multiples of 15 twips to move in pixel units. With regards border width, 1 point is 1.333333 pixels or 20 twips. So you can do the math to work out exactly what is required- 3 full pixels = 4 points = 60 twips, work in these units which is approx 1mm for a consistent display (which includes calculating control positions/sizes)

    Not at my computer to check but pretty sure a 4 point border width is positioned 2 points either side of the designated position

  11. #11
    Lhoj is offline Advanced Beginner
    Windows 10 Access 2013 64bit
    Join Date
    Jun 2021
    Posts
    92
    I was aware of the 1:15 pixel to twip ratio, I was using that in that custom placement function for taking the user screen resolution into consideration. Didn't know though that 'points' where actually a whole different unit. It will be pretty useful to know their exact value. Thanks Ajax! Btw, I think in the last part you meant 4 pixels = 3 points and not the other way around.

  12. #12
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    Oops yes I did😃

  13. #13
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    As you will probably have realised, 1 point =20 twips so there are 72 points per inch.
    You may find some useful info related to this thread in my article on accurately positioning forms and controls: http://www.mendipdatasystems.co.uk/m...ols/4594549378
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 03-06-2021, 10:30 AM
  2. Replies: 5
    Last Post: 08-03-2016, 04:36 AM
  3. Replies: 2
    Last Post: 03-20-2015, 06:30 AM
  4. Form Borders
    By LadyMarmalade in forum Forms
    Replies: 9
    Last Post: 09-24-2014, 11:02 AM
  5. Replies: 20
    Last Post: 05-24-2010, 06:31 AM

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
  •  
Other Forums: Microsoft Office Forums