|
A few pointers as follows:
1) Rather than calling .CreateGraphics() handle the OnPaint event which gives you access to the Graphics object of the current control. This saves you having to determine every time your form is invalidated as the OnPaint event is raised at that time.
2) On a computer screen (which is inherantly flat) it is absolutely impossible to make an image 3 dimentional. The best you can do is fool the users eyes (and therefore brain) into thinking that they are looking at a 3 dimensional image. To do this you use perspective, shading etc.
2d box:
---
| |
---
3d box:
___
/ /|
--- |
| |/
---
3) To make things clickable you could either a) Inherit your shape from the Control class whereby it will then receive click events or b) Handle the click event of the form and using the mouse location (provided by the event) determine if the click is within the bounds of your shape.
|
|
|
|
|
|
i have written a database application in c#, the application use another c# dll to connect with the database.
I am getting some exception inside the c# dll( i have not include exception handling inside the dll), but those exceptions are not being caught from the application.
for example
try
{
DatabaseManager db = new DatabaseManager();
db.Execute();
}
catch ( Exception ex )
{
}
here the DB.Execute() is crashing inside the dll but not capturing in application.What could be the reason?
My small attempt...
|
|
|
|
|
|
stancrm wrote: from my experience, in that row, the dll create a new thread, and the new thread throw an exception.
There is no new thread created in that code.
|
|
|
|
|
|
|
You should review of Execute method code.
A DATAPOST COMPUTER CENTRE
(K.V Prajapati)
|
|
|
|
|
Hi here the Execute method is crashing......
Here my problem is that my application is not able to catch that exception.( those exceptions occurs inside the dll)
My small attempt...
|
|
|
|
|
Because you've swallowed the exception (and logged it according to your comments) rather than rethrowing it.
try
{
}
catch(Exception ex)
{
throw;
}
now the calling application will receive the exception.
|
|
|
|
|
There may be some mistake in my question .let me explain it once more....
<pre> try
{
// This function is inside the DLL
Function();
}
catch ( Exception ex )
{
// Log exception
}
//Inside the DLL
public void Function()
{
// something which is crashing.......
}
what i am saying is i am not getting the exception which is occuring inside the dll....
My small attempt...
|
|
|
|
|
If you are not getting the exception, how do you know Function is crashing?
|
|
|
|
|
Please come to my question............. ]if i put try catch inside the dll , that will catch the exception
My small attempt...
|
|
|
|
|
|
For what?????
Hi all please understand my question..............
1. I am calling a method from an application ( example APP) ,which is inside a dll( example DLL)
2. Just assume that that method is crashing( in side DLL)
3. I want to catch the exception in the calling application( APP)( the application from which i called the dll method)
---------------------------------------------------------------------
My small attempt...
|
|
|
|
|
|
"if you cannot catch the exception from method Execute, that means there is something wrong in the method." please try to understand that i dont want to find the root cause or reason for the exception... i want to catch the exception in the c# application which calls the DLL.............
Please imagine that i put some code which generates exception.I dont want to debug and find the reason i just want to catch it on my application...
My small attempt...
|
|
|
|
|
Hello All,
I am Savitri Here. I am new to this forum and also to this language. I am doing one application in C#. Now i have two forms called Mainform and LoginForm. After running we login form will come and after successful login will get mainform. I want to assign the entered user name to toolstripstautuslable of statusstrip which is in mainform.When i clicking login button then only i am setting new value for that status strip but it is not assigning. Please help me. Below is the part of code.
LoginForm.Cs
<br />
MainForm frm = new MainForm();<br />
private void btnLogin_Click(object sender, EventArgs e)<br />
{<br />
string username,password;<br />
username=txtUsr.Text.ToString();<br />
password=txtPwd.Text.ToString();<br />
if(username.Equals("xxxxxx") && password.Equals("xxxxxx"))<br />
{<br />
MessageBox.Show("SuccessFully Logged in");<br />
frm.toolStripStatusLabel2.Text = txtUsr.Text;<br />
frm.GetValues(username, password);
this.Visible=false;<br />
}<br />
else<br />
{<br />
MessageBox.Show("Not valid UserName and Password");<br />
}<br />
<br />
}<br />
MainForm.cs
public void GetValues(string strUsr,string strPwd)<br />
{<br />
this.UsrNam=strUsr;<br />
MessageBox.Show(UsrNam);<br />
this.PasPwd=strPwd;<br />
MessageBox.Show(PasPwd);<br />
this.toolStripStatusLabel2.Text = UsrNam.ToString();<br />
this.Refresh();<br />
}
Please Give me hints. Help me.
Thanks in Advance.
Regards,
Savitri P
|
|
|
|
|
Does this line MessageBox.Show(UsrNam); show the username?
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi Henry,
Ya that is user name. I want to display that user name into status strip in main from. Please give me some hints to solve this problem.
Thanks in Advance.
Regards,
Savitri P
|
|
|
|
|
Yes, I understand that, but when the MessageBox displays, does it show the username, is it blank, does it display something that you are not expecting?
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Ya it is displaying username in messagebox but it is not showing in status strip and not refreshing control also. I tried many ways but it is not displaying.
Regards,
Savitri P
|
|
|
|
|
The code you have provided, is over complicated:
your code:
public void GetValues(string strUsr,string strPwd)
{
this.UsrNam=strUsr;
MessageBox.Show(UsrNam);
this.PasPwd=strPwd;
MessageBox.Show(PasPwd);
this.toolStripStatusLabel2.Text = UsrNam.ToString();
this.Refresh();
}
can be simplified to:
public void GetValues(string strUsr,string strPwd)
{
this.UsrNam=strUsr;
MessageBox.Show(UsrNam);
this.PasPwd=strPwd;
MessageBox.Show(PasPwd);
this.toolStripStatusLabel2.Text = UsrNam;
}
other than that I can see no obvious reason that it should not work.
As a test that toolStripStatusLabel2 is working, temporarily replace this.toolStripStatusLabel2.Text = UsrNam; with this.toolStripStatusLabel2.Text = "Is this visible"; .
If you can see "Is this visible" when you run the application, then I am at a loss. If however, you cannot see it, then there is something wrong with one of the properties of toolStripStatusLabel2 possibly the Visible property is set to false, possibly the location or size properties are incorrectly set. It might even be hidden behind another control.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi Henry,
Thanks a lot.I got the result correctly. Thanku very much.
Regards,
Savitri P
|
|
|
|
|
My pleasure.
Good Luck.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|