Results 1 to 6 of 6
-
5th Dec 2009, 11:03 PM #1OPლ(ಠ益ಠლ)Website's:
extremecoderz.comPost creator main buttons c# Source
Ok.
I see a lot of people writing post-creator applications, which is a great way to start writing programs.
Here is a little guidance for those just starting out to help you along the way.
Thebold, italic, underline, code, img, quote, etc... buttons are very simple:
Code:private void boldButton_Click(object sender, EventArgs e) { if (myRichTextBox.SelectionLength > 0) "[b ]" + myRichTextBox.SelectedText + "[/b ]"; else myRichTextBox.SelectedText = "[b ][/b ]"; }
The same process can be repeated for every button, or if you feel daring, use the "object sender" as a reference and you can use one void for all of the buttons.
One thing that you dont see very often is a "preview post" button, but its a very nice feature and is relatively simple:
Code:private void PreviewSelectedPostButton_Click(object sender, EventArgs e) { string thePost = postContents.Text; if (thePost.Length == 0) { MessageBox.Show( "The post cannot be empty.", "Empty Post", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // Line-Breaks thePost = thePost.Replace("\n", "<br / >"); // BOLD thePost = thePost.Replace("[b ]", "<b>"); thePost = thePost.Replace("[/b ]", "</b>"); // ITALIC thePost = thePost.Replace("[i ]", "<i >"); thePost = thePost.Replace("[/i ]", "</i >"); // UNDERLINE thePost = thePost.Replace("[u ]", "<u >"); thePost = thePost.Replace("[/u ]", "</u >"); // CODE box thePost = thePost.Replace( "[code ]", "<br /><div style=\"color: #880000; font-size: 11px; line-height: 110%; font-family: verdana,arial,verdana,tahoma,sans-serif; font-size-adjust: none; font-variant: normal; font-weight: normal; background: #dedede none repeat scroll 0 0; margin-left: 10px; padding: 5px;\"> "); thePost = thePost.Replace("[/code ]", "</div><br />"); // QUOTE box thePost = thePost.Replace( "[quote ]", "<br /><div style=\"color: #333333; font-size: 11px; line-height: 110%; font-family: verdana,arial,verdana,tahoma,sans-serif; font-size-adjust: none; font-variant: normal; font-weight: normal; background: #eeeeee none repeat scroll 0 0; margin-left: 10px; padding: 5px;\"> "); thePost = thePost.Replace("[/quote ]", "</div><br />"); // Images thePost = thePost.Replace("[img ]", "<img src=\""); thePost = thePost.Replace("[/img ]", "\" /> <br />"); // Colours thePost = Regex.Replace(thePost, "\\[ color=(.*?)](.*?)\\[/color ]", "<font color=\"$1\">$2</font>"); string htmlPath = System.Environment.CurrentDirectory + "\\preview.html"; using (StreamWriter writer = new StreamWriter(htmlPath)) { writer.WriteLine("<html><head><title>Multi-Poster Ultimate - Preview</title></head><body>"); writer.WriteLine("<table width=\"600px\" border=\"0\"><tr><td>"); writer.Write(thePost); writer.WriteLine("</td></tr></table></body></html>"); } System.Diagnostics.Process.Start(htmlPath); }
Its all wrapped in a 600px div to make it look more like it would when a post is sent to a forum.
Its then saved as a "html" file and then executed, and thus viewed in your default browser.
You will need to add the "System.IO" namespace for the StreamWriters and also "System.Text.RegularExpressions" for the regex command.
And thats about it, nice and simple, and very useful to the user!
(Spaces have been added to the [TAGs] as not to get parsed)
jayfella Reviewed by jayfella on . Post creator main buttons c# Source Ok. I see a lot of people writing post-creator applications, which is a great way to start writing programs. Here is a little guidance for those just starting out to help you along the way. Thebold, italic, underline, code, img, quote, etc... buttons are very simple: Rating: 5
-
6th Dec 2009, 12:05 AM #2Member
Cool nice one m8. Thanks (:
-
6th Dec 2009, 04:59 PM #3OPლ(ಠ益ಠლ)Website's:
extremecoderz.comSimple addition for the "single void for all buttons"
Code:// Convert "object sender" to a button control, so we can manipulate/get data Button SenderButton = (Button)sender; // Then for example: if (SenderButton.Name == "BoldButton") DoStuff(); if (SenderButton.Name == "ItalicButton") DoDifferentStuff()
-
6th Dec 2009, 05:09 PM #4Banned
ru giving post creator tutorial??
-
6th Dec 2009, 05:26 PM #5OPლ(ಠ益ಠლ)Website's:
extremecoderz.comno not really a tutorial, just some quick help for those trying to make a post creator. A lot of users being by creating one because its the best thing to start your programming life and at the same time give something to the community, so i just basically gave some quick tips to get them started
-
8th Dec 2009, 11:58 AM #6MemberWebsite's:
premium-links.net wanted-programs.com
thats a basic VB6 code to create thread's @ vbulletin forums !!
i made this like 1 year back
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
Wordpress Main Post Problem Help!
By sahil00150 in forum Technical Help Desk SupportReplies: 12Last Post: 10th Oct 2011, 01:16 AM -
Correction!!Rapid Post Creator!!Free!!Create Your Post Very Fast!!!735 Kb
By senorweb in forum Webmaster ResourcesReplies: 11Last Post: 21st May 2011, 01:08 PM -
Rapid Post Creator!!Free!!Create Your Post Very Fast!!!735 Kb
By senorweb in forum Webmaster ResourcesReplies: 1Last Post: 16th May 2011, 04:53 PM -
Advance Post Generator 1.1 (IMDB Grabber | Posting Buttons | Save Post)
By WaReZ in forum Webmaster ResourcesReplies: 27Last Post: 30th Apr 2011, 06:05 PM -
Post Creator!
By Gebriel in forum Webmaster ResourcesReplies: 26Last Post: 22nd Nov 2009, 11:59 PM
themaLeecher - leech and manage...
Version 5.03 released. Open older version (or...