Hi , Can someone one help me please.I'm begginer in C#, and I try to learn it , but I need help.
I have in my form 2 spliterPamels, in one of them I want to display text when form is load. The problem is that I want to create the text dinamicaly but it doesn't work . Here is the code I try to test
protected override void OnPaint(PaintEventArgs e)
{
paint_Text(e.Graphics);
base.OnPaint (e);
}
....
private void paint_Text(Graphics gr)
{
int beginYtop = mainsplitContainer.Panel2.Margin.Top;
int beginXtop = mainsplitContainer.Panel2.Margin.Left;
int beginYbottom = mainsplitContainer.Panel2.Margin.Bottom;
int beginXbottom = mainsplitContainer.Panel2.Margin.Right;
RectangleF rect = new RectangleF(beginYtop + 10, beginXtop + 10, beginYbottom - 10,
beginXbottom - 10);
Font objFont = new System.Drawing.Font("Lucida Console", 12, FontStyle.Italic);
StringFormat sf = (StringFormat)StringFormat.GenericTypographic.Clon e();
sf.Alignment = StringAlignment.Center;
sf.LineAlignment = StringAlignment.Center;
sf.Trimming = StringTrimming.EllipsisWord;
gr.DrawString("ERRR", objFont, System.Drawing.Brushes.Azure,
rect, sf);
objFont.Dispose();
}
...
private void Form1_Load(object sender, EventArgs e)
{
Graphics g = Graphics.FromHwnd(this.Handle);
paint_Text(g);
}
Can you pese help me,
Thank you