|
Only a form can be modal, so you'd have to display the control in a popup window or something. MSDN has a lot of documentation about this.
Reminiscent of my younger years...
10 LOAD "SCISSORS"
20 RUN
|
|
|
|
|
I want make a HTML Designer with DHTML Editor Control in C# Language.The control 'dhtmled.ocx' relies in 'C:\Program Files\Common Files\Microsoft Shared\Triedit'.Like Microsoft Visual Studio Net Web Form Designer,I need show grid to snap the html UIElement.And I have known I should place the Editor control in a Windows Form. I named the form 'FormHTMLEditor'.I implemented the 'IHTMLEditHost' interfaces and it's method 'SnapRect'.But I didn't konw how to tell the Editor Control the service that provided by 'IHTMLEditHost'.
If I should implement the three interface:IHtmlPainter,IElementBehavior,IElementBehaviorFactory
Who can show me how to implement the solution!
3ks a lot!
gxuqin
gxuqin@cdthinker.com
|
|
|
|
|
i need to use a foreach statement on each item in my listbox so i can encrypt that item...then remove it..and move on to the next item. my question is how can i get all the items in my list box and create a string array with those items then i could use a foreach statement on it.
Jesse M
The Code Project Is Your Friend...
|
|
|
|
|
Like this:
string[] s = new string[listBox.Items.Count];<br />
listBox.Items.CopyTo(s,0);
|
|
|
|
|
im gonna go try it...but it looks like it will work...thanks alot for your help....
Jesse M
|
|
|
|
|
Well of course it will work.
|
|
|
|
|
hi all
I'm trying to read data from a dvd in order to check if the disc is ok or not
in c++ all is fine I read the files and do my tests
now I'm trying to port to c#, mostly for fun and to add a ui quickly.
what happens is: file reading is slower (about 1/3 the speed i get in c++) - code is below - and the files that contain the actual video data are locked.
I can unlock them running a dvd player, and I suppose I could find a way to do it on my own, still it's way too slow. do you have any idea about why it's so slow reading?
code
FileStream f = new FileStream(fl,FileMode.Open, FileAccess.Read, FileShare.None,16384);
while (0!=f.Read(ba,0,16384))
{
//do nothing - I just need to read the whole thing and time it
thanks!
|
|
|
|
|
Try using a BufferedStream, it may improve performance. But I bet the slow part isn't the read by itself, it's the processing part of your program that will be slower.
I see dumb people
|
|
|
|
|
as I said, it does not do any processing it just times how long it takes to read the whole file. there's nothing inside the while.. so buffering doesn't help.
What I'm trying to say is that this C# code
FileStream f = new FileStream(fl,FileMode.Open, FileAccess.Read, FileShare.None,16384);
while (0!=f.Read(ba,0,16384))
{
//DO NOTHING JUST READ AGAIN
}
is much slower than this C (++) code
fh = _open( fname, _O_BINARY | _O_RDONLY )) == -1 )
while (!_read( fh, buffer, nbytes) <= 0 ){
//DO NOTHING JUST READ AGAIN
}
the question is.. why?
|
|
|
|
|
Have you tried comparing different buffer sizes?
|
|
|
|
|
yes I've tried almost everything between 1k and 1mb, read speed stays the same..
|
|
|
|
|
just now I figured this part out:
when I use the FileStream, I cannot access the actual video files (VTS_01_0n.VOB) - I get an IOException. As I said, if I run a DVD app (powerdvd for example) it unlocks these files, and I can read them. This does not happen in c/++ using the lowlevel io routines.
I close the DVD app before running mine, so it's not in the way.
Now, if I don't unlock the files though, the ones I read I get the same performance with c# and c++. (I can only read the 30 mb VOB file for the title, and not the actual 4+gb of movie, but it's enough for an estimate).
So, I guess FileStream does some checking on the files it should read for dvd copy protection or something - it lets me read only if the files have been unlocked. Does this mean that maybe even when they are unlocked FileStream goes through something extra when reading, maybe some decoding? If so, what else can I use in c# instead of FileStream to do the job?
|
|
|
|
|
I'm not clear on what you mean by locking..
If you mean CSS protection, yes you will need a valid player to unlock the file if it is encrypted (this is why DeCSS is so poplular because it has stolen, valid keys), if you mean file system locking for un-encrypted discs, you are locking the file with this line:
FileStream f = new FileStream(fl,FileMode.Open, FileAccess.Read, FileShare.None,16384);
FileShare.None means that you are not willing to share access to this file with any other process. Also, ensure you are closing the file stream after use by calling the f.Close() method, or by wrapping your code in a using block.
|
|
|
|
|
yes, but that's not the point. I'm not sure what FileStream does, because:
- the file is readable with low level c routines (_open, _close etc)
- the same file is NOT readable with FileStream, under the same conditions.
- the file becomes readable by FileStream ONLY if i launch a DVD app.
what does this mean? does it mean that filestream checks to see if a file is a dvd css encrypted file and, if it is, it decrypts it while reading? that would explain the performance loss and the fact that it won't read files from a locked dvd, but it seems too far fetched to me. I can't come up with any other explanation though..
I should probably check tha data I read (i'm not interested in it...) and see if _read and FileStream.Read return different data - that would mean that FileStream DeCSSs dvd data - if the files have been unlocked by another app. I'll try.
The point however is that if FileStream actually decss's the file, it does much more (even though I never asked for it) than simply reading a file from disk, and giving me the raw data. An alternative to FileStream?
|
|
|
|
|
so I tried..
the data that comes out (as it should be expected) is the same. However, there still is the problem that filestream will not read a dvd file if it hasn't been previously unlocked by a dvd app, saying "can't read the file is encypted", and the very poor performance. While I can imagine that it checks for dvd protection, I still can't see why it's so slow.
I'll write the reading stuff in c++, I guess.
|
|
|
|
|
The best thing you can do is take a look at the IL for the FileStream class and its superclass from which it inherits functionality. It's the only way to know for sure. Just use ildasm.exe from the .NET SDK and open mscorlib.dll from %SystemRoot%\Microsoft.NET\Framework\v1.0.3705.
Reminiscent of my younger years...
10 LOAD "SCISSORS"
20 RUN
|
|
|
|
|
Hi, All:
I am writing my FIRST Windows Form Application in .NET to edit my MS Access database. In this Access DB, I have a table with two columns: EquipmentID and EquipmentDescription. Some other tables use the ID to refer the equipment. This application supports multiple users at the same time. That mean that it could be more than one user add new equipmment. I use in-memory DataSet to get user's input and then call Insert/Delete/Update methods. I am debating that whether I should use Access AutoNumber for the ID field, or I should just use DataReader to get the Max ID used, then Add 1 to create my new ID. The AutoNumber makes things simpler, but if I try to merge to DB later, I will have a lot of headaches. If I assign my own ID, I might have conflict with other users and fail the INSERT.
So what is the typical way to achieve this, I know a lot of people have done this, please give me some ideas. Thanks in advance.
Dion
|
|
|
|
|
I'm doing a Win32 (commercial) application currently and this is a simplified view of how I do it.
For inserts:
- get user input from screen
- call business class to do validation, etc...
- business class calls generic data layer passing GUID as primary key
I use the GUID class to prepare a unique number. This way it will work for several users.
For updates:
- user selects a certain row
- business class uses this primary key to retrieve data along with a concurrency ID. This could be a timestamp in SQL, but I'm using another GUID instead.
- user does edit
- business class calls data layer, passing editted rows fields, GUID and concurrency ID
- data layer checks that the current concurrency ID still matches the one in the DB and then does UPDATE.
HTH
Cheers,
Simon
"The day I swan around in expensive suits is the day I hope someone puts a bullet in my head.", Chris Carter.
animation mechanics in SVG (latest pic 1) (latest pic 2)
|
|
|
|
|
Is there a way to make a certain column in the datagrid fill up to a 100% in the datagrid?
|
|
|
|
|
Not dynamic (before connecting DataSource):
datagrid.PreferredColumnWidth=datagrid.Width
Dynamic (only if You use DataGridTableColumn) in Resize event of DataGrid:
datacolumn.Width=datagrid.Width
but - remember about rowheader and vscrollbar width.
Hi,
AW
|
|
|
|
|
Hi all
I have a couple of quick questions:-
1. What do I do to allow my code to process one section of code at runtime and one section of code at design time?
2. Is there a forms collection? Basically I have an MDI app where I will require to shut down all the windows that have been opened programatically upon a certain user action.
Thanks in advance
ANdy
|
|
|
|
|
Almost every peace of code in windows programming is processed at runtime
well for this problem. u may save the references (pointers) of the currently
open forms in a hashtable or in any dynamic datastructure(e.g list) and
upon an event (e.g button click ) u just iterate that list and close the
forms by calling the appropriate messagecall.
bye
|
|
|
|
|
1. Use DesignMode property of components
Hi
AW
|
|
|
|
|
Here's a link from MSDN that deals with a similar subject. Perhaps it will help.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwinforms/html/reaworapps1.asp
Jim Stewart
|
|
|
|
|
I am developing a web app that calls on the execution of an external application. The code compiles with no errors, however, the external execution is never implemented.
I am not at all sure what I am doing wrong. I've done the same thing using a windows form and it works. Could it be a security issue? Is it how I'm calling on the external application?
Me, wrong!?! Nah, you just need to change your thinking to make me right.
|
|
|
|