How can draw gradient on UserControl added in form in c#? - c#

When Form loaded will add UserControls 2 columns and multi rows
To show recently added data
The number of rows depending on the height of the screen.
The number of columns depending on the width of the screen
if ((int)count_columns == 2)
{
for (int sp = 0; sp <= (int)count_rows; sp++)
{
//add UserControl
latest latest1 = new latest();
latest1.Name = String.Concat("latest1_", sp.ToString());
latest1.Left = (leftPanel.Width + (int)space_between_columns);
latest1.Top = ((topPanel.Height + (32 * sp)) + (latest1.Height * sp)) + 32;
this.Controls.Add(latest1);
latest latest2 = new latest();
latest2.Name = String.Concat("latest2_", sp.ToString());
latest2.Left = (2 * (int)space_between_columns + latest2.Width + leftPanel.Width);
latest2.Top = ((topPanel.Height + (32 * sp)) + (latest1.Height * sp)) + 32;
this.Controls.Add(latest2);
}
}
when tried draw gradient on UserControl
private void latest1_Paint(object sender, PaintEventArgs e)
{
Pen white = new Pen(Color.White);
var rec = new Rectangle(0, 0, 500, 145);
var brush = new System.Drawing.Drawing2D.LinearGradientBrush(
rec,
Color.FromArgb(255, Color.DarkBlue),
Color.FromArgb(0, Color.DarkBlue),
90f);
e.Graphics.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.Half;
e.Graphics.FillRectangle(brush, rec);
}
nothing happened

Related

How to fix Emgu VideoCapture / ImageViewer memory leak?

I'm using Emgu CV to detect an object using a HAAR cascade, then I am sending the bounding box of the HAAR cascade to a CSRT motion tracker. Then I compute the centroid of the CSRT motion tracker and have a pan/tilt telescope mount that will move the camera until the centroid of the tracker and image are the same. In the code below I am using an .avi video file but I will eventually be using this with a live video camera.
I am using ImageViewer to display both the HAAR cascade and CSRT motion tracker at the same time. The problem is the CSRT motion tracker viewer is using all my RAM. If I comment out the viewer.ShowDialog(); line then there is no memory leak, but I also can't see the tracker.
This is on Windows 7 by the way, running Visual Studio 2017, .NET 4.7.3, Emgu 3.4.3.3016.
The HAAR cascade function was also causing a memory leak, but I was able to fix it by using .Dispose() on the mat file at the end of the function. It didn't help with the CSRT motion tracker function.
public void Tracker()
{
if (!this.detectedBBox.Width.Equals(0))
{
Emgu.CV.UI.ImageViewer viewer = new Emgu.CV.UI.ImageViewer();
Emgu.CV.Tracking.TrackerCSRT myTracker = new Emgu.CV.Tracking.TrackerCSRT();
using (Emgu.CV.VideoCapture capture1 = new Emgu.CV.VideoCapture("c:\\Users\\Windows7\\33a.avi"))
using (Emgu.CV.VideoStab.CaptureFrameSource frameSource = new Emgu.CV.VideoStab.CaptureFrameSource(capture1))
{
Rectangle myRectangle = this.detectedBBox;
Emgu.CV.Mat myFrame = frameSource.NextFrame().Clone();
myTracker.Init(myFrame, myRectangle);
Application.Idle += delegate (object c, EventArgs f)
{
myFrame = frameSource.NextFrame().Clone();
myTracker.Update(myFrame, out myRectangle);
if (myFrame != null)
{
int fXcenter = myFrame.Width / 2;
int fYcenter = myFrame.Height / 2;
int dx;
int dy;
int swidth = myRectangle.Width;
int sheight = myRectangle.Height;
int shalfwidth = swidth / 2;
int shalfheight = sheight / 2;
int sXcentroid = myRectangle.X + shalfwidth;
int sYcentroid = myRectangle.Y + shalfheight;
if (sXcentroid >= fXcenter) { dx = sXcentroid - fXcenter; } else { dx = fXcenter - sXcentroid; }
if (sYcentroid >= fYcenter) { dy = sYcentroid - fYcenter; } else { dy = fXcenter - sYcentroid; }
string caption = "Center point: (" + sXcentroid + "," + sYcentroid + ")";
string caption2 = "Dist from center: (" + dx + "," + dy + ")";
Emgu.CV.CvInvoke.Rectangle(myFrame, myRectangle, new Emgu.CV.Structure.Bgr(Color.Red).MCvScalar, 2);
Emgu.CV.CvInvoke.PutText(myFrame, caption, new System.Drawing.Point(10, 20), Emgu.CV.CvEnum.FontFace.HersheyComplex, .5, new Emgu.CV.Structure.Bgr(0, 255, 0).MCvScalar);
Emgu.CV.CvInvoke.PutText(myFrame, caption2, new System.Drawing.Point(10, 35), Emgu.CV.CvEnum.FontFace.HersheyComplex, .5, new Emgu.CV.Structure.Bgr(0, 255, 0).MCvScalar);
Point start = new Point(fXcenter, fYcenter);
Point end = new Point(sXcentroid, sYcentroid);
Emgu.CV.Structure.LineSegment2D line = new Emgu.CV.Structure.LineSegment2D(start, end);
Emgu.CV.CvInvoke.Line(myFrame, start, end, new Emgu.CV.Structure.Bgr(0, 255, 0).MCvScalar, 2, new Emgu.CV.CvEnum.LineType(), 0);
string caption3 = "Line length: " + line.Length.ToString();
Emgu.CV.CvInvoke.PutText(myFrame, caption3, new System.Drawing.Point(10, 50), Emgu.CV.CvEnum.FontFace.HersheyComplex, .5, new Emgu.CV.Structure.Bgr(0, 255, 0).MCvScalar);
}
viewer.Image = myFrame;
};
viewer.Text = "Tracker";
viewer.ShowDialog();
}
}
}
Everything in the code works except for the memory leak.

