|
When creating a shortcutkey, an error occurs with single keys like ‘f’ or ‘w’ , etc. I don’t have a problem with not using these but I can’t find any rules. Is there a list on valid shortcut keys?
Thanks
Programmer
Glenn Earl Graham
Austin, TX
|
|
|
|
|
Because you must select a combo (e.g. Ctrl+F or Ctrl+Alt+W), not a single key. Single keys will interfere with standard functions within your application, like typing.
Trinity: Neo... nobody has ever done this before.
Neo: That's why it's going to work.
|
|
|
|
|
Im using something called syntax high lighting textbox library in one of my project. To be able to easily highlight syntax, i wrote this lil code:
<br />
TextReader syntax_blue = new StreamReader("synHighLib_DB/blue.txt");<br />
while (syntax_blue.ReadLine() != null)<br />
{<br />
shtb.HighlightDescriptors.Add(new HighlightDescriptor(syntax_blue.ReadLine(), Color.Blue, null, DescriptorType.Word, DescriptorRecognition.WholeWord, true));<br />
}<br />
syntax_blue.Close();
It compiles properly, but when i start typing into the text box, i get the unhandled exception error. Im 100% sure this is the code that causing the error, because, when i remove it, it works fine...
|
|
|
|
|
Posting the exception you're receiving would be very helpful, but it looks like you're calling ReadLine twice without any assurance that you have two (or a multiple of two) lines to read. Readline is going to advance the cursor each time it's called.
Additionally, if the code above is inside an error handler, I would point out that it might not be the best choice to open and parse a text file every time a key is pressed.
Finally, a TextReader is a disposable type, so I would recommend either inserting a Try...Finally block or, better, a using (TextReader syntax_blue = ...) block instead.
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
|
|
|
|
|
I need to obtain all of the bookmarks within a Word document using late binding. I have easily done this using early binding. However, I am having some trouble with the former. I know how to open and write to a file. I have the framework developed. Any help on returning the collection of bookmarks using this method would be much appreciated.
Thanks
P
|
|
|
|
|
I'm trying to use the FolderNameEditor in a property grid. Like this:
[Editor(typeof(System.Windows.Forms.Design.FolderNameEditor), typeof(System.Drawing.Design.UITypeEditor))]
But it seems that FolderNameEditor is not in that namespace. Although all the documentation that I've seen says that it is. I'm using VS2005 and the 2.0 framework.
Can someone tell me where this editor is?
|
|
|
|
|
hi
add a reference to:
System.Design.dll and System.Drawing.Design.dll
regards
|
|
|
|
|
Hi,
Thanks, that's it.
I had System.Design and System.Drawing (which should have been System.Drawing.Design).
RS
|
|
|
|
|
For the project I am working on, if I cannot find an image, I am going to write the image name to the picturebox instead. However, there doesn't seem to be a straightforward property (like "Text") that I can use. Is there an easy way to do this?
|
|
|
|
|
Andrew Stampor wrote: Is there an easy way to do this?
Define easy
One way would be to replace, at run time, the picture box with another control, like label, that has a text property.
To keep the picture box you would need to create an image and write the text on to it, then assign it to the picture box. There numerous examples of how to do this.
only two letters away from being an asset
|
|
|
|
|
You can place a label over a picturebox and change its visibility according to existence of picture
|
|
|
|
|
picturebox.visible = false;
label.visible = true;
This essentially replaces the picturebox with the label control.
only two letters away from being an asset
|
|
|
|
|
I only have access to the picturebox itself. Using a label would be a good way, but I cannot rely on it.
I think I will try to override the OnPaint, but it seems like more trouble than it should be.
|
|
|
|
|
Andrew Stampor wrote: I only have access to the picturebox itself.
You can override the OnPaint event but you can't place a label control on the form?
only two letters away from being an asset
|
|
|
|
|
The picturebox is inherited from and extended. I do not know which form(s) it will necessarily be on. I was able to take care of it with OnPaint. Thanks for your help, guys.
|
|
|
|
|
you can use a label as a pictureBox so catch two birds in one hand
|
|
|
|
|
Yes, create a bitmap, draw the string onto it, and put it in the picturebox.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Bitmap bm = new Bitmap(@"C:\YourPicture.bmp");
Graphics gr = Graphics.FromImage(bm);
gr.DrawString(""test", new Font("Verdana", (float)10, FontStyle.Bold, GraphicsUnit.Pixel), new SolidBrush(Color.Red),(float)20, (float)20);
gr.Dispose();
pictureBox1.Image = bm;
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Hello All,
I have good knowledge of Visual Basic, but coming project is in C#. If anybody can give some urls for tutorials or samples it will be helpful.
Thanks in advance.
Thanks & Regards,
Kumar
|
|
|
|
|
|
If you already have a background in VB then try just reading the spec at:
CSharpSpecStart
As far as book, I liked Apress' Pro C# 2005 and the .NET 2.0 Platform. I think it is a great book for those who already know programming but don't know the C# lanagauge.
|
|
|
|
|
Hope this[^] link will be more Useful when you wnat to learn C#.
Regards,
Satips.
|
|
|
|
|
Hello All,
Thank you very much for providing some useful urls.
Thanks & Regards,
Kumar
|
|
|
|
|
I decided to make my life much harder than it is and convert some C++ code I have to C# (and possibly Java some day).
Please - no "Why do that you dummy" responses, that serves no purpose. Also, with NO EXCEPTIONS there isno single tool to take a C++ code set, reverse it to a complete UML model and re-engineer it into C# (there are numerous tools that kinda do parts, but still leave too much work. I figured out that a combination of 6(six) yes 6 tools will provide that process at a total cost to myself of too much (money and effort).
Lastly, C++ has too much complexity and I refuse to pander to it anymore than I must - AND I DO NOT WANT TO WRITE MY OWN PARSER for all the crap that's snuck into it.
Actually I'm answering some personal questions I have about development and processes in general and this seemed like a good test. Also I have a large body of "real" C++ code I'd like to rebuild in C# and I'm working on a methodology and VS tools to do it.
I selected this specific code for specific reasons and is quite large and complex (its the source code to a windows based RTS game from a few years back), and I think I have a handle on most issues.
However ....
I would like suggestions as to how to gracefully handle the following situations:
(what I'm currently doing in parens)
- TYPEDEF's (So far I've punted and done a global Search and Replace)
- Macros (Utility functions)
- Unions (distinct structs, remodelled use)
- const (removed and ignored)
Any physiologically possible solutions gratefully received and considered. If you have any additional problems in this (such as struct inheritance) please let me know.
If I get the time I'll post an article on this subject (with attributions) - I can't be the only person wishing for a NET/C# alternative to some of the s****y C++ code out there. Nor the only person who wants tools to make it more efficient.
Nothing is impossible, we just don't know the way of it yet.
|
|
|
|
|
"- TYPEDEF's (So far I've punted and done a global Search and Replace)"
- I think this is the only practical way to handle typedef. You can replace certain simple cases with the C# alias syntax "using Foo = x.y.z".
"- Macros (Utility functions)"
- We handle it with search/replace combined with replacement with the simple C# flag type #define (the flag #define allows the converted #ifdef FOO directives to continue to be useful). One problem is that macros are type-less, so it's problematic to refactor these to static methods.
"- const (removed and ignored)"
- Yes, they must be removed, but they provide information for a C++ to C# conversions (especially for parameters).
C++ to C# (or to any other language) is indeed no picnic (we've recently released 'C++ to C# Converter', which eases the task somewhat, but there's just too much complexity in the C++ language to allow a high conversion rate).
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
C++ to C# Converter: converts C++ to C#
C++ to VB Converter: converts C++ to VB
Instant C++: converts C# to C++/CLI and VB to C++/CLI
Instant Python: converts C# to IronPython and VB to IronPython
|
|
|
|