Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Strikethrough in Details (Text Box) 2

Status
Not open for further replies.

OOzy

Programmer
Jul 24, 2000
135
SA
Dears,

How can I show a text box struck-through. I used the Line Hide Show method but this does not work if I used the CAN GROW feature. Also, I could not find a Struck-through font. Is there any other way?

Thx
 
I am going to take a stab at this one, and say that it can not be done. In Word strikethrough is not a type of font but an "effect" on that font. The only thing you have available to a control are, Bold, Italic, Underline, Size, and Type of font.
I did not try it because I could not load the active X control, but you may want to try to use a Microsoft Rich Text Box control. You won't be able to bind the field, but if you can get it to strikethrough you can write the code to get the value in it.
 
Again, my computer is jacked up, but try using a Microsoft Forms Textbox. This will give you a standard VB textbox not an access textbox. I am pretty sure you can strikethrough using that.
 
OOzy,

Good question. I think it's one of those things that Access "just doesn't do". I believe the access equivalent would be Text.Enabled = False.

So here's a work-around if you really need it.


This should work with growing/shrinking textboxes, but you have to be able to add a bit of space on the existing textbox top margin.

Copy your textbox and paste it twice onto the form. Let's say T1 was your original and you now have added T1a and T1b. Delete any labels that are copied and pasted along with it.

1. Set the ForeColor of T1a to match the BackColor.

2. Set the BackStyle of T1 and T1a to Transparent.

3. Set the Top Margin of T1 to 0.05

4. Set the Bottom Margin of T1a & T1b to 0.05

5. Set the Font Underline of T1b to Yes

6. Set the Visible property of T1b to No

7. Send T1a to back

8. Send T1b to back

9. Set the Top and Left properties of T1a and T1b to the same values as T1.

You now have three text boxes stacked on top of each other. They all have the same recordsource but they all display it differently.

Since they have either the top margin or the bottom margin set to the same value, they will grow and shrink identically. The two new textboxes will display the text a little higher than the existing textbox, but you will never see that text. The middle textbox has its font set to match the backcolor and it covers the text in the bottom text box. The only thing it doesn't cover is the underline. That underline, shifted upward by the margins, becomes your strikethrough and matches the length of your text no matter what.

When you want the strikethrough effect, set the visible property of T1b to True with code.

I wish I had found a "real" way to do this, but I couldn't. If someone else does, it would be great to see it posted!

HTH







John

Use what you have,
Learn what you can,
Create what you need.
 
Sorry, I left out number 10:

10. Set Tab Stop & Enabled to 'No' and set Locked to 'Yes' for the two new text boxes (T1a and T1b).

John

Use what you have,
Learn what you can,
Create what you need.
 
Drop a Microsoft Forms textbox control on your form. This code works fine. It is a bound control, works just like an access text box, and almost everyone should have the control class:

ocxText.Font.Strikethrough = True
 
Good job, MajP!

John

Use what you have,
Learn what you can,
Create what you need.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top