|
Hi when i set the backcolor to transparent when i run my form, the form run slow and the backcolor label jump and after it set in transparent.how i can repair this?how can i do? Thanks
|
|
|
|
|
If you have just one label that you are setting the backcolor to transparent that shouldn't be causing the form to run slow. You can either set the label's backcolor to transparent in design so that when the form first displays it is already transparent or you can set the label's visible property to false in design, and then in your code you can set the backcolor to transparent and then the visible to true. This will stop it from first appearing with a color and then turning transparent on the screen as the form loads.
Hope this helps.
|
|
|
|
|
Create you own custom control that handles its own paint routines.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios
Discounted or Free Software for Students:
DreamSpark - downloads.channel8.msdn.com
MSDN Academic Alliance - www.msdnaa.com
|
|
|
|
|
Dear sir,
i have a require ment to cut the corners of the form .
i have a windows form with a shape square.& i have a background image for that
i want to cut the corners of the form along with the back ground image.
for that i have one algorithm , I have written it in the form_paint event .
but it is not cut the corners.
i paste the code here.
---------------------------------------------
private void RecordForm_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
//"E:\\covideo\\Recorder - Code\\CoVideo Libraries\\Rebrand Control\\Rebrand Control\\Resources\\main_bg2.png"
//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();
}
------------------------------------------------------------------
it is not working please help me.
|
|
|
|
|
dear sir,
i have two forms one is login form & recorder form.
1.in login form i import the record from class and i create one obj for that i initialise with new record form class.
in btnLogin click
i call the method rcf.show(); // here the recorder form open
this.hide(); // here the login form closed
2. then the recorderform_lad event fire
3.afetr that recorderform_paint will fire.
4. after this again the program counter come to the recorderform_paint is firing
5. why it again will fire i didnt understand please help me.
|
|
|
|
|
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
|
|
|
|
|
Paint events are tricky to debug because the debugger keeps popping up and sending the application window to the background, so it needs repainting again when it regains the focus. One way around this problem is to use remote debugging - run the application on one computer and the debugger on the other.
DoEvents: Generating unexpected recursion since 1991
|
|
|
|
|
Or have two monitors....
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
sir ,
how can i repaint it again focus in the same event
please hellp me sir
|
|
|
|
|
Hi,
i have a problem and i hopr you can help me,
i want to create a user control with textbox and listbox. the listbox is binded to a collection and it works as autocomplete of the text box. i did some search and i found some solution but i still have the problem which is i want the list to be appeare outside of the usercontrol and be almost as popup list because if i make the usercontrol hieght to be the hieght of the list then the space with other controls in the form will be large.most of solutions suggest to use form as popup of the control and put the list on the popupform, its not work because the focus will be lost from the main form when user navigate through the list and have alot of problems when to show/Hide the popup control.
what i want is almost to make a control just like the combobox with its items dropDown list.
please i need help its too urgent
|
|
|
|
|
iam Manageing windows application in c# , looking browse and upload functionality sourcecode. Thanks
|
|
|
|
|
|
This is not a suitable request for a free website, if you want someone to do your work, you need to pay them.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
i want to have a different for text for every new line.
|-----------------------------------|
| this line red |
| this line blue |
| this line orange |
| |
| |
|___________________________________|
|
|
|
|
|
Look up the RTF specification? Rich Text has mark up that lets you format it.
|
|
|
|
|
|
Hello,
I am trying to retrieve the Index property of a row in the SelectedRows collection (Managed C++, .Net 2.0).
lRowIndex = pSelectedRows[idxSelectedRow]->Index;
I get -1 value, and I suspect this is because of shared rows.
Still, I need to know the row index. How can I find it ?
On the other hand, the same code works well if the SelectedRows is passed as data in a DoDragDrop operation (maybe then, shared rows are not used).
Thank you,
Cristian
|
|
|
|
|
The approach I was trying was the correct one: to retrieve row index you may use
lRowIndex = pSelectedRows[idxSelectedRow]->Index;
I was failing to get correct values not because of the shared rows, but because of the fact that I was altering the "selected row" data in a previous set of CurrentCell DataGridView member. Now I corrected it and everything works fine, so this topic may be closed. Thank you.
|
|
|
|
|
Hi Guys,
I have a .net application, in which a frequently used screen experience a GDI leak. Using GDILeakDetector, i found the kernel address of the bitmap object, which is causing the leak.
Handle : 0x3a0509ea
ObjectType : Bitmap
Kernel Address : 0xe2cc9d28
Extended Information : Width: 12, Height: 12 , Bits/Pixel: 32
Now i need to find out what is that object in the screen (i.e) object details, from the kernel address. Can u pls help me out in this how could i point out the object in the screen and also how to dispose it on form close.
Thanks in advance
|
|
|
|
|
Search for every use of the Bitmap class and ensure that the object is always disposed when you've finished using it. If, for example, you allocate a bitmap in a method and you assign it to a local variable (not a member variable of the class), use a using block to ensure it's disposed of automatically.
If you assign it to a member variable of a class, for example a Form, then you should override the Dispose(bool) method and when the parameter is true (to indicate disposing rather than finalizing), call Dispose on the bitmap. The Framework will call the Form's Dispose method when the form is closed. Visual Studio automatically generates an override of Dispose which you will find in the Designer file (e.g. MyForm.Designer.cs) in VS2005 and later.
(It is not safe to call Dispose on member variables when Dispose(bool) is being called by the finalizer, because the order in which finalizers are called is essentially random. The Bitmap may already have been cleaned up by its own finalizer.)
DoEvents: Generating unexpected recursion since 1991
|
|
|
|
|
Hi,
I'm currently learning C# and WinForms and practicing on Visual C# 2008 Express Edition.
I wanted help regarding the look and feel of menuStrip and toolStrip controls - they have a blue Office 2003'ish look and feel; I want them to look native on XP (or Vista). How can I do that? Thanks..
|
|
|
|
|
Other than the fact that .NET 2.0+ has many different styles for menu items (the RenderMode property of menustrips can be set to System and that will allow the appearance to change with the OS visual style). If you want to customize the menustrips beyond that aspect, you may consider looking at one of my articles on custom toolstrip renderers: Custom ToolStrip Renderers[^]
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
|
Do you have the visual styles enabled in your entry point? E.g:
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
Semicolons: The number one seller of ostomy bags world wide. - dan neely
|
|
|
|
|
Yes, I checked that part. It was enabled. Sorry I didn't reply; I had to change the RenderMode as suggested by Thomas..
|
|
|
|
|