How can i load information from a txt file to show on a panel?

So i am using this method to save data into a txt file :
private void button1_Click(object sender, EventArgs e)
{
using (StreamWriter objWriter = new StreamWriter("test1.txt"))
{
objWriter.Write(textBox1.Text);
objWriter.Write(textBox2.Text);
objWriter.Write(comboBox1.Text);
objWriter.Write(comboBox2.Text);
MessageBox.Show("Details have been saved");
}
}
all those textbox and combobox are in a form called NewAppointment. And this is the panel in my MainForm:
private void panelDailyView_Paint(object sender, PaintEventArgs e)
{
int paintWidth = panelDailyView.ClientRectangle.Size.Width - vScrollBar.Width;
int paintHeight = panelDailyView.ClientRectangle.Size.Height;
int displayedRowCount = paintHeight / PanelRowHeight;
int panelTopRow;
int nextRow;
int apptStartRow;
int apptLength;
string dispTime;
Font font = new Font("Arial", 10);
Brush drawBrush = new SolidBrush(Color.DarkBlue);
Brush appointmentBrush = new SolidBrush(Color.LightBlue);
Graphics g = e.Graphics;
// Fill the background of the panel
g.FillRectangle(new SolidBrush(Color.Linen), 0, 0, paintWidth, paintHeight);
panelTopRow = vScrollBar.Value;
if (_SelectedRow >= panelTopRow &&
_SelectedRow <= panelTopRow + displayedRowCount)
{
// If the selected time is displayed, mark it
g.FillRectangle(new SolidBrush(Color.DarkKhaki),
0,
(_SelectedRow - panelTopRow) * PanelRowHeight,
paintWidth,
PanelRowHeight);
}
// Display the times at the start of the rows and
// the lines separating the rows
nextRow = panelTopRow;
for (int i = 0; i <= displayedRowCount; i++)
{
dispTime = (nextRow / 2).ToString("0#") + (nextRow % 2 == 0 ? ":00" : ":30");
nextRow++;
g.DrawString(dispTime, font, drawBrush, 2, (i * PanelRowHeight + 4));
g.DrawLine(Pens.DarkBlue, 0, i * PanelRowHeight, paintWidth, i * PanelRowHeight);
}
// Now fill in the appointments
foreach (IAppointment appointment in _TodaysAppointments)
{
apptStartRow = Utility.ConvertTimeToRow(appointment.Start);
apptLength = Utility.ConvertLengthToRows(appointment.Length);
// See if the appointment is inside the part of the day displayed on the panel
if (((apptStartRow >= panelTopRow) &&
(apptStartRow <= panelTopRow + displayedRowCount)) ||
(apptStartRow + apptLength > panelTopRow))
{
// Calculate the area of the panel occupied by
// the appointment
if (apptStartRow < panelTopRow)
{
apptLength = apptLength - (panelTopRow - apptStartRow);
apptStartRow = panelTopRow;
}
int apptDispStart = (apptStartRow - panelTopRow) * PanelRowHeight;
int apptDispLength = apptLength * PanelRowHeight;
if (apptDispStart + apptDispLength > paintHeight)
{
apptDispLength = paintHeight - apptDispStart;
}
Rectangle apptRectangle = new Rectangle(ApptOffset,
apptDispStart,
paintWidth - (ApptOffset * 2),
apptDispLength);
// Draw the block of light blue
g.FillRectangle(appointmentBrush,
apptRectangle);
// Draw the black line around it
g.DrawRectangle(Pens.Black, apptRectangle);
if (Utility.ConvertTimeToRow(appointment.Start) >= panelTopRow)
{
// If the top line of the appointment is displayed,
// write out the subject and location. Temporarily
// reduce the clip area for the graphics object to ensure
// that the text does not extend beyond the rectangle
Region oldClip = g.Clip;
g.Clip = new Region(apptRectangle);
g.DrawString(appointment.DisplayableDescription,
font,
drawBrush,
ApptOffset + 6,
apptDispStart + 4);
g.Clip = oldClip;
}
}
}
}
All i want to do is to load all the information saved in that .txt file to the panel.
// replace filepath below with filepath of your text file.
string text = System.IO.File.ReadAllText(#"C:\Users\Public\TestFolder\WriteText.txt");
Once you have the text variable populated, you can do whatever you want with it. Like add it to your panel.
// something like...
panel.Text = text;
You can also read each line of the text file into an array and do whatever you like with the array:
string[] lines = System.IO.File.ReadAllLines(#"C:\Users\Public\TestFolder\WriteLines.txt");

Screen Capture Not Capturing Dialog Boxes in My application

I have an application A that is made in WPF and WinForms.I have written another Application in WinForms for Capturing Screen. The problem I'm facing is that The dialog boxes that come up in Application A do not captured in the screen. The whole screen gets captured including the area behind the dialog box but the dialog box doesn't get captured.
public void CaptureScreen(string filepath)
{
string[] words = filepath.Split('\\');
string newFilePath = " ";
foreach (string word in words)
{
if (!(word.Contains(".bmp")))
{
newFilePath = newFilePath + word + "//";
}
else
{
newFilePath = newFilePath + word;
}
}
this.WindowState = FormWindowState.Minimized;
Screen[] screens;
screens = Screen.AllScreens;
int noofscreens = screens.Length, maxwidth = 0, maxheight = 0;
for (int i = 0; i < noofscreens; i++)
{
if (maxwidth < (screens[i].Bounds.X + screens[i].Bounds.Width)) maxwidth = screens[i].Bounds.X + screens[i].Bounds.Width;
if (maxheight < (screens[i].Bounds.Y + screens[i].Bounds.Height)) maxheight = screens[i].Bounds.Y + screens[i].Bounds.Height;
}
var width = maxwidth;
var height = maxheight;
Point sourcePoint = Point.Empty;
Point destinationPoint = Point.Empty;
Rectangle rect = new Rectangle(0, 0, width, height);
Bitmap bitmap = new Bitmap(rect.Width, rect.Height);
Graphics g = Graphics.FromImage(bitmap);
// g.CopyFromScreen(sourcePoint, destinationPoint, rect.Size);
g.CopyFromScreen(new Point(rect.Left, rect.Top), Point.Empty, rect.Size);
bitmap.Save(filepath, ImageFormat.Bmp);
//Console.WriteLine("(width, height) = ({0}, {1})", maxx - minx, maxy - miny);
}
}
}
Bitmap bmpScreenshot = new Bitmap(Screen.AllScreens[1].Bounds.Width, Screen.AllScreens[1].Bounds.Height, PixelFormat.Format32bppArgb);
Graphics.FromImage(bmpScreenshot).CopyFromScreen(
Screen.AllScreens[1].Bounds.X,
Screen.AllScreens[1].Bounds.Y,
0,
0,
Screen.AllScreens[1].Bounds.Size,
CopyPixelOperation.SourceCopy);
this.picExtendedModitorScreen.Image = bmpScreenshot;
this.picExtendedModitorScreen.Refresh();
Put this code in timer tick event.
I have put extended screen 1 in the code you can change it to any other.

