|
Thank you!
I did not know it can work this way (I am a beginner), but it worked well. I did this to test it out:
private void menuEGram_Click(object sender, EventArgs e)
{
Rectangle grid = new Rectangle(5, 100, 100, 100);
PaintEventArgs hi = new PaintEventArgs(groupBox_egram.CreateGraphics(), grid);
groupBox_egram_Paint(menuEGram, hi);
}
private void groupBox_egram_Paint(object sender, PaintEventArgs e)
{
e.Graphics.DrawRectangle(new Pen(Color.Black),new Rectangle(5, 100, 100, 100));
}
This might seem like another really basic question.. but is there a way that I can use the Rectangle that I created inside PaintEventArgs e instead of creating a new one?
Thank you.
modified on Saturday, November 22, 2008 10:35 AM
|
|
|
|
|
See_Sharp wrote: drawing the rectangle twice: 1x inside the group box, 1x outside of the group box
No, It draws a rectangle inside your GB.
See_Sharp wrote: is there a way that I can use the Rectangle or Graphics that I created inside PaintEventArgs e instead of creating a new one?
I don't think so and I don't think so it's necessary to do that. You can do whatever you want by cleaning current Rectangle and redrawing a new one.
Hope can help you.
I died as a mineral and became a plant,
I died as plant and rose to animal,
I died as animal and I was Man.
Why should I fear? When was I less by dying?
-- Rumi[^]
|
|
|
|
|
Problem solved! I appreciate it. I found out that the reason it drew the rectangle in my form was because I created the graphics object in the form, and then I used it twice. So I used groupBox_egram.CreateGraphics() instead of this.CreateGraphics().
Many thanks again.
|
|
|
|
|
Glad to hear it
I died as a mineral and became a plant,
I died as plant and rose to animal,
I died as animal and I was Man.
Why should I fear? When was I less by dying?
-- Rumi[^]
My Blog[^]
|
|
|
|
|
A groupbox, nor any other control in the ToolBox, is not transparent. You'd have to move the graphing code to the Paint event of the GroupBox and draw the box yourself. If the graph is being drawn by, or in, another control, you're going to have to change your design to accomodate this. Since you're really not using the GroupBox to group RadioButtons or other selection controls together, you can get away with removing the groupbox and just drawing your own frame around the graphing control yourself in the Form's Paint event.
|
|
|
|
|
Use the designer to put a suitable control into the groupbox. The suitable control might be a PictureBox, and put the graphic in that control.
"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
|
|
|
|
|
Im wondering if i can get a installer that installs files of a kind that can open files from the same folder that the application is from or from the inside of the application and can I get the application to play music during the installation? if so how can this be done?
lekira
leKira is my Username here but I'm World Wide know as Naiakoa Call me by any of these.
modified on Saturday, November 22, 2008 12:26 AM
|
|
|
|
|
lekira wrote: that installs files of a kind that can open files from the same folder that the application is from or from the inside of the application
What?? This doesn't make any sense.
lekira wrote: can I get the application to play music during the installation
You could, but why would you want to? This is not recommended since your installer may not be running as the sole process on the system or may be repackaged to do silent installations by your customers.
|
|
|
|
|
Well what I really mean is that I'm trying to make a installer of this program I'm making but i want it to like have a feature of playing music while its installing. is that possible to do? (srry bout my spelling I type fast)
lekira
leKira is my Username here but I'm World Wide know as Naiakoa Call me by any of these.
|
|
|
|
|
In over 20 years of developing and deploying software I have never considered playing music during the installation. Must be getting stale. Oh wait there are a couple of reasons why - what if your customer is in a cube farm where music is plain rude? What if your customer does not like your taste in music.
I would put this in the same category as web sites that start playing music when you arrive, I leave and never return.
Also I have never seen (never looked either) a install packager that support music. I wonder why that is when competing packages want any edge they can get.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Well its installing a editing software that Edits music. Theres a button that allows them to hear a sample of the program. which is what i need a code for the music playing in the installer. sorry that my wording is confusing a bit.
lekira
leKira is my Username here but I'm World Wide know as Naiakoa Call me by any of these.
|
|
|
|
|
lekira wrote: editing software that Edits music
Ah, that makes a lot more sense then.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
lekira wrote: Well its installing a editing software that Edits music. Theres a button that allows them to hear a sample of the program. which is what i need a code for the music playing in the install
Wait a minute. You say you've created music editing software, but you need code to play the music in the installer?? The code does change from what you're using to play the music in your software. Or did you create music editing software that can't play the music it edits?
|
|
|
|
|
lekira wrote: but i want it to like have a feature of playing music while its installing.
WHY?? Most installations don't take that kind of time. It's going to be a bunch of work for what kind of benefit?? What are you going play, elevator music?? You have to be VERY careful about the kind of music you're going to play. Why? Because the quality, or anoyance, of the installer is going to give your customers a first impression of your app before they even double-click the icon for it.
|
|
|
|
|
I already know about that... i need a code for when u click a button in the application that it starts the music. (which they click themselves) and another button that when clicked they can just do the installing without the music i don't force people to do stuff.
lekira
leKira is my Username here but I'm World Wide know as Naiakoa Call me by any of these.
|
|
|
|
|
Hello,
I'm trying to implement a client server system that will download a file(as a byte[] array trough a stream) from an ASP.NET server. I'm getting the file on chunks because as reported in many other places the server Respond.WriteFile and Response.TransmitFile are not reliable solutions for sending big files.
The problem is that when I run the server on local machine to test my system it works very good but when I test it on the site the clients receives every time in a few places in the stream also an array of zero's (about 1000 but not the same length every time) that are being randomly placed between the valid data. Since this happens only on a remote connection I'm thinking that data is being altered during transmition.
Should I check the data being transffered trough a system taht validates it like a checksum for every chunck sent and request that part again if it's invalid or there is another solution to this.
the server code:
int bufferLength = 2048;
Response.ContentType = "application/octet-stream";
Response.AddHeader("Content-Disposition", "attachment; filename=" + Request["document"]);
Response.AddHeader("Content-length", bytes.Length.ToString());
for (int i = 0; i < bytes.Length; i += bufferLength)
{
if (Response.IsClientConnected)
{
if (i + bufferLength < bytes.Length)
Response.OutputStream.Write(bytes, i, bufferLength);
else
Response.OutputStream.Write(bytes, i, bytes.Length - i);
Response.Flush();
}
else
{
break;
}
}
Response.Close();
client source:
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("");
request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
HttpWebResponse webResponse = (HttpWebResponse)request.GetResponse();
response = webResponse.GetResponseStream();
bytes = new byte[Convert.ToInt32(webResponse.Headers["Content-length"])];
for (int i = 0; i < bytes.Length; i += AppContext.BufferLength)
{
try
{
if (i + AppContext.BufferLength > bytes.Length)
response.Read(bytes, i, bytes.Length - i);
else
response.Read(bytes, i, AppContext.BufferLength);
if (i + AppContext.BufferLength > bytes.Length)
control.ReportProgress(i + AppContext.BufferLength, bytes.Length - i);
else
control.ReportProgress(i + AppContext.BufferLength, bytes.Length);
}
catch (Exception ex)
{
exception = ex.Message;
}
}
response.Close();
|
|
|
|
|
No, the data is not altered during transmission, you are just reading it wrong.
The Read method returns the number of bytes that was actually read, and that can be less then the number of bytes requested. So, you have to take care of the return value from the Read method, and use that to determine if there is more data to read, and how much to advance the index for the next read.
You should read until the Read method returns zero. That means that it has reached the end of the stream.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi guys, How can i rename a file using dot notion. If i were to type the absolute path with directory name then file gets renamed but using like below this actually move away the file
string src=C:\work\..\..\File.txt
string dest=C:\work\..\..\Fil007.txt
File.Move(src, dest);
|
|
|
|
|
What makes you think this will work?
Why won't you use the full path, it must be available in io.fileinfo, why do you refuse to use it?
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Dude the reason i wanted to do this way is becuase I don't want to type the path. Think aobut it again who likes it, long, cumbersome and complicated. Don't u think it would be nice if we were to just leave on the system and focus on which file we want to rename or move rather than worrying about the absolute path. I wish microsoft will realize my this kind of path pattern.
|
|
|
|
|
Dave has given the best answer, why are you typing, why not a open file dialog. The idea that the dot notation should work is ludicrous, how is the system to decide if there are multiple folders in C:\work\ .
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Their is no simple way for you to accomplish this. If you wish to do this you will have to create a loop that will search 2 layers into every folder searching for the specified file. It is much easier to accomplish if you have the exact filename/file path.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my Blog
|
|
|
|
|
That "dot" notation does not work how your example implies it does. The dots just mean one of two things. A path starting with a single dot, ".\" means "current directory". A path starting with two dots, "..\" means the parent directory to the "current directory".
In your case, the path starts at C:\work, then goes up one directory, to C:\, then up again, to C:\, then specifies the file, File.txt. The destination is also in the root, C:\Fil007.txt. So, what you essentially did, was rename the file.
Using "dotted notation" like this is not recommended because of the assumptions made by "current directory".
|
|
|
|
|
I have a chart control. But what I need is a powerful chart control.
It should show about 14.5 million points without performance problem.
Are there any chart control, that can show 14.5 million points ?
I try to use normal chart control, it takes a long time to refresh.
I try to use directx to draw lines from 14.5 million points, it takes
also long times.
Does anybody know how to handle 14.5 million points ?
|
|
|
|
|
I think you have a design problem, placing that many points on a chart is well pointless. Surely you can summarise the information to a smaller dataset without compromising the accuracy of the display.
Never underestimate the power of human stupidity
RAH
|
|
|
|