Mav, Very cool article - just what I need methinks. I'm going to have to read it a couple of times to make sure I understand it though! Many thanks. John.
rvp717y
Posts
-
Printing the contents of an RTF Textbox control... -
Printing the contents of an RTF Textbox control...I've created an application for logging various events in an RTF textbox with lots of formatted text and graphics etc. Now I'd like to be able to print the contents. But! I can't find any simple way to do this... One solution I've found saves the contents to disk as a .rtf document and then gets wordpad to print it. This works and produces very nice output - however wordpad doesn't support headers and footers and I really need to add date and timestamps plus page numbers to the bottom of each page. Does anyone know of a simple way, or a good resource which describes how to print the contents of an RTF textbox? Many thanks for your kind help. John.
-
How to set SelectionFont when it returns null?Thanks Luc, I was really hoping that something so complex wasn't required! Kind regards, John.
-
How to set SelectionFont when it returns null?Hi there, I've got a standard RTF control and am coding a basic text formatter. In the event the user selects a section of text which has multiple fonts contained in it, SelectionFont will return null - that's documented and accepted behaviour. However - how do I now set the font for the selected text to the new font in that case? All the examples I've found use variations on the theme of: richTextBox1.SelectionFont = new Font( currentFont.FontFamily, currentFont.Size, newFontStyle); which clearly won't work if richTextBox1.SelectionFont == null. Please help! Kind regards, John.
-
Rich Text Box to Rich Text Box - Help!That's cool - I'll have a play with that over the weekend. I'm glad that it isn't just me and this actually is quite hard! :(( Kind regards, John.
-
Rich Text Box to Rich Text Box - Help!Luc, That's kind of what I'm doing now, but I'd like to allow the users to use the full RTF formatting options open to them, including pasting in graphics. Kind regards, John.
-
Rich Text Box to Rich Text Box - Help!Hi there, I'm creating an application to securely record information typed in by the user. A main window (let's call it 'A') with a large RTF box displays the text so far - this text box is read-only to preserve the integrity of previous entries, so no editing is allowed here. When the user wants to post a new entry the they click a button and a new RTF box appears (call this one 'B') - into this the user can type or paste RTF compliant entries, when done, clicks "OK" and the contents of this RTF box (B) need to be added to the read-only main window (A). I don't have a problem with the protection and getting stuff from B into A - however I have a major problem maintaining the RTF formatting when taking the contents of one RTF control and appending it to the contents of the other read-only version! I don't want to save RTF from B to file and read that in to A as this will present the opportunity to subvert the process and add additional material. Likewise, I can make this work very reliably if I stick with plain text - but the moment I want to retain the RTF formatting it all gets very hard. Any thoughts? Kind regards, John.
-
Help needed converting string hash values into binary...Okay, having implemented your code I've got a saving of three seconds with 2755 hashes processed. My code took 2 mins 33 secs to process, whereas yours took 2 minutes 30 - that's 18.3 hash conversions per second! This is a small sample file so I'm sure that in the real world application of this the savings will be very significant. Many thanks for your help. Kind regards, John.
-
Help needed converting string hash values into binary...That's very cool Luc, thank you. I think I'll implement that as I guess it will make the program run much faster! Kind regards, John.
-
Help needed converting string hash values into binary...Yup, you're right - it's a 32 character long string, however it does only occupy 32 bytes - it's not unicode. No encoding required - it's pure ASCII and is stored as such. Anyway after much head scratching, I've got the following code to work: // sHash[32] is a byte array length 32 // eg: the hex value 'A6' is split into sHash[0] & sHash[1] // the following code will amalgamate this character data into a // byte array length 16 int l = 0, iFirst, iSecond; for (int k = 0; k < 32; k += 2) { if (sHash[k] > '9') iFirst = (sHash[k] - 'A') + 10; else iFirst = (sHash[k] - '0'); if (sHash[k+1] > '9') iSecond = (sHash[k+1] - 'A') + 10; else iSecond = (sHash[k+1] - '0'); EnHash[l++] = Convert.ToByte(((iFirst * 16) + iSecond)); } Thanks for your comments above - it's an interesting idea to use int32.parse - I'll give that a go just to see how that works - ultimately it's not too diferent from what I worked out. Kind regards, John.
-
Help needed converting string hash values into binary...Hi there. I'm writing a hash file converter to convert a set of file hashes from one vendors format to another. As input I have a 32 byte long string containing a hash value stored in a byte[32] array: 6A87A34023132CF8F6D7FDFFB269E3FA I want to convert this into a 16 byte value such that the hex representation is the same, ie: byte[16] = {0x6A,0x87,0xA3 ... }. I hope this makes sense, I'm really struggling with this as my binary skills are not so sharp... Any assistance woud be greatly appreciated. Kind regards, John.
-
Fairly simple Regex question...Jim, That worked a treat - many thanks. I wasn't sure about the syntax - most of the web pages I saw have very complex examples or only code for one specifi thing - not a combination of several. Once again, thanks for your response. John. PS: The smiley in the middle of the expression was interesting!
-
Fairly simple Regex question...Hi there. I'm getting a headache finding a regular expression to determine if the char that I've just read in is a word char (\w) or a valid form of punctuation (not sure how to best describe this in regex terms). Essentailly I'm in a loop reading char by char and wanting to go do "something else" at the end of each word - unless the word is follwed by a semicolon or a comma or so-on. In this case I want to loop agin to include the punctuation char in the word and then go off and do the "something else". I have the "word char" bit so far: Regex reg = new Regex("\\w", RegexOptions.IgnoreCase|RegexOptions.Compiled); But I need to add the "or a punctuation char" bit to this. I tried to using a number constructs to add the but nothing is working out! Any help is greatly appreciated. Kind regards, John. _______ Your system must be restarted for these changes to take effect. This is not a drill.
-
Coding for the Vista GUIDaniel, Thanks for your reply. Additionally I've found some great resources in the Windows Vista and .NET 3.0 SDK. These can be found here: http://msdn.microsoft.com/windowsvista/downloads/default.aspx Cheers, John.
-
Coding for the Vista GUIMy apologies if this has been covered earlier or elsewhere - I did look but couldn't find anything. I'm coding an app in C# using VS 2005 and I'm looking to make the interface as Vista-like as possible. Clearly, things like the control boxes on forms will be handled by the the OS - but what about buttons and the green-glow progress bar (to name a few)? Are there libs I can download from MS to build into my app to get these "Vista effects"? Is there something simple that I'm overlooking? Any help is much appreciated. Kind regards, John.
-
People actually do fall for those Nigerian scams!I'm involved in forensic computer investigations for the police in the UK and yes - people fall for this stuff all the time. Interestingly, direct mail through your letter box usually has a response rate of about 3%. It's been determined that spam has a similar response rate, but with far less of the overhead - so this kind of spamming seems to make sense for the "direct marketers" from a cost point of view. We've investigated cases where detectives have approached a guy about to be ripped off and warned him he's being scammed - only to be told to mind our own business and that he'll invest his money where he wants. All this despite providing him with documentary evidence of others being ripped off by the same suspect. People get so blinded by greed they just don't see sense. I saw in another post in this thread someone referred to seeing a dodgy looking bloke with a camera hanging around a childs park - don't confront these people - they will just slink off and find other victims. Call the police and ask to speak to a child protection officer or a member of a child protecton team. This stuff is taken *very* seriously and when officers arrive they will inspect his camera on the spot. If it's a digital camera and it contains photos of children and he can't provide a valid excuse why he has these photos, he'll be arrested on the spot.
-
How many hours/week do you work?About 65-70 pretty regularly. I would happily work more, but I need sleep & food. Every now and again I find myself getting frustrated by real-world intrusions into my work. Things like having to get up and go to the toilet or answer the phone really annoy me.