Drawing inside a picturebox (control) inside foreach

I'm trying to making dynamic controls (labels, pictureboxes and buttons) by making controls in a foreach. The foreach is controlled by datarows, which are created from an SQL function that I call for.
The problem is that my graphics don't seem to work on my pictureboxes as it is now.
So far I've got this as code:
Global variables:
private int i = 0, beginningHeight = 70, addingToHeight = 55;
PictureBox picturebox = new PictureBox();
The functions:
private void tonenAlleCategorieen()
{
foreach (DataRow dr in blCategorie.getAlleCategorieenMetLimieten())
{
//making labels dyanmic and fill them with the correct text (from database)
string categorie = (string)dr.Field<string>("Omschrijving");
Label label = new Label();
label.BackColor = Color.Transparent;
label.ForeColor = Color.FromArgb(97, 97, 97);
label.Font = new Font("Myriam Pro", 10, FontStyle.Bold);
label.Width = 200;
label.Name = categorie;
label.Text = categorie;
label.BackColor = Color.Transparent;
label.Location = new Point(30, beginningHeight + addingToHeight);
this.Controls.Add(label);
// getting the figures (max figures) from the db to show in a label
double limiet = (double)dr.Field<double>("maximumBedrag");
Label labeltest = new Label();
labeltest.BackColor = Color.Transparent;
labeltest.ForeColor = Color.FromArgb(97, 97, 97);
labeltest.Font = new Font("Myriam Pro", 8, FontStyle.Bold);
labeltest.Width = 200;
labeltest.Name = Convert.ToString(limiet);
labeltest.Text = "Limiet: " + Convert.ToString(limiet) + "€";
labeltest.BackColor = Color.Transparent;
labeltest.Location = new Point(30, (beginningHeight + 27) + addingToHeight);
this.Controls.Add(labeltest);
//making pictureboxes for every single row in the db
PictureBox picturebox = new PictureBox();
picturebox.Width = 400;
picturebox.Name = "picturebox" + i;
picturebox.Height = 15;
picturebox.Location = new Point(30, (beginningHeight + 27) + addingToHeight);
this.Controls.Add(picturebox);
//calling the paint event for drawing inside the pictureboxes
picturebox.Paint += new PaintEventHandler(picturebox_Paint);
//adjusting height (55px extra per new row)
beginningHeight += 55;
i++;
}
}
private void picturebox_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
//draw here
//Graphics g = picturebox.CreateGraphics();
int x = 30;
int y = (beginningHeight + 27) + addingToHeight;
int breedteGebruikt = 200;
int breedteNietGebruikt = picturebox.Width - breedteGebruikt;
int hoogteBalk = picturebox.Height;
g.DrawRectangle(new Pen(Color.Red), new Rectangle(10, 5, 50, 5));
g.FillRectangle(Brushes.Green, x, y, breedteNietGebruikt, hoogteBalk);
g.FillRectangle(Brushes.Red, x, y, breedteGebruikt, hoogteBalk);
picturebox.Refresh();
}
Can anybody help me out here and tell me how I can add the graphics into my pictureboxes so I can see how much percentage of my picturebox should be filled?
Here is a picture example to have a good look onto it:
As you see in the above image it currently doesn't work, and I've put data in the database for the first record named "Boodschappen" which should now be filled in by my graphics for 30% in this example.
Does anybody know a solution please? :)
Thanks
Now the troubles only rise on this part: I'm not allowed to add the g
to this.Controls.Add(g); it gives me the error Argument 1: cannot
convert from 'System.Drawing.Graphics' to
'System.Windows.Forms.Control
It's clear you can't add Graphics as a control. Also if you draw that way your drawing will disappear when picturebox or form repainted. So you should draw inside the Paint event of picturebox.
double maxLimit = 0;
int maxleftpos = 0;
private void tonenAlleCategorieen()
{
foreach (DataRow dr in blCategorie.getAlleCategorieenMetLimieten())
{
//making labels dyanmic and fill them with the correct text (from database)
string categorie = (string)dr.Field<string>("Omschrijving");
Label label = new Label();
label.BackColor = Color.Transparent;
label.ForeColor = Color.FromArgb(97, 97, 97);
label.Font = new Font("Myriam Pro", 10, FontStyle.Bold);
label.Width = 200;
label.Name = categorie;
label.Text = categorie;
label.BackColor = Color.Transparent;
label.Location = new Point(10, beginningHeight + addingToHeight);
maxleftpos = Math.Max(label.Left + label.Width, maxleftpos);
this.Controls.Add(label);
// getting the figures (max figures) from the db to show in a label
double limiet = (double)dr.Field<double>("maximumBedrag");
maxLimit = Math.Max(limiet, maxLimit);
Label labeltest = new Label();
labeltest.BackColor = Color.Transparent;
labeltest.ForeColor = Color.FromArgb(97, 97, 97);
labeltest.Font = new Font("Myriam Pro", 8, FontStyle.Bold);
labeltest.Width = 200;
labeltest.Name = Convert.ToString(limiet);
labeltest.Text = "Limiet: " + Convert.ToString(limiet) + "€";
labeltest.BackColor = Color.Transparent;
labeltest.Location = new Point(30, (beginningHeight + 27) + addingToHeight);
this.Controls.Add(labeltest);
//making pictureboxes for every single row in the db
PictureBox picturebox = new PictureBox();
picturebox.Width = 200;
picturebox.Name = "picturebox" + i;
picturebox.Height = 15;
picturebox.Tag = limiet;
picturebox.Location = new Point(100, (beginningHeight + 27) + addingToHeight);
this.Controls.Add(picturebox);
picturebox.BringToFront();
//calling the paint event for drawing inside the pictureboxes
picturebox.Paint += new PaintEventHandler(picturebox_Paint);
//adjusting height (55px extra per new row)
beginningHeight += 55;
i++;
}
foreach (Control c in this.Controls)
{
if (c is PictureBox)
{
c.Location = new Point(maxleftpos, c.Top);
}
}
if (this.Width<maxleftpos+150)
{
this.Width = maxleftpos + 50;
}
this.Refresh();
}
private void picturebox_Paint(object sender, PaintEventArgs e)
{
PictureBox p = sender as PictureBox;
Graphics gr = e.Graphics;
gr.ResetTransform();
//Graphics g = picturebox.CreateGraphics();
int breedteGebruikt = Convert.ToInt32((double)p.Tag);
int max = Convert.ToInt32(maxLimit);
int grwidht = breedteGebruikt * p.Width / max;
gr.DrawRectangle(new Pen(Color.Red), new Rectangle(10, 5, 50, 5));
gr.FillRectangle(Brushes.Green, 0, 0, p.Width, p.Height);
gr.FillRectangle(Brushes.Red, 0, 0, grwidht, p.Height);
}

