From: Tony Toews [MVP] on
Folks

Overall objective is to, somehow, create a tab control on a form
without requiring any external controls.

Somewhere, somewhen I came across some really nice sample code which
uses code like the following.

For I = 0 To EmailBody_TabsCount - 1 ' draw raised borders
X1 = lblTab(I).Left ' for each lblTab
Y1 = lblTab(I).Top - 4
X2 = lblTab(I).Left + lblTab(I).Width - 2
Y2 = lblTab(I).Top + lblTab(I).Height
Me.Line (X1 + 1, Y1)-(X2 - 1, Y1), vb3DHighlight
Me.Line (X1, Y1 + 1)-(X1, Y2), vb3DHighlight
Me.Line (X2, Y1 + 1)-(X2, Y2), vb3DShadow
Me.Line (X2 + 1, Y1 + 2)-(X2 + 1, Y2), vb3DDKShadow
Next I

to draw the tabs. As well as a bunch of other code of course. This
all works great in the sample project and is, almost, working in my
project.

The problem for me though is that this fake tab control is on a form
with, so far, 12 frames which I make visible and not visible as
required. (I use a list box on the left hand side to determine which
frame to make visible.) This fake tab control is on one of those
frames

I think the lines being drawn are hidden by the frame. And I can't go
me.Frame12.line ....

Any suggestions or alternatives?

Thanks, Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files
updated see http://www.autofeupdater.com/
Granite Fleet Manager http://www.granitefleet.com/
From: Dave O. on

"Tony Toews [MVP]" <ttoews(a)telusplanet.net> wrote in message
news:unsqk59pna6lj0g37i3f98tmm3ok7qrj1r(a)4ax.com...
> Folks
>
> Overall objective is to, somehow, create a tab control on a form
> without requiring any external controls.

> I think the lines being drawn are hidden by the frame. And I can't go
> me.Frame12.line ....
>
> Any suggestions or alternatives?

Frames don't have a hDC which is why themes don't work properly with them.
This might explain why you are having problems drawing lines on them.
2 alternatives suggest themselves -
1 - Use the line control instead of plotting the lines.
2 - Replace the frames with picture boxes.

Personally I'd go for 2, but you should use whatever works for you.

DaveO.


From: mayayana on
I use a method of Labels in a PictureBox.
It works well for me.

I based my own code loosely on Jerry French's
tab control, but simplified it by just using the VB
Label and Line where he was using API drawing:

http://www.jerryfrench.co.uk/etabsim.htm


>
> Overall objective is to, somehow, create a tab control on a form
> without requiring any external controls.
>
> Somewhere, somewhen I came across some really nice sample code which
> uses code like the following.
>
> For I = 0 To EmailBody_TabsCount - 1 ' draw raised borders
> X1 = lblTab(I).Left ' for each lblTab
> Y1 = lblTab(I).Top - 4
> X2 = lblTab(I).Left + lblTab(I).Width - 2
> Y2 = lblTab(I).Top + lblTab(I).Height
> Me.Line (X1 + 1, Y1)-(X2 - 1, Y1), vb3DHighlight
> Me.Line (X1, Y1 + 1)-(X1, Y2), vb3DHighlight
> Me.Line (X2, Y1 + 1)-(X2, Y2), vb3DShadow
> Me.Line (X2 + 1, Y1 + 2)-(X2 + 1, Y2), vb3DDKShadow
> Next I
>
> to draw the tabs. As well as a bunch of other code of course. This
> all works great in the sample project and is, almost, working in my
> project.
>
> The problem for me though is that this fake tab control is on a form
> with, so far, 12 frames which I make visible and not visible as
> required. (I use a list box on the left hand side to determine which
> frame to make visible.) This fake tab control is on one of those
> frames
>
> I think the lines being drawn are hidden by the frame. And I can't go
> me.Frame12.line ....
>
> Any suggestions or alternatives?
>
> Thanks, Tony
> --
> Tony Toews, Microsoft Access MVP
> Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
> Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
> For a convenient utility to keep your users FEs and other files
> updated see http://www.autofeupdater.com/
> Granite Fleet Manager http://www.granitefleet.com/


From: Tony Toews [MVP] on
"mayayana" <mayaXXyana(a)rcXXn.com> wrote:

> I based my own code loosely on Jerry French's
>tab control, but simplified it by just using the VB
>Label and Line where he was using API drawing:
>
>http://www.jerryfrench.co.uk/etabsim.htm

Very nice. I'll play with that for a bit.

I was going to whine a bit about how I like the selected tab to have
it's text bolded just like in Access. But then I looked in Access and
no, it doesn't do that. <chuckle> It does look exactly like the one
in Access. The tab code I mentioned bolds the text.

Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files
updated see http://www.autofeupdater.com/
Granite Fleet Manager http://www.granitefleet.com/
From: Tony Toews [MVP] on
"mayayana" <mayaXXyana(a)rcXXn.com> wrote:


> I based my own code loosely on Jerry French's
>tab control, but simplified it by just using the VB
>Label and Line where he was using API drawing:
>
>http://www.jerryfrench.co.uk/etabsim.htm

Looks like I have to do my own control visibility switching but that's
not a big deal.

Hmm, that control requires OLE Automation/STDOLE.TLB. Is that going
to cause me any troubles in the future? I'm pretty sure TLBs are
only required during design and compile time and not during runtime.

Working very nicely.

Thank you!

Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files
updated see http://www.autofeupdater.com/
Granite Fleet Manager http://www.granitefleet.com/