Click here to Skip to main content
15,923,576 members
Home / Discussions / Windows Forms
   

Windows Forms

 
Questionhow to display the size of the file in text box in VB.net form Pin
ruthvik20-May-08 4:33
ruthvik20-May-08 4:33 
AnswerRe: how to display the size of the file in text box in VB.net form Pin
Smithers-Jones20-May-08 5:26
Smithers-Jones20-May-08 5:26 
Questionhow can i draw a transparent label? Pin
PaoloS20-May-08 2:51
PaoloS20-May-08 2:51 
AnswerRe: how can i draw a transparent label? Pin
Kschuler21-May-08 11:53
Kschuler21-May-08 11:53 
AnswerRe: how can i draw a transparent label? Pin
Thomas Stockwell30-May-08 11:02
professionalThomas Stockwell30-May-08 11:02 
Questionhow to cut the corners of the form which has the back ground image. Pin
balaji_vbr20-May-08 2:31
balaji_vbr20-May-08 2:31 
Questiononpaint event & form_paint event Pin
balaji_vbr20-May-08 2:25
balaji_vbr20-May-08 2:25 
Questioni got a problem in the "private void RecordForm_Paint(object sender, PaintEventArgs e)" Pin
balaji_vbr20-May-08 0:35
balaji_vbr20-May-08 0:35 
Dear sir ,

this is balaji working as software engineer in innobox, in india. i have problem regarding the paint event.

step1: i have a login screen when i click on login it show a recorder form to record our video.

this is th code i have written in the login button
----------------------------------------------------------------------
private void btnLogin_Click(object sender, EventArgs e)
{
this.Cursor = Cursors.WaitCursor;
tbLogin.Enabled = false;
tbPassword.Enabled = false;
btnLogin.Enabled = false;
btnCancel.Enabled = false;
CurrentUser.rf = rcf;
//if (Communicator.GetUserInfo(tbLogin.Text, tbPassword.Text, rebrandLoginForm.label1)) {
System.Windows.Forms.Label lblName = new Label();
lblName.Text = "idle";
if (Communicator.GetUserInfo(tbLogin.Text, tbPassword.Text, lblName))
{
//Rebrand_Control.UsersInformation.CustomerID = CurrentUser.CustomerID;
//Rebrand_Control.UsersInformation.UserID = CurrentUser.UserID;
//Rebrand_Control.UsersInformation.Username = CurrentUser.Username;
//Rebrand_Control.UsersInformation.Password = CurrentUser.Password;
//Rebrand_Control.UsersInformation.ResellerID = CurrentUser.ResellerID;
//Rebrand_Control.UsersInformation.AccessLevel = CurrentUser.AccessLevel;
//Rebrand_Control.UsersInformation.PLS = CurrentUser.PLS;
//Rebrand_Control.UsersInformation.PlaybackURL = CurrentUser.PlaybackURL;
//Rebrand_Control.UsersInformation.ResellerAdmin = CurrentUser.ResellerAdmin;
//Rebrand_Control.UsersInformation.isPremium = CurrentUser.IsPremium;

//rebrandLoginForm.GetRebrandImages(tbLogin.Text, tbPassword.Text);
//rebrandLoginForm.label1.Text = "Status: Loading Graphics...";
//while (!rebrandLoginForm.gotRebrandedImages)
//{
// Application.DoEvents();
//}
rcf.Show();
this.Hide();
}
else
{
MessageBoxForm mbf = new MessageBoxForm("Username or Password incorrect. Please try again.");
mbf.ShowDialog(this);
tbLogin.Enabled = true;
tbPassword.Enabled = true;
btnLogin.Enabled = true;
btnCancel.Enabled = true;
// focus on login box
tbLogin.SelectAll();
this.ActiveControl = tbLogin;
}
this.Cursor = Cursors.Default;

}


step:2 afetr login the recordform_load evevnt will fire

this is the code
--------------------------------------------------------
this.Location = new Point(this.Location.X, SystemInformation.WorkingArea.Top);

//this.Text = Rebrand_Control.UsersInformation.ProperTitle + " - Record Video";
//this.Icon = Rebrand_Control.UsersInformation.ProperIcon;