When Screen Resolution Changes the Panel and its Child Control display inside the WinForm

I am trying to develop an windows form application having Three panels
Panel 1(FileBrowsePanel):- contrains TextBox , Browse Button
Panel 2(SearchCriteriaPanel ) :- Lable From Date , ToDate DateTimePicker control From Date and To Date CheckBox for each DateTimePicker control also two TextBoxes and ListBox Two Buttons Search and Reset
Panel 3(DisplayDataPanel):- ListView to Display Data from from browse file path
Panel 4(DeleteCriteriaPanel):- Having DateTimePicker control to delete data from listview and file with Delete Button
actual problem is that When i Change the resolution of screen all the panels and control on that panel goes out of the form width and Height code is
void LoadWindowsSetting()
{
this.SuspendLayout();
int i_StandardHeight = 768;//Developer Desktop Height Where the Form is Designed
int i_StandardWidth = 1024; ;//Developer Desktop Width Where the Form is Designed
int i_PresentHeight = Screen.PrimaryScreen.WorkingArea.Height- SystemInformation.CaptionHeight;
int i_PresentWidth = Screen.PrimaryScreen.Bounds.Width;
float f_HeightRatio = new float();
float f_WidthRatio = new float();
f_HeightRatio = (float)((float)i_PresentHeight / (float)i_StandardHeight);
f_WidthRatio = (float)((float)i_PresentWidth / (float)i_StandardWidth);
foreach (Control c in this.Controls)
{
if (c.GetType().ToString() == "System.Windows.Forms.Panel")
{
// c.SetBounds(Convert.ToInt32(c.Bounds.X * f_WidthRatio), Convert.ToInt32(c.Bounds.Y * f_WidthRatio), Convert.ToInt32(c.Bounds.Width * f_WidthRatio), Convert.ToInt32(c.Bounds.Height * f_HeightRatio));
}
if (c.HasChildren)
{
foreach (Control cChildren in c.Controls)
{
cChildren.SetBounds(Convert.ToInt32(cChildren.Bounds.X * f_WidthRatio), Convert.ToInt32(cChildren.Bounds.Y * f_WidthRatio), Convert.ToInt32(cChildren.Bounds.Width * f_WidthRatio), Convert.ToInt32(cChildren.Bounds.Height * f_HeightRatio));
}
c.SetBounds(Convert.ToInt32(c.Bounds.X * f_WidthRatio), Convert.ToInt32(c.Bounds.Y * f_WidthRatio), Convert.ToInt32(c.Bounds.Width * f_WidthRatio), Convert.ToInt32(c.Bounds.Height * f_HeightRatio));
}
else
{
c.SetBounds(Convert.ToInt32(c.Bounds.X * f_WidthRatio), Convert.ToInt32(c.Bounds.Y * f_WidthRatio), Convert.ToInt32(c.Bounds.Width * f_WidthRatio), Convert.ToInt32(c.Bounds.Height * f_HeightRatio));
}
}
btnBrowse.Height = txtBrowseFilePath.Height + 1;
btnSubmit.Height = btnBrowse.Height;
btnReset.Height = btnBrowse.Height;
panelSearch.Height += listBoxLogType.Height;
int leftSpacePanelBrowse = (this.Width - panelBrowse.Width) / 2;
int leftSpacePanelSearch = (this.Width - panelSearch.Width) / 2;
int leftSpacePanelLogList = (this.Width - panelLogList.Width) / 2;
int leftSpacePanelDeleteLog = (this.Width - panelDeleteLog.Width) / 2;
panelBrowse.Location = new System.Drawing.Point(leftSpacePanelBrowse - 8, 25);
panelSearch.Location = new System.Drawing.Point(leftSpacePanelSearch - 8, panelBrowse.Height + 40);
panelLogList.Location = new System.Drawing.Point(leftSpacePanelLogList - 8, panelSearch.Height + 140);
progressBarFileLoad.Location = new System.Drawing.Point((this.Width / 2) - 100, panelLogList.Bounds.Y + panelLogList.Height + 5);
panelDeleteLog.Location = new System.Drawing.Point(leftSpacePanelDeleteLog - 8, panelLogList.Bounds.Y + panelLogList.Height + progressBarFileLoad.Height + 20);
this.ResumeLayout(false);
Invalidate();
Focus();
}
so I can prevent the control when the screen resolution is changes
Form the form Load event call the ResizeForm() function in such a way
Resolution objFormResizer = new Resolution();
objFormResizer.ResizeForm(this, 768, 1024);
public class Resolution
{
float heightRatio = new float();
float widthRatio = new float();
int standardHeight, standardWidth;
public void ResizeForm(Form objForm, int DesignerHeight, int DesignerWidth)
{
standardHeight = DesignerHeight;
standardWidth = DesignerWidth;
int presentHeight = Screen.PrimaryScreen.WorkingArea.Height;//.Bounds.Height;
int presentWidth = Screen.PrimaryScreen.Bounds.Width;
heightRatio = (float)((float)presentHeight / (float)standardHeight);
widthRatio = (float)((float)presentWidth / (float)standardWidth);
objForm.AutoScaleMode = AutoScaleMode.None;
objForm.Scale(new SizeF(widthRatio, heightRatio));
foreach (Control c in objForm.Controls)
{
if (c.HasChildren)
{
ResizeControlStore(c);
}
else
{
c.Font = new Font(c.Font.FontFamily, c.Font.Size * heightRatio, c.Font.Style, c.Font.Unit, ((byte)(0)));
}
}
objForm.Font = new Font(objForm.Font.FontFamily, objForm.Font.Size * heightRatio, objForm.Font.Style, objForm.Font.Unit, ((byte)(0)));
}
private void ResizeControlStore(Control objCtl)
{
if (objCtl.HasChildren)
{
foreach (Control cChildren in objCtl.Controls)
{
if (cChildren.HasChildren)
{
ResizeControlStore(cChildren);
}
else
{
cChildren.Font = new Font(cChildren.Font.FontFamily, cChildren.Font.Size * heightRatio, cChildren.Font.Style, cChildren.Font.Unit, ((byte)(0)));
}
}
objCtl.Font = new Font(objCtl.Font.FontFamily, objCtl.Font.Size * heightRatio, objCtl.Font.Style, objCtl.Font.Unit, ((byte)(0)));
}
else
{
objCtl.Font = new Font(objCtl.Font.FontFamily, objCtl.Font.Size * heightRatio, objCtl.Font.Style, objCtl.Font.Unit, ((byte)(0)));
}
}
}
this class slove my issue.......hope so you also enjoy Happy Coding

Categories

Resources