Add search box to help
This commit is contained in:
		
							
								
								
									
										69
									
								
								EduNetworkBuilder/RTFWindow.Designer.cs
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										69
									
								
								EduNetworkBuilder/RTFWindow.Designer.cs
									
									
									
										generated
									
									
									
								
							| @@ -31,6 +31,10 @@ | ||||
|             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RTFWindow)); | ||||
|             this.rtbContent = new System.Windows.Forms.RichTextBox(); | ||||
|             this.btnOK = new System.Windows.Forms.Button(); | ||||
|             this.lblFind = new System.Windows.Forms.Label(); | ||||
|             this.tbFind = new System.Windows.Forms.TextBox(); | ||||
|             this.btnBack = new System.Windows.Forms.Button(); | ||||
|             this.btnFwd = new System.Windows.Forms.Button(); | ||||
|             this.SuspendLayout(); | ||||
|             //  | ||||
|             // rtbContent | ||||
| @@ -38,36 +42,85 @@ | ||||
|             this.rtbContent.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)  | ||||
|             | System.Windows.Forms.AnchorStyles.Left)  | ||||
|             | System.Windows.Forms.AnchorStyles.Right))); | ||||
|             this.rtbContent.Location = new System.Drawing.Point(34, 13); | ||||
|             this.rtbContent.Location = new System.Drawing.Point(26, 11); | ||||
|             this.rtbContent.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); | ||||
|             this.rtbContent.Name = "rtbContent"; | ||||
|             this.rtbContent.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical; | ||||
|             this.rtbContent.Size = new System.Drawing.Size(358, 249); | ||||
|             this.rtbContent.Size = new System.Drawing.Size(270, 203); | ||||
|             this.rtbContent.TabIndex = 0; | ||||
|             this.rtbContent.Text = ""; | ||||
|             //  | ||||
|             // btnOK | ||||
|             //  | ||||
|             this.btnOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); | ||||
|             this.btnOK.Location = new System.Drawing.Point(317, 271); | ||||
|             this.btnOK.Location = new System.Drawing.Point(247, 215); | ||||
|             this.btnOK.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); | ||||
|             this.btnOK.Name = "btnOK"; | ||||
|             this.btnOK.Size = new System.Drawing.Size(75, 23); | ||||
|             this.btnOK.Size = new System.Drawing.Size(49, 27); | ||||
|             this.btnOK.TabIndex = 1; | ||||
|             this.btnOK.Text = "OK"; | ||||
|             this.btnOK.UseVisualStyleBackColor = true; | ||||
|             this.btnOK.Click += new System.EventHandler(this.btnOK_Click); | ||||
|             //  | ||||
|             // lblFind | ||||
|             //  | ||||
|             this.lblFind.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); | ||||
|             this.lblFind.AutoSize = true; | ||||
|             this.lblFind.Location = new System.Drawing.Point(23, 220); | ||||
|             this.lblFind.Name = "lblFind"; | ||||
|             this.lblFind.Size = new System.Drawing.Size(31, 15); | ||||
|             this.lblFind.TabIndex = 2; | ||||
|             this.lblFind.Text = "Find"; | ||||
|             //  | ||||
|             // tbFind | ||||
|             //  | ||||
|             this.tbFind.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)  | ||||
|             | System.Windows.Forms.AnchorStyles.Right))); | ||||
|             this.tbFind.Location = new System.Drawing.Point(60, 219); | ||||
|             this.tbFind.Name = "tbFind"; | ||||
|             this.tbFind.Size = new System.Drawing.Size(134, 20); | ||||
|             this.tbFind.TabIndex = 3; | ||||
|             //  | ||||
|             // btnBack | ||||
|             //  | ||||
|             this.btnBack.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); | ||||
|             this.btnBack.Location = new System.Drawing.Point(200, 217); | ||||
|             this.btnBack.Name = "btnBack"; | ||||
|             this.btnBack.Size = new System.Drawing.Size(17, 23); | ||||
|             this.btnBack.TabIndex = 4; | ||||
|             this.btnBack.Text = "<"; | ||||
|             this.btnBack.UseVisualStyleBackColor = true; | ||||
|             this.btnBack.Click += new System.EventHandler(this.btnBack_Click); | ||||
|             //  | ||||
|             // btnFwd | ||||
|             //  | ||||
|             this.btnFwd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); | ||||
|             this.btnFwd.Location = new System.Drawing.Point(220, 217); | ||||
|             this.btnFwd.Name = "btnFwd"; | ||||
|             this.btnFwd.Size = new System.Drawing.Size(17, 23); | ||||
|             this.btnFwd.TabIndex = 5; | ||||
|             this.btnFwd.Text = ">"; | ||||
|             this.btnFwd.UseVisualStyleBackColor = true; | ||||
|             this.btnFwd.Click += new System.EventHandler(this.btnFwd_Click); | ||||
|             //  | ||||
|             // RTFWindow | ||||
|             //  | ||||
|             this.AcceptButton = this.btnOK; | ||||
|             this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); | ||||
|             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); | ||||
|             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; | ||||
|             this.ClientSize = new System.Drawing.Size(427, 306); | ||||
|             this.ClientSize = new System.Drawing.Size(320, 249); | ||||
|             this.Controls.Add(this.btnFwd); | ||||
|             this.Controls.Add(this.btnBack); | ||||
|             this.Controls.Add(this.tbFind); | ||||
|             this.Controls.Add(this.lblFind); | ||||
|             this.Controls.Add(this.btnOK); | ||||
|             this.Controls.Add(this.rtbContent); | ||||
|             this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); | ||||
|             this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); | ||||
|             this.Name = "RTFWindow"; | ||||
|             this.Text = "RTFWindow"; | ||||
|             this.ResumeLayout(false); | ||||
|             this.PerformLayout(); | ||||
|  | ||||
|         } | ||||
|  | ||||
| @@ -75,5 +128,9 @@ | ||||
|  | ||||
|         private System.Windows.Forms.RichTextBox rtbContent; | ||||
|         private System.Windows.Forms.Button btnOK; | ||||
|         private System.Windows.Forms.Label lblFind; | ||||
|         private System.Windows.Forms.TextBox tbFind; | ||||
|         private System.Windows.Forms.Button btnBack; | ||||
|         private System.Windows.Forms.Button btnFwd; | ||||
|     } | ||||
| } | ||||
| @@ -112,9 +112,10 @@ namespace EduNetworkBuilder | ||||
|         } | ||||
|         private void LanguagifyComponents() | ||||
|         { | ||||
|             Text = NB.Translate("RTFW_rtbContent"); | ||||
|             Text = NB.Translate("RTFW_btnOK"); | ||||
|             rtbContent.Text = NB.Translate("RTFW_rtbContent"); | ||||
|             btnOK.Text = NB.Translate("RTFW_btnOK"); | ||||
|             Text = NB.Translate("RTFW_Form"); | ||||
|             lblFind.Text = NB.Translate("RTFW_lblFind"); | ||||
|         } | ||||
|  | ||||
|         private void btnOK_Click(object sender, EventArgs e) | ||||
| @@ -122,5 +123,46 @@ namespace EduNetworkBuilder | ||||
|             Close(); | ||||
|         } | ||||
|  | ||||
|         private void Search(bool GoForward) | ||||
|         { | ||||
|             int loc = rtbContent.SelectionStart; | ||||
|             int indexToText; | ||||
|             string WhatToFind =  tbFind.Text; | ||||
|             if (tbFind.Text == "") return; //We do nothing if nothing to find. | ||||
|             if (GoForward) | ||||
|             { | ||||
|                 loc++; //move forward just a smidge | ||||
|                 if (loc >= rtbContent.MaxLength) loc = rtbContent.MaxLength; | ||||
|                 indexToText = rtbContent.Find(WhatToFind,loc,RichTextBoxFinds.None); | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 loc--;//Move back a smidge | ||||
|                 if (loc < 0) loc = 0; | ||||
|                 indexToText = rtbContent.Find(WhatToFind, loc, RichTextBoxFinds.Reverse); | ||||
|             } | ||||
|             if (indexToText > 0) | ||||
|             { | ||||
|                 rtbContent.SelectionStart = indexToText; | ||||
|                 rtbContent.SelectionBackColor = Color.LightBlue; | ||||
|                 rtbContent.ScrollToCaret(); | ||||
|             } | ||||
|             if(indexToText == -1) | ||||
|             { | ||||
|                 //We did not go anywhere | ||||
|                 MessageBox.Show("Not found."); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         private void btnFwd_Click(object sender, EventArgs e) | ||||
|         { | ||||
|             Search(true); | ||||
|         } | ||||
|  | ||||
|         private void btnBack_Click(object sender, EventArgs e) | ||||
|         { | ||||
|             Search(false); | ||||
|         } | ||||
|  | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -709,4 +709,8 @@ | ||||
|     <value>Saved</value> | ||||
|     <comment>String used when we have successfully saved the network.</comment> | ||||
|   </data> | ||||
|   <data name="RTFW_lblFind" xml:space="preserve"> | ||||
|     <value>Find</value> | ||||
|     <comment>RTFWindow RTFW_lblFind = Find</comment> | ||||
|   </data> | ||||
| </root> | ||||
		Reference in New Issue
	
	Block a user