|
emmm, maybe i got something from your speech.
here is my Saving progress:
Bitmap bmp = new Bitmap(@"D:\1\111.bmp"); // 111.bmp is a 24bits bmp saved by paint.exe
bmp.Save(@"d:\1\111.gif",ImageFormat.Gif);
only 2 lines codes above. maybe the 111.gif lose alpha info after convertion.
|
|
|
|
|
fu0 wrote:
maybe the 111.gif lose alpha info after convertion.
Yes it does lose the alpha, because the GIF format doesn't support it, so there are your "holes" in your GIF image.
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
I am consuming a webservice from my C# component(which will be used by lots of applications), basically i want the to return and specific number -200 when the webservice is down.
Can any one suggest me how can i do it?? I am planning to put multiple exception blocks, like application exception,web exception,protocol exception etc, does that work??
Any pointers to this will be helpful.
TIA,
sudheer
|
|
|
|
|
You can't put it in the WebService because if it's down, how is it going to return a value? Especially if there is a network problem...
Your consumers will have to handle the exception themselves and, if required, set the return value to -200 in their exception handlers.
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
In addition to what Dave said, you can either handle multiple exception types or catch them all like so:
try
{
}
catch (WebException ex)
{
}
catch (ApplicationException ex)
{
}
catch (Exception ex)
{
} You could also catch all exceptions like so:
try
{
}
catch (Exception ex)
{
} If you don't plan on using the exception info, you can either use an empty catch like:
try
{
}
catch
{
} ...or catch specific exception types like:
try
{
}
catch (WebException)
{
}
catch (ApplicationException)
{
}
catch (Exception)
{
}
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi,
I'am trying 2 create a textbox dynamically in a windowsform application...
I want a textbox 2 b created while clicking a button in the form...And it has 2 b loaded thru code rather than thru design ...
I tried but was not able 2 create the control...Cud u pleez get me the code 4 this one..???
Thanx n Regards,
MMX
|
|
|
|
|
hi,
this is the way how you do it ...
private void button1_Click(object sender, System.EventArgs e)
{
TextBox tb = new TextBox();
tb.Width = 100;
tb.Location = new Point(100,100);
this.Controls.Add(tb);
}
Hope this solves your prob..
regards,
Aryadip.
Cheers !! and have a Funky day !!
|
|
|
|
|
If you want to see all textbox which added to the form.then you can use the below mentioned code block
private void button1_Click(object sender, System.EventArgs e)
{
Txtbox= new TextBox();
this.Txtbox.Location = new System.Drawing.Point(locx, locy);
Txtbox.Width = 100;
this.Controls.Add(Txtbox);
locx=Txtbox.Location.X;
locy=Txtbox.Location.Y+30;
}
//here i have only one button on my form. On button click i am dynamically creating
//textbox control and adding to the control collection of form.
//before getting into code you have to declare one private datamember of the type textbox and two integer variables that will help you to keep the location unique.
so you can avoid overlapping.
private System.Windows.Forms.TextBox Txtbox;
private int locx=20,locy=30;
hope this will avoid from overlapping
Sreejith S S Nair
|
|
|
|
|
If I want to use special cursor image other than the default list given in .Net environment, how to add new image to the list of available images.
|
|
|
|
|
You can not in the default list.
After creating a cursor you use it through your own class.
|
|
|
|
|
On desigh time you have only limited number of cursors.
but on run time you can change you cursor of form or any control which is avilable in your application.
where you want to write code is up to you.
eg: if you want to change the cursor of the form on form_load or button click event , what you need to do is simply write this code.
this.Cursor=new Cursor("C:\\DRAGPICT.CUR");
//here i am changing cursor of my form.
// if you want to change the default cursor of any control. then follow this
this.button.Cursor=new cursor("C:\\newcursor.cur");
hope this will help you
Sreejith S S Nair
|
|
|
|
|
Hi,
I would like to save files into the "Temporary Internet Files" folder.
How do you set the path when the user is different each time?
string path = "C:\\Documents and Settings\\<user>\\Local Settings\\Temporary Internet Files\\";
thanks,
Ron
|
|
|
|
|
You really shouldn't do that because the folder has a special purpose that is not under your app's control, and can be wiped out without you knowing about it.
But, if you must...
You can use the Environment.GetFolderPath method to return the full path to the Temporary Internet Files folder for the logged in user:
string tempInternetFilesFolderPath
tempInternetFilesFolderPath=Environment.GetFolderPath(Environment.SpecialFolder.InternetCache);
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi Dave,
Ya... I'm not sure. I'm trying to emulate the feature "Send" in WordPad (e-mail your document). I noticed that WordPad is saving a copy of the doc in the folder OLK63B in Temporary Internet Files (this file is used for the attachment). I guessing they're doing this so the file is flushed eventually? I can't actually see this folder "OLK63B" when I use Windows Explorer though. They must be creating a copy file so your not having to save the modifications (if any) before you send. Maybe I should just (via my code) create a copy file (append with the word "COPY") and delete the file after sending. What do you think?
Ron
|
|
|
|
|
That will work. You could even just create the file in <SystemRoot>\Temp with the original filename, attach the file to the email message, send the message off, then delete the temp file. I'd use the original filename (unmodified) so the user at the other end can save the file with the same name it was created with.
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks Dave,
I'll do just that...
I'm new to programming, so I'm not sure just the best way to delay the delete of the file (so that Outlook has time to load/place/send the attachment). I could use a MessageBox (Click OK to delete attachment file), but that seems cheesy. Can you use code to tell when any running application closes?
Ron
|
|
|
|
|
You could use the Process class to monitor the process list for the close, but that would involve either launching a seperate thread to poll the process list every so often, or blocking your app and waiting for the Outlook message window to close. Also, the problem with that is if the user is not using outlook, but a different email package the process will be different.
There is no easy way to do this except to NOT make a copy of the file and just send the original file and not worry about monitoring anything and deleting files.
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
"just send the original file and not worry about monitoring anything and deleting files"
Yes this is the way I have it now... force the user to save the file first(if not already saved), and to also save the file if modified. I was thinking that some users say not want to save the modifications to the original file (just have the modifications in the e-mail file).
Maybe I could create a temp folder in the program folder and have it nuked on the app. close event. Thanks for all your help!
Ron
|
|
|
|
|
myNameIsRon wrote:
Maybe I could create a temp folder in the program folder
Not a good idea. The Program Files folder can be ReadOnly for some users.
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
When the mouse is moved over PrintPreviewControl, how to change the cursor only when it is on the document that is displayed in the control. It should remain at default state outside the document. When two pages are displayed in the PrintPreviewControl, how to identify which page is clicked?
Also, how to display the vertical scroll bar of PrintPreviewControl programatically?
can we sense its up/down click events?
|
|
|
|
|
Please be patient and don't post the same question over and over again.
See your previous post. You'll find that the PrintPreviewControl doesn't expose any of this functionality.
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
sorry for the trouble.
but as i was requesting help on
how to display the vertical scroll bar of PrintPreviewControl programatically?
can we sense its up/down click events?
I thought of raising old questions too, as I am really facing hard time. I want to do it my self, though I am a new learner.
In case of finding the co-ordinates of the page image , suggest me the possible ways please.
regards
|
|
|
|
|
sachinkalse wrote:
I am really facing hard time. I want to do it my self, though I am a new learner.
If your deadline is that close, try and find a 3rd party component that will expose this functionality because the PrintPreviewControl will not do and writing your own component will be exceedingly difficult for a beginner. To expose this kind of functionality, you would have to write your own print preview control from scratch. Like I said, NONE of the functionality you are looking for is exposed by the PrintPreviewControl.
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
yes, i do have time, need a little bit of guidance.
regards
|
|
|
|
|
That's not what your last post said, but anyway...
Look into using the PreviewPrintController class. There are no examples of how to use this class to build your own PrintPreviewControl, but that what it's used for.
Search the Web for PreviewPrintControl and you'll see what I mean.
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|