lblName.Text = CurrentUser.FirstName + " " + CurrentUser.LastName;
lblVersion.Text = "Version 6.8";
lblTimeAvailableTimer.Text = CurrentUser.TimeLeft;

if (CurrentUser.SecondsLeft == 0)
{
MessageBoxForm mbf = new MessageBoxForm("You have reached your recording time limit. Remove old videos to free up more time.");
mbf.ShowDialog(this);
this.pbStartRecording.Enabled = false;
}
else if (CurrentUser.SecondsLeft < 60)
{
MessageBoxForm mbf = new MessageBoxForm("You have less than one minute of recording time left. Remove old videos to free up more time.");
mbf.ShowDialog(this);
}

// delete old videos
string[] files = System.IO.Directory.GetFiles(Application.StartupPath, "*.wmv");
foreach (string file in files)
{
System.IO.File.Delete(file);
}
string[] tfiles = System.IO.Directory.GetFiles(Application.StartupPath, "*.jpg");
foreach (string file in tfiles)
{
System.IO.File.Delete(file);
}
string[] tfiles2 = System.IO.Directory.GetFiles(Application.StartupPath, "*.gif");
foreach (string file in tfiles2)
{
System.IO.File.Delete(file);
}
string[] tfiles3 = System.IO.Directory.GetFiles(Application.StartupPath, "*.bmp");
foreach (string file in tfiles3)
{
System.IO.File.Delete(file);
}
string[] tfiles4 = System.IO.Directory.GetFiles(Application.StartupPath, "*.avi");
foreach (string file in tfiles4)
{
System.IO.File.Delete(file);
}
string[] tfiles5 = System.IO.Directory.GetFiles(Application.StartupPath, "*.mod");
foreach (string file in tfiles5)
{
System.IO.File.Delete(file);
}
string[] tfiles6 = System.IO.Directory.GetFiles(Application.StartupPath, "*.mpg");
foreach (string file in tfiles6)
{
System.IO.File.Delete(file);
}
pbStartRecording.Enabled = true;
LoadScripts();

step 3: after this the paint event i.e private void RecordForm_Paint(object sender, System.Windows.Forms.PaintEventArgs e) it will fire

it is executed. i put a break point at this event then i press f10 after execution of this event the program counter again comes to the paint event. it loops in this event infinitly.



even if i press f5 then also it is in the same event.



if i remove the break point then execute it will show the output but the code what i written in the paint doesnt cut the corners of the screen.


the code i have written in the paint event to cut the corners of the windowform as well as img which is on the top of the form.


the code is

--------------------------------------------------------
Graphics g = e.Graphics;
// Rectangle mainRect = new Rectangle(0, 0, 578, 470);

Rectangle mainRect = new Rectangle(0, 0, 650, 500);
Region mainRegion = new Region(mainRect);
e.Graphics.SetClip(mainRegion, CombineMode.Replace);

/* Clip top left side curve region and exclude it.*/
Point point1 = new Point(0, 33);
Point point2 = new Point(11, 17);
Point point3 = new Point(23, 6);
Point point4 = new Point(35, 0);
// Create an array of the points.
Point[] curvePoints = { point1, point2, point3, point4 };
// Create a GraphicsPath object and add a curve.
GraphicsPath myPath1 = new GraphicsPath();
myPath1.AddCurve(curvePoints, 0, 3, 0.8f);
myPath1.AddLine(35, 0, 0, 0);
// Exclude the clipped region
Region ExcludeRegion1 = new Region(myPath1);
e.Graphics.ExcludeClip(ExcludeRegion1);

/* Clip top right side curve region and exclude it.*/
GraphicsPath myPath2 = new GraphicsPath();
point1.X = 539; point1.Y = 0;
point2.X = 555; point2.Y = 9;
point3.X = 569; point3.Y = 23;
point4.X = 577; point4.Y = 37;
Point[] curvePoints2 = { point1, point2, point3, point4 };
myPath2.AddCurve(curvePoints2, 0, 2, 0.8f);

myPath2.AddLine(577, 37, 577, 0);

