Solved

How to make checkbox small in C#.net

Posted on 2006-07-06
14
541 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
14 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

770 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