TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Administrator
Tech Writer
2.2k
1.5m
Layout problem
Mar 11 2003 5:32 PM
Hi! I have to create graphics out of form (for printing), but I have lot of trouble with layout. I tried to draw contents of a text box, but then I realized that spacing between characters in text box is different from spacing DrawString uses. You can see this if you try code below. In the code, text in text box and text for drawing have the same number of Ds, but they clearly have different widths. So does anyone know how to make spacing between chars in DrawString same as system uses to draw TextBox? Thanks! dejaniv System.Windows.Forms.TextBox tb = new System.Windows.Forms.TextBox(); System.Drawing.Font font = new System.Drawing.Font("Arial", 16); tb.Left = 0; tb.Top = 50; const string str = "DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD"; tb.Text = str; tb.Font = font; tb.BorderStyle = System.Windows.Forms.BorderStyle.None; tb.Width = 600; System.Windows.Forms.Panel pan1 = new System.Windows.Forms.Panel(); pan1.Left = 30; pan1.Top = 50; pan1.Width = 650; pan1.Height = 300; System.Windows.Forms.Form frm = new System.Windows.Forms.Form(); pan1.Parent = frm; tb.Parent = pan1; frm.Width = 700; frm.Show(); System.Drawing.Graphics g = pan1.CreateGraphics(); g.PageUnit = System.Drawing.GraphicsUnit.Pixel; g.DrawString(str, tb.Font, new System.Drawing.SolidBrush(System.Drawing.Color.Red), -5, 70);
Reply
Answers (
1
)
change icon at the left-up of window frame ???
CheckedListBox