|
There is a bug in my application that on resizing Form it changes top,left position of user control on it. I have gone through all code and nowhere in my application i have written code to do this.
Is there any 'property' that does this?
Any help would be good.
Thanks,
AksharRoop
|
|
|
|
|
Check the Anchor property of that user control.. It should be set to top left alone to get it corrected as you wish
|
|
|
|
|
It worked.
Thanks a lot,
AksharRoop
|
|
|
|
|
Check the control's anchor property. You probably set it incorrectly.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
While downloading files from FTP-server through HTTP-proxy I've met the following problem: sometimes there are some zero bytes in the begin of the response (62 or 63 bytes),the end of the stream was truncated by the same count of bytes.
But the bug is not constant. If I try to download file without proxy, everything is fine.
What can be the reason of this problem and how to solve it?
Here is some code that I use to download files.
Uri srcURI = new Uri(SourceURL);
if (srcURI.Scheme != Uri.UriSchemeFtp)
throw new Exception("URL has invalid format");
FtpWebRequest webReq = (FtpWebRequest)(WebRequest.Create(srcURI));
webReq.Method = WebRequestMethods.Ftp.DownloadFile;
webReq.Timeout = 5000;
webReq.ReadWriteTimeout = 10000;
webReq.UseBinary = true;
webReq.UsePassive = true;
webReq.KeepAlive = false;
webReq.Proxy = proxy;
webReq.CachePolicy = new RequestCachePolicy(RequestCacheLevel.NoCacheNoStore);
try
{
FtpWebResponse webResp=(FtpWebResponse)(WebReq.GetResponse());
if (webResp.ContentLength == -1)
throw new Exception(string.Format("Can't download file: {0}",
WebReq.RequestUri.Segments[WebReq.RequestUri.Segments.Length - 1]));
string fname = WebReq.RequestUri.Segments[WebReq.RequestUri.Segments.Length - 1];
OnUpdateDownloadStatus(string.Format("Downloading file {0}", fname), -2);
string path = string.Format(@"{0}\{1}", DestFolder,
fname);
Stream fs = File.Open(path, FileMode.Create);
int cnt = 0;
using (BinaryWriter bw = new BinaryWriter(fs))
{
byte[] buf = new byte[ChunkSize];
using (Stream s = webResp.GetResponseStream())
{
do
{
if (AbortDownload)
throw new Exception("Downloading was canceled");
cnt = s.Read(buf, 0, ChunkSize);
bw.Write(buf, 0, cnt);
int percent = (int)(bw.BaseStream.Length * 100 / webResp.ContentLength);
OnUpdateDownloadStatus(
string.Format("Downloading file {0} : {1} %", fname, percent), percent);
}
while (cnt > 0);
}
}
}
catch (Exception exc)
{
StatusMessage=exc.Message;
}
finally
{
if (webResp != null)
webResp.Close();
OnDownloadComplit(StatusMessage);
}
}
modified on Thursday, February 26, 2009 6:33 AM
|
|
|
|
|
I found the decision here!!! So, Thank's for codeproject!
|
|
|
|
|
Dear All,
I have a DLL with method signature like this :
void printname (char* name)
I tried using the following code to to make use of my method:
-----------------------
string s="abc.xml";
char[] b = new char[100];
s.CopyTo(0,b,0,20);
unsafe {
fixed (char* p=b);
printname(p);
}
------------------------
but it seems not working....
can anyone give me some hints ??
Thanks,
Leslie
|
|
|
|
|
(char* name) Means it is a single char right ? or else it should be
(char** name) if it is an array. May be it needs the first Position.
try s[0] where s is a string in your case
|
|
|
|
|
MSDN[^]
another reference : MSDN[^] Last modified: 18mins after originally posted --
|
|
|
|
|
You don't need the char array.
char* tends to be strings, you may be able to pass a .net string in directly.
Otherwise, maybe fixed (char* p=s)
Plus you shouldn't have the semi-colon after the fixed statement.
|
|
|
|
|
Dear All,
You have be soo helpful !! I let you know which one is working as soon as get back from home !!!
Regards,
Leslie
|
|
|
|
|
hi,
how i can know the username of each process on pc like username in the task manager in c#?
|
|
|
|
|
You can use System.Diagnostics.Process.GetCurrentProcess to get the list of process which are running, assign it to the "Process" class one by one and then you can find a whole lot of info about each process
|
|
|
|
|
Hi There
I am using encryption and decryption using RijandaelManaged algorithm.
When I write integer in plain form .It is occupying 4 bytes.
When I use encryption It is occupying 16 bytes.
Can anybody tell me why?
Your response will be apperciated
Thanks
|
|
|
|
|
Encryption makes it "bigger". If it didn't, it would be relative easy to crack.
A text that gets encrypted usually isn't the same size as the encrypted version.
I are troll
|
|
|
|
|
hi, how can i know -in C# code- what a process is doing in a specific moment, what the files opened by the process and in what order?
|
|
|
|
|
Dear friends,
i have to find a solution to capture the Text or image or any file that is getting printed.
is there any possiblity to do that in c#
any idea? usefull links?
note:
i have searched in the net, and i have got program called
SpoolfileReadertest.exe in this website that was in vb.net.
this program works for dot matrix printer.
and i have "Xerox Phaser 3117" printer for this printer that program is not working.
please tell me how to capture Printer content in all the Printers?
Thak You.
With Love
Joe.I
|
|
|
|
|
hello..
i have a 100 picture boxes in my forum from PictureBox1 ... PictureBox100
and i have to assign same image to all of them and change the image at runtime so i have to write the code for each picture box like
PictureBox1.Image="";
PictureBox2.Image="";
PictureBox3.Image="";
PictureBox4.Image="";
.
.
.
PictureBox100.Image="";
is it not possible to write like
for(i=0;i<=100;i++)
PictureBox[i].Image="";
i tried it but its not the correct format so how can it be down . thans
|
|
|
|
|
You cannot use "PictureBox[i]" unless it is indexed. the one like in old VB.
Better is to navigate through the control array.. Here you can use Controls[i] (according to C# Syntax) and check for the control type ..
Enjoy..
modified on Thursday, February 26, 2009 6:19 AM
|
|
|
|
|
controlArray[i] i dont get that if could explain a bit further it would be fine
|
|
|
|
|
Something like this, I reckon;
foreach (Control c in this.Controls)
{
if (c is PictureBox)
{
PictureBox pictureBox = c as PictureBox;
pictureBox.Image = "blaaat";
}
}
I are troll
|
|
|
|
|
Yes. exactly.. this is what i mean
|
|
|
|
|
Hi,
AFAIK PicureBox is the dumbest Control Microsoft ever came up with. And you want 100 of them?
A Form should not contain such high number of Controls, and certainly not PictureBoxes. Use a Panel and draw the images yourself, that way you are in charge, your code will run more smoothly and you will not need to ask questions here again about your form flickering when you resize it.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
thans but how can i dwar a jpg image on the form...
|
|
|
|
|
max.4u wrote: how can i dwar a jpg image on the form...
using the Paint event, a Paint handler, the Graphics class and its DrawImage method, the Image class and its FromFile or FromStream methods. This is elementary stuff. Read the documentation on all the above, read an article, or better yet study a programming book.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|