|
Please don't cross post.
---
Year happy = new Year(2007);
|
|
|
|
|
hi all,
i want to validate a text box which is used to enter multiple email addresses. can anyone of u tell, is it possible to use regular expression validator? or have to use java script??
kindly give a solution for the above problem.
thanks in advance
Regards
Babu
|
|
|
|
|
To validate comma separated values you just have to use a repeating pattern.
For a simple example, to verify a string of comma separated characters "a,b,x,y,z", you can use a pattern like "[a-z](,[a-z])*". To use it with email addresses, just substitute the [a-z] set with the pattern for an email address.
---
Year happy = new Year(2007);
|
|
|
|
|
Hi,
The requirement is that the end user would upload an image to the application, the uploaded image should be modified with a watermark and then be saved in our application. Kindly guide!!!
Thanks!!
Gautham
|
|
|
|
|
I'd suggest reading my image processing articles for info on how to access the pixels of a bitmap, then work out what sort of watermark you want to add. Assuming you don't just want to add a bitmap in the corner or something simple.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
A method like this may do the job, if you just want to add text to the image: (you'll need to include the System.Drawing reference and namespace)
Bitmap AddWaterMark(Bitmap uploadedBitmap)
{
Bitmap newBitmap = new Bitmap(uploadedBitmap);
Graphics g = Graphics.FromImage(newBitmap);
g.RotateTransform(45); // Angle of text
g.DrawString("Watermark Text",
new Font("Arial", 12f),
new SolidBrush(Color.FromArgb(100, Color.Black)), // the 100 is for transparency (0 = invisible, 255 = opaque)
new Point(100,100));
return newBitmap;
}
|
|
|
|
|
Thanks Bob!!!
Tried the given code. now that we have the graphics object which is updated. How to apply this to my image, to what should i assign the returned bitmapfile? how to save my final image with the watermark?
Thank you
Gautham
|
|
|
|
|
Hi Bob!
Sorry for the other question! It worked thanks a lot.
The only thing i have to think about is to place the text at a specific location irrespective the size of the image.
Thank You.
Gautham
|
|
|
|
|
New and improved Method to help you place the text perfectly diagonal and centered. All you have to decide on is the font and transparency.
Bitmap AddWaterMark(Bitmap uploadedBitmap)
{
Bitmap newBitmap = new Bitmap(uploadedBitmap);
Graphics g = Graphics.FromImage(newBitmap);
// This StringFormat will position the text so that
// the Point in the DrawString() method below is in
// the centre of the string rather than top-left
StringFormat strFormat = new StringFormat();
strFormat.Alignment = StringAlignment.Center;
strFormat.LineAlignment = StringAlignment.Center;
// Here we use a bit of Trigonometry to calculate the angle
// so that we can draw the string perfectly diagonally based
// passed bitmap dimensions
double tangent = (double)newBitmap.Height / (double)newBitmap.Width;
double angle = Math.Atan(tangent) * (180 / Math.PI);
// Here we adjust the position so that we place the text half-way
// along the hypotenuse (diagonal line through bitmap)
double halfHyponenuse = Math.Sqrt((newBitmap.Width * newBitmap.Width) +
(newBitmap.Height * newBitmap.Height)) / 2;
g.RotateTransform((float)angle);
g.DrawString("Watermark Text",
new Font("Arial", 12f),
new SolidBrush(Color.FromArgb(200, Color.Black)),
new Point((int)halfHyponenuse, 0),
strFormat);
return newBitmap;
}
-- modified at 9:09 Tuesday 23rd January, 2007
|
|
|
|
|
Hi,
Can any one help me to build a listview control where i can add two check box in the last right column of listview.
|
|
|
|
|
Even though its possible, its not simple... Why dont you u use datagrid? Its easy to do that with datagrid....
|
|
|
|
|
Hi,
I am looking for some tutorial in c# object oriented programming.
Can anyone share some good links.
Have a good day
|
|
|
|
|
OOP is the same, no matter what the language. I'm sure google is teeming with information, but I'd recommend buying a good book and working through it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Could you please recommend one or two.
When you get mad...THINK twice that the only advice
Tamimi - Code
|
|
|
|
|
Hi,
Can any one help me to build a listview control where i can add two check box in the last right column of listview.
Please help me.
THanks
Biswabhusan
|
|
|
|
|
Hi,
I have a class that has a string attribute.
I set this attribute to " " (a space) and serialize the instance to an xml file. When I deserialize that instance the value of that string attribute is null, not space..
How can I do that??
public class MyClass
{
private string str;
public string Str
{
get{return str;}
set{str = value;}
}
}
[STAThread]
static void Main(string[] args)
{
MyClass mycls = new MyClass();
mycls.Str = " ";
TextWriter tw = new StreamWriter("str.xml");
XmlSerializer sr = new XmlSerializer(typeof(MyClass));
sr.Serialize(tw, mycls);
tw.Close();
FileStream fs = new FileStream("str.xml", FileMode.Open);
XmlSerializer sr2 = new XmlSerializer(typeof(MyClass));
MyClass mycls2 = (MyClass)sr2.Deserialize(fs);
fs.Close();
Console.WriteLine("***" + mycls2.Str + "***" );
}
output: ******
|
|
|
|
|
Try this out!!!
. . .
FileStream fs = new FileStream("str.xml", FileMode.Open);
XmlTextReader reader = new XmlTextReader(fs);
XmlSerializer sr2 = new XmlSerializer(typeof(MyClass));
MyClass mycls2 = (MyClass)sr2.Deserialize(reader);
. . .
|
|
|
|
|
Hai Guys,
Do you know how to read the attribute value of an element in xml using c# dataset and tables.
Explanation with example will be appreciated.
Thanks.
VijayaRam
|
|
|
|
|
Is there any way we can show embedded flash content in a webBrowser control? and is there any way of doing this without the flash player installed? Thanks in advance.
|
|
|
|
|
Hai Guys,
I have problem in localizing my application to some other language such as japanese, chinese,etc.
Your Ideas about implementing localisation in c# windows application is welcomed and appreciated.
VijayaRam
|
|
|
|
|
Please share your problem.
Regards,
Bhupi Bhai.
|
|
|
|
|
Hi,
To implement the localization we need to do
1) Create .resx file for each language.
2) Generate .resource file from the .resx file using resgen tool.
3) Create the ResourceManger in your application.
4) The .resx files store the language strings as key value. So read the language string using the Getstring method of ResourceManager passig key value as input parameter.
Guess this will help you.
Pani
|
|
|
|
|
Thanks for your idea,
But can you ellborate your points in details for clear understanding.
if possible can you provide Sample codes, it will be useful.
Thanks & Regards,
VijayaRam
|
|
|
|
|
our website is being hosted by some other people sir
and now i have changed write permission and i updated on the webserver
still the same problem is coming
do i need to publish my site once again and update all of the files or
only the databasse file has to replaced sir
how can i change write permission to mdb file programatically
thanking u bye
|
|
|
|
|
Hello,
I want to know how we transfer file or send file to another ..
like if client want to send file on server,, what i will do in C# for this
Thankyou
|
|
|
|