Sunday, December 14th, 2008
If you have a PayPal account and would like to add a donate button to your application you can use the following code.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
| private void btnDonate_Click(object sender, System.EventArgs e)
{
string url = "";
string business = "my@paypalemail.com"; // your paypal email
string description = "Donation"; // '%20' represents a space. remember HTML!
string country = "AU"; // AU, US, etc.
string currency = "AUD"; // AUD, USD, etc.
url += "https://www.paypal.com/cgi-bin/webscr" +
"?cmd=" + "_donations" +
"&business=" + business +
"&lc=" + country +
"&item_name=" + description +
"¤cy_code=" + currency +
"&bn=" + "PP%2dDonationsBF";
System.Diagnostics.Process.Start(url);
} |
private void btnDonate_Click(object sender, System.EventArgs e)
{
string url = "";
string business = "my@paypalemail.com"; // your paypal email
string description = "Donation"; // '%20' represents a space. remember HTML!
string country = "AU"; // AU, US, etc.
string currency = "AUD"; // AUD, USD, etc.
url += "https://www.paypal.com/cgi-bin/webscr" +
"?cmd=" + "_donations" +
"&business=" + business +
"&lc=" + country +
"&item_name=" + description +
"¤cy_code=" + currency +
"&bn=" + "PP%2dDonationsBF";
System.Diagnostics.Process.Start(url);
}
Tags: .Net, C#, Donate, PayPal, Visual Studio
Posted in .Net | 8 Comments »
Monday, December 8th, 2008
Have you ever found yourself developing a custom user interface and needed rounded corners which work on different Windows Operating Systems?
If you are using Windows Vista this is easily achieved by using a rounded PNG image with transparent corners and setting the transparency property. This however does not work on systems such as Windows XP.
The following C# code can be used to ensure you have rounded corners on a number of Windows Operating Systems.
1
2
3
4
5
6
7
8
9
10
11
12
13
| [DllImport("Gdi32.dll", EntryPoint = "CreateRoundRectRgn")]
private static extern IntPtr CreateRoundRectRgn
(
int nLeftRect, // x-coordinate of upper-left corner
int nTopRect, // y-coordinate of upper-left corner
int nRightRect, // x-coordinate of lower-right corner
int nBottomRect, // y-coordinate of lower-right corner
int nWidthEllipse, // height of ellipse
int nHeightEllipse // width of ellipse
);
// Set your own values
Region = System.Drawing.Region.FromHrgn(CreateRoundRectRgn(1, 1, 10, 10 16, 16)); |
[DllImport("Gdi32.dll", EntryPoint = "CreateRoundRectRgn")]
private static extern IntPtr CreateRoundRectRgn
(
int nLeftRect, // x-coordinate of upper-left corner
int nTopRect, // y-coordinate of upper-left corner
int nRightRect, // x-coordinate of lower-right corner
int nBottomRect, // y-coordinate of lower-right corner
int nWidthEllipse, // height of ellipse
int nHeightEllipse // width of ellipse
);
// Set your own values
Region = System.Drawing.Region.FromHrgn(CreateRoundRectRgn(1, 1, 10, 10 16, 16));
Tags: .Net, C#, Rounded corners, Visual Studio
Posted in .Net | 2 Comments »