Style sheets

R

Robert Bull

I am creating a menu with the ComponentOne tools that come with the
..Net resource kit. I am trying to apply a style sheet to the controls
of the menu but I dont know how. Do I need to add a new style sheet or
can I use the styles.css? If I add a new style sheet, how do I apply
it to the menu controls? There is a property in the properties window
called CssClass but I dont know what to put there. I have never used
style sheets for anything in .net so I am pretty lost. Thanks in
advance.

-Rob
 
G

Guest

The CSSClass property takes a string value. Assume that a Web form has a text box control called "TextBox1", you would set the CSSClass property with this statement: TextBox1.CSSClass="TBStyle". "TBStyle", in this instance, would need to be defined in your style sheet. If you're going to use Styles.css (the default style sheet in a Visual Stuio.NET project) you need to include this directive in the <HEAD> tag in your .aspx page: <LINK href="Styles.css" type="text/css" rel="stylesheet"

From what I've seen, VS.NET does not seem to automate the insertion of the stylesheet directive into an .aspx page in any way. This seems rather curious, since there are so many other nice code-generation features in VS

By the way, once you've established a style sheet, you can instantiate style objects in your code, something like this

Dim MyStyle as New Styl
MyStyle.CssClass="TBStyle

Then, the style objects are usable with the ApplyStyle and MergeStyle methods of individual control objects. Personally, I've found this to be quite useful for getting things to really look the way I want them to
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top