|
You mean drawing vertical lines following the path of the curve? How do I get the point from the path? I used only four points (p1 to p4) to create the closed curve. Isn't this solution will make painting slower?
|
|
|
|
|
Yeah, it makes painting much slower and you cannot have the points on the curve returned to you to use, so you have to make something else up.
Seriously, GDI doesn't know anything about 3D. I highly suggest moving on to WPF, OpenGL or XNA instead.
|
|
|
|
|
Valeriant wrote: How do I get the point from the path?
You can calculate it's position, or move to the black pixel that lies on the right side of the current pixel (one higher or lower, perhaps).
Valeriant wrote: Isn't this solution will make painting slower?
Slower, compared to what?
I are Troll
|
|
|
|
|
Eddy Vluggen wrote: You can calculate it's position, or move to the black pixel that lies on the right side of the current pixel (one higher or lower, perhaps).
How do I calculate the position? How do I move to the black pixel? Can you give an example in C#?
Eddy Vluggen wrote: Slower, compared to what?
Slower because it paints n lines compare to just filling a region?
I can draw the ellipse repeatedly while changing the location each draw (height and slant) to create a fill effect, easier to code but slowing the overall painting (I could have lots of cylinder to draw).
I kinda have a feeling that the solution might be a mathematical calculation (with tan, cos or sin), but I really don't have any idea. If I know the outer most point and the correct tension for using, maybe, AddCurve() in GraphicsPath, I could then fill the cylinder's side, right? That's what I think, but any other solution is welcome.
|
|
|
|
|
Valeriant wrote: How do I calculate the position?
The same way that .NET calculates where to draw the dots that form the upper and lower circle.
Valeriant wrote: How do I move to the black pixel?
The simplest way that I can think of would be doing a GetPixel()[^] to the right. It may be located higher or lower than the pixel that you started from.
Valeriant wrote: Can you give an example in C#?
This CodeProject-article[^] might get you started
Valeriant wrote: Slower because it paints n lines compare to just filling a region?
For that you'd first have to define the region to be filled. You can use the FloodFill-algorithm, for example, that would fill everything from a certain point until it "hits" some other color-boundary. Drawing a line is a very fast operation btw.
Valeriant wrote: (I could have lots of cylinder to draw).
May I suggest that you don't try to draw 3D-objects, but move to WPF/XAML[^] or XNA[^]? These make managing 3D objects a lot easier, plus that they have painting-routines that are optimized to misuse any graphics card available.
WPF would be the way to go if the 3D-objects are displayed in an Office-kind of environment, XNA the route if the 3D-objects are used in a game-like interface.
Hope this helps
I are Troll
|
|
|
|
|
I asked the same question in the Algorithm section, thinking that it might got to do with math calculation. Thanks for the help and suggestion.
|
|
|
|
|
Hi, this is my first post so hopefully I get everything in here that I need too.
Here is my problem, I have a command line utility that once running accepts commands / input before displaying results. To keep things simple I am starting to build my understanding using nslookup.
ALl the threads I have found so far relate to executing a command and capturing output, nothing about actually 'driving' a command line utility through the secondary input of commands / instructions.
Can someone help me out here... as mentioned, using nslookup as a sample utility I want to be able to:
- Launch the nslookup utility with no arguments or parameters (this I can do).
- At the point NSLookup returns the '>' prompt, I want to send some input / issue a command to the utility. For example www.codeproject.com.
- I want to capture the results / output of the execution so that I can analyse the text stream within my application, and retain enough control to submit a second instruction to nslookup (i.e. it doesnt exit until I choose to exit).
Any help greatly appreciated
|
|
|
|
|
I guess you have to start nslookup with arguments and then parse the output yourself. Just running nsloolup.exe without parameters will only start the application itself (as you have discovered).
|
|
|
|
|
You can get the output generated by the commandline app (I forget exactly how this is done), and then respond to that.
.45 ACP - because shooting twice is just silly ----- "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." - J. Jystad, 2001
|
|
|
|
|
What you want is input/output/error redirection of a process, which is supported by the Process class.
Have a look at the following stream-related Process members:
properties StandardInput, StandardOutput, StandardError
events OutputDataReceived, ErrorDataReceived
As an alternative to using events, you could create a few threads, each dealing with one of the streams, based on a loop calling Read() or ReadLine(). Do not use ReadToEnd() on the output/error streams as they would probably block until the process exits.
|
|
|
|
|
|
This is what I'm playing around with. Except for reading the error stream, and utilities that don't prompt when executed this way, it works pretty well.
|
|
|
|
|
I haven't done that on a local system; only on a remote system -- by telnetting in and using a script to interact with the remote system.
It occurred to me today (before I even read your post) that my script engine might be able to work locally.
My article on my script engine is nearing completion; I hope to finish it up today.
|
|
|
|
|
That sounds like it could be interesting Look forward to reading it.!!
|
|
|
|
|
I have a working example going now. It works with nslookup and at least one utility of my own, but not FTP and TELNET -- they don't prompt when executed in this manner.
How have you progressed in the meantime?
P.S. And I did post my script article. I'm just working on the class that wraps a Process so the engine can use it.
|
|
|
|
|
As a newbie to code writing this one got me really stumped. While I have been contemplating and get help from people here I turned my attention to some other area's that I need to master in order to get to the end of my project. I am now able to churn out windoes services / service installers etc... without much hassle.... all I need to do now is to get my service to drive these cmd line utilities
I havent looked yet but am looking forward to seeing what you have done and how you did it.
|
|
|
|
|
|
i have a form which contain rich text box and that accepts return key.On save of text with multiline text property to the grid it shows a square on enter key press position..pls help
modified on Friday, March 19, 2010 7:32 AM
|
|
|
|
|
Change your column's WrapMode to true .
///to clarify:
Change the wrapmode of the DataGridView.RowTemplate.DefaultCellStyle
|
|
|
|
|
i ve set wrapmode to true..a small square box is shown on save of text from rich text box with accept return set as true
|
|
|
|
|
Seems to work on my machine.
Could you post some (short and isolated) example of your code that reproduces this behaviour?
|
|
|
|
|
there isnt any code for it..my multiline and word wrap property is set to true..a small square box appears when i click save button after entering data with accept return property set to true.Cud u plz help me
|
|
|
|
|
Hey guys,
I want to fill my array into a .xls or .xlsx file...
momentary I fill it with 2 loops from my grid.
I read something about the ".Range" property from Excel, but how can I handle it?
or is there a possibility to import 120.000 rows & 20 cols much faster?
hope you can help me!
thanks previously
modified on Friday, March 19, 2010 7:46 AM
|
|
|
|
|
Depending on which version of Excel you're using, you can easily run the machine out of RAM doing this. Also, there are versions of Excel that cannot hold 120,000 rows in a single sheet.
You have to populate each cell with its appropriate value from your dataset. There is no "bulk" way to do it.
Your only other option, instead of filling in a Worksheet object directly, is to write your data out to a .CSV file and open that in Excel.
|
|
|
|
|
Hey
>> Also, there are versions of Excel that cannot hold 120,000 rows in a single sheet.
Office Excel 2007 can hold 1.048.576 rows.
>> Your only other option, instead of filling in a Worksheet object directly, is to write your data out to a .CSV file and open that in Excel.
Should have a .xls or .xlsx format and should can autosize cols and edit backcolor from the header.
>> You have to populate each cell with its appropriate value from your dataset.
There must be an another way...
...fill it with
for (int i = 0; i < UsingGrid.Cols; i++)
{
for (int j = 0; j < UsingGrid.Rows; j++)
{
worksheet.Cells[j + 1, i + 1] = ConvertToExcelFormat(Convert.ToString(UsingGrid[j, i]));
}
}
costs amount of time (up to 10 minutes)...
modified on Monday, March 22, 2010 3:56 AM
|
|
|
|