Region ExcludeRegion2 = new Region(myPath2);
e.Graphics.ExcludeClip(ExcludeRegion2);

/* Clip bottom left side curve region and exclude it.*/
GraphicsPath myPath3 = new GraphicsPath();
point1.X = 0; point1.Y = 428;
point2.X = 8; point2.Y = 446;
point3.X = 20; point3.Y = 461;
point4.X = 37; point4.Y = 469;
Point[] curvePoints3 = { point1, point2, point3, point4 };
myPath3.AddCurve(curvePoints3, 0, 2, 0.8f);

myPath3.AddLine(37, 469, 0, 469);

Region ExcludeRegion3 = new Region(myPath3);
e.Graphics.ExcludeClip(ExcludeRegion3);

/* Clip bottom right side curve region and exclude it.*/
GraphicsPath myPath4 = new GraphicsPath();
point1.X = 542; point1.Y = 469;
point2.X = 556; point2.Y = 463;
point3.X = 571; point3.Y = 449;
point4.X = 577; point4.Y = 439;
Point[] curvePoints4 = { point1, point2, point3, point4 };
myPath4.AddCurve(curvePoints4, 0, 2, 0.8f);

myPath4.AddLine(577, 439, 577, 469);

Region ExcludeRegion4 = new Region(myPath4);
e.Graphics.ExcludeClip(ExcludeRegion4);

e.Graphics.DrawImage(img, 0, 0, 577, 469);
e.Graphics.ResetClip();



please help me.asap.


balaji
AnswerRe: i got a problem in the "private void RecordForm_Paint(object sender, PaintEventArgs e)" Pin
Mike Dimmick20-May-08 0:42
Mike Dimmick20-May-08 0:42 
GeneralRe: i got a problem in the "private void RecordForm_Paint(object sender, PaintEventArgs e)" Pin
Christian Graus20-May-08 0:52
protectorChristian Graus20-May-08 0:52 
GeneralRe: i got a problem in the "private void RecordForm_Paint(object sender, PaintEventArgs e)" Pin
balaji_vbr20-May-08 1:04
balaji_vbr20-May-08 1:04 
Questionautosearch list Pin
Ali el20-May-08 0:03
Ali el20-May-08 0:03 
QuestionManageing windows application in c# , looking browse and upload functionality sourcecode Pin
jay10019-May-08 7:16
jay10019-May-08 7:16 
AnswerPosted in C# forum as well Pin
SomeGuyThatIsMe19-May-08 7:42
SomeGuyThatIsMe19-May-08 7:42 
AnswerRe: Manageing windows application in c# , looking browse and upload functionality sourcecode Pin
Christian Graus19-May-08 10:26
protectorChristian Graus19-May-08 10:26 
QuestionMulticolored text in richtextbox Pin
tamour19-May-08 3:03
tamour19-May-08 3:03 
AnswerRe: Multicolored text in richtextbox Pin
originSH19-May-08 5:19
originSH19-May-08 5:19 
GeneralRe: Multicolored text in richtextbox Pin
Kschuler21-May-08 11:55
Kschuler21-May-08 11:55 
QuestionProblem retrieving the row index for a DataGridViewRow in DataGridViewSelectedRowCollection Pin
cristian.fatu18-May-08 21:49
cristian.fatu18-May-08 21:49 
AnswerRe: Problem retrieving the row index for a DataGridViewRow in DataGridViewSelectedRowCollection Pin
cristian.fatu27-May-08 21:45
cristian.fatu27-May-08 21:45 
QuestionNeed to find the object details from Kernel address Pin
Noordeen Shah17-May-08 17:23
Noordeen Shah17-May-08 17:23 
AnswerRe: Need to find the object details from Kernel address Pin
Mike Dimmick20-May-08 0:48
Mike Dimmick20-May-08 0:48 
QuestionNative look in WinForms Pin
Leafy16-May-08 9:46
Leafy16-May-08 9:46 
AnswerRe: Native look in WinForms Pin
Thomas Stockwell18-May-08 4:10
professionalThomas Stockwell18-May-08 4:10 
GeneralRe: Native look in WinForms Pin
Leafy18-May-08 4:49
Leafy18-May-08 4:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.