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
PilarMI BertinGA
NA
39
1.6k
problem with font size in WPF
Feb 11 2021 1:46 PM
Hi, im programming with c#, and im doing one form using WPF, and i need show texts on it. Im using code below to draw text, but font size appears smaller than size indicated (i defined as arial 160, and appears about 118). I dont know what im doing bad, somebody can help me please. Also, over text appears a space, i want that text starts at heigh indicated in texbox position not below; you can see small line as texbox container.
thanks a lot.
TextBox textBox =
new
TextBox();
textBox.BorderThickness =
new
Thickness(1);
textBox.IsHitTestVisible =
false
;
textBox.Focusable =
false
;
textBox.TextWrapping = TextWrapping.WrapWithOverflow;
textBox.VerticalScrollBarVisibility = ScrollBarVisibility.Hidden;
textBox.HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden;
textBox.Tag = (
object
)mText.Id;
textBox.Text = mText.Text;
textBox.FontSize = mText.Size;
textBox.Foreground = XDisplay.ConvertStringColorToBrush(mText.Color);
textBox.Background = XDisplay.ConvertStringColorToBrush(mText.BackgroundColor);
textBox.FontFamily =
new
FontFamily(mText.FontName);
textBox.FontWeight = mText.Bold ? FontWeights.Bold : FontWeights.Normal;
textBox.FontStyle = mText.Italic ? FontStyles.Italic : FontStyles.Normal;
textBox.Opacity = mText.Opacity;
textBox.Width = mText.Width;
textBox.Height = mText.Height;
textBox.TextAlignment = (TextAlignment)mText.Alignment;
Canvas.SetTop(textBox, mText.Y);
Canvas.SetLeft(textBox, mText.X);
Panel.SetZIndex(textBox, mText.Layer);
return
textBox;
Reply
Answers (
7
)
C# Showing pictures from "DataGridView" on RDLC report image
login credentials are not displaying in database