views:

983

answers:

4

I am creating reports in visual studio and am looking for a way to specify a default font and size apply to a textbox each time I drop one onto the designer.

Update: This is not winforms or webforms development, but using the report designer in visual studio. My biggest issue is that a text box by default is .25 inches in height and after I change the font from Arial, 10pt to Tahoma, 8pt the textbox needs to be changed to .2 inches in height.

A: 

I think that the common properties are inherited from the parent container so if you change the font size and style in the parent form It will change the default to the new child controls.

pablito
A: 

@john's answer seems to be the correct answer in this case but since the question was worded vaguely it could get hits for WebForms as well so I will leave my answer here

For WebForms:

You are looking for a control skin

All you have to do is create a .skin file within your App_Themes Folder and in here you can place the default for any controls that you want to set one for such as your textbox but if you want to have more than one then you need to set a skinId

<asp:TextBox runat="server" CssClass="skin_Textbox" />
<asp:TextBox runat="server" skinID="txt_"  Width="20px" CssClass="skin_Textbox" />
jmein
A: 

The simple thing you can do is drop a textbox, set the attributes you want (size, font).
And, then copy/paste to create new textboxes (which will have same attributes as the copied textbox).

shahkalpesh
+1  A: 

Folks, I could be off-base here, but based on the tags (specifically, ssrs-2008 -- SQL Server Reporting Services), I'm guessing the original poster isn't referring to WinForms nor WebForms (where answers by @pablito and @jmein would apply).

I had the same issue in the SSRS under VS2005. My team got around it by laying out the entire report first, with no formatting at all. After the entire report was laid out, we painstakingly shift-clicked to select multiple report elements at a time, and then set the properties accordingly.

If you're intimately familiar with the report XML format, you could also attempt to to run the report file through an XSLT transformation to add the appropriate missing formatting XML. If you got this working, it'd be SLICK, but I personally wouldn't go to the trouble unless I knew I'd need that exact same formatting on multiple reports.

John Rudy
+1 You are probably right, but if so then he should really specify more in the question instead of leaving it so generic. You should to look up what the tags mean in order to understand the question.
jmein
True that. :) I was about to post the WinForm parent container answer myself when I realized there were answers across a variety of UI technologies. :)
John Rudy