Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to make checkbox small in C#.net

Posted on 2006-07-06
14
Medium Priority
?
553 Views
Last Modified: 2008-02-01

I am using C#.net to develop a web form. I need a few very small checkbox on the form. However, the smallest that I can get from C#.net is xx-smaller.

Any idea?

Thanks,
0
Comment
Question by:penglu
  • 5
  • 3
  • 2
  • +2
12 Comments
 
LVL 25

Expert Comment

by:Rouchie
ID: 17056604
I don't believe this is possible to achieve because the operating system controls the size of the textbox, not the browser.  They are always rendered at a standard size.
I've tried this morning using html and css but neither affect the checkbox size.
0
 
LVL 3

Expert Comment

by:zawedikian
ID: 17056771
hey
u can give the checkbox a css class and in the class (for ex checkstyle),

put

.checkstyle
{
size = 10px
}
0
 
LVL 25

Expert Comment

by:Rouchie
ID: 17056860
zawedikian - that doesn't work.  SIZE is not a valid CSS property name.

The correct property names, size and width do not affect the checkbox size:
   style="width:50px; height:50px"

Increasing the font size does also not work.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Expert Comment

by:Priyang
ID: 17056974
It wont work ,

U need to change put the following in InitializeComponent

checkbox1.Size = new System.Drawing.Size(192, 24);

By changing the values in braces u  can change size.
     
0
 
LVL 3

Expert Comment

by:zawedikian
ID: 17058033
hi
Rouchie is right. i meant by size the width. in the css class, u can out width = 10px for ex.
the use of css class is better than putting them near every checkbox. bcz if u decide to change the size or the color or whatever of the checkbox, u do it in the class only and not on every checkbox.

0
 
LVL 25

Expert Comment

by:Rouchie
ID: 17058068
As far as I know there is no way to alter the size of a checkbox.  Come to think of it, I have never seen this done before.  You have 2 alternatives though penglu:

 1. Use a Flash-based form (might involve learning Macromedia Flash)
 2. Use an image of a checkbox instead, and use javascript to swap it when checked
0
 

Author Comment

by:penglu
ID: 17058400

Hi,

Thanks for the response. Howver, I have tried using css

<style>
    input.chk {height:8px; width:8px; margin:0px;}
</style>

the size of check DOES change, but the text on the right side of the checkbox is not aligned well with the text, which is not as good as the server side checkbox.

Peng

0
 
LVL 25

Expert Comment

by:Rouchie
ID: 17058580
Whoa - I've not seen that before!  Note that it doesn't work in Firefox!  All I get in Firefox is a huge white space with the normal sized checkbox in the center!
0
 
LVL 25

Expert Comment

by:Rouchie
ID: 17058594
Can you use CSS to align the text?

<input type="checkbox" name="option1" value="Choice" style="height:8px; width:8px; vertical-align:middle;"> Choice<br/>

or

    <span style="vertical-align:middle;">
        <input type="checkbox" name="option1" value="Choice" style="height:8px; width:8px;"> Choice
    </span>
    <br/>
0
 

Author Comment

by:penglu
ID: 17058997

<input type="checkbox" name="option1" value="Choice" style="height:8px; width:8px; vertical-align:middle;"><font style="height:8px; width:8px; vertical-align:middle"> Choice</font><br/>

works OK.
0
 
LVL 3

Expert Comment

by:zawedikian
ID: 17059013
hi
for the text, u can use text-padding or padding (from bottom or top)...
0
 
LVL 1

Accepted Solution

by:
DarthMod earned 0 total points
ID: 17677934
PAQed with points refunded (250)

DarthMod
Community Support Moderator
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses
Course of the Month20 days, 19 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question