Click here to Skip to main content
15,888,351 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: How to display an image in a center of a form Pin
desanti7-Mar-18 11:07
desanti7-Mar-18 11:07 
AnswerRe: How to display an image in a center of a form Pin
Eddy Vluggen8-Mar-18 1:45
professionalEddy Vluggen8-Mar-18 1:45 
AnswerRe: How to display an image in a center of a form Pin
Eddy Vluggen9-Mar-18 5:41
professionalEddy Vluggen9-Mar-18 5:41 
QuestionForm topmost only within application Pin
desanti7-Mar-18 9:47
desanti7-Mar-18 9:47 
AnswerRe: Form topmost only within application Pin
Gerry Schmitz7-Mar-18 10:53
mveGerry Schmitz7-Mar-18 10:53 
GeneralRe: Form topmost only within application Pin
desanti7-Mar-18 11:07
desanti7-Mar-18 11:07 
AnswerRe: Form topmost only within application Pin
Eddy Vluggen8-Mar-18 1:46
professionalEddy Vluggen8-Mar-18 1:46 
QuestionAdd text to richtextbox at design time: Resolved Pin
mo14926-Mar-18 2:20
mo14926-Mar-18 2:20 
Hello,
Blush | :O
Again, after I post the question I finally find the solution...Sorry.
The solution was to implement ParentControlDesigner to reflect the CustomRichTextBox
properties and then added this code to its custom DisplayMode() property.
If Me.DesignMode = True Then
Me.DisplayHexPage(Me._TestBuffer, 8, 0)
End If
Which only displays the test line during DesignMode. Now it works as desired.


Goal:
I have created a control inheriting a RichTextBox in which I preformat text going to the editbox.
At design time I would like to send 1 preformatted line to the editbox so that I can set the
font to display the whole line within the width of the box.
Can someone advise how to accomplish this. Thank You

Perhaps this is a starting point but maybe there is a better way.
I found the below snippet which I have modified and works with the following exceptions:
1. I must manually enter text in the RichText() property to initially display the test line.
2. When the design is saved, it also saves the formatted test text in the RichTextBox.Text property
and the text is displayed at runtime. I know that the Text property is loaded when I format the
text through DisplayHexPage().
3. The RichText() property is also added to the design info which I do not want.


Imports System.ComponentModel
Imports System.Drawing.Design
Imports System.IO
Imports System.Diagnostics

Public Class MyRtb
Inherits RichTextBox

Dim _TestBuffer() As Byte = {&H31, &H32, &H33, &H34, &H35, &H36, &H37, &H38}

<Editor(GetType(RtfEditor), GetType(UITypeEditor))> _
Public Property RichText() As String
Get
Return ""
End Get
Set(ByVal value As String)
' This is my formatting function that simply Appends("text") to the RichTextBox
Me.DisplayHexPage(Me._TestBuffer, 8, 0)
End Set
End Property

End Class

Friend Class RtfEditor
Inherits UITypeEditor

Public Overrides Function GetEditStyle(ByVal context As ITypeDescriptorContext) As UITypeEditorEditStyle
Return UITypeEditorEditStyle.Modal
End Function

Public Overrides Function EditValue(ByVal context As ITypeDescriptorContext, ByVal provider As IServiceProvider, ByVal value As Object) As Object

' Value does not matter since I am formatting text with my function
Return ""
End Function
End Class

-- modified 6-Mar-18 11:04am.
QuestionHow to check if user doesn't select anything in combobox. Pin
hmanhha27-Feb-18 4:35
hmanhha27-Feb-18 4:35 
AnswerRe: How to check if user doesn't select anything in combobox. Pin
phil.o27-Feb-18 5:56
professionalphil.o27-Feb-18 5:56 
GeneralRe: How to check if user doesn't select anything in combobox. Pin
hmanhha27-Feb-18 15:04
hmanhha27-Feb-18 15:04 
AnswerRe: How to check if user doesn't select anything in combobox. Pin
Ralf Meier28-Feb-18 0:44
mveRalf Meier28-Feb-18 0:44 
GeneralRe: How to check if user doesn't select anything in combobox. Pin
hmanhha28-Feb-18 22:28
hmanhha28-Feb-18 22:28 
GeneralRe: How to check if user doesn't select anything in combobox. Pin
Ralf Meier1-Mar-18 0:22
mveRalf Meier1-Mar-18 0:22 
GeneralRe: How to check if user doesn't select anything in combobox. Pin
hmanhha1-Mar-18 14:27
hmanhha1-Mar-18 14:27 
GeneralRe: How to check if user doesn't select anything in combobox. Pin
Dave Kreskowiak1-Mar-18 16:14
mveDave Kreskowiak1-Mar-18 16:14 
GeneralRe: How to check if user doesn't select anything in combobox. Pin
Ralf Meier1-Mar-18 21:50
mveRalf Meier1-Mar-18 21:50 
AnswerRe: How to check if user doesn't select anything in combobox. Pin
Richard Andrew x642-Mar-18 1:47
professionalRichard Andrew x642-Mar-18 1:47 
AnswerRe: How to check if user doesn't select anything in combobox. Pin
Alan Burkhart2-Mar-18 6:26
Alan Burkhart2-Mar-18 6:26 
QuestionInvocar StatusStrip desde otro form Pin
Edgardo Martinez26-Feb-18 13:35
Edgardo Martinez26-Feb-18 13:35 
AnswerRe: Invocar StatusStrip desde otro form Pin
Eddy Vluggen27-Feb-18 3:10
professionalEddy Vluggen27-Feb-18 3:10 
QuestionGet Databack from combobox. Pin
hmanhha26-Feb-18 7:30
hmanhha26-Feb-18 7:30 
AnswerRe: Get Databack from combobox. Pin
Richard Deeming26-Feb-18 7:42
mveRichard Deeming26-Feb-18 7:42 
AnswerRe: Get Databack from combobox. Pin
Member 834559927-Feb-18 3:56
Member 834559927-Feb-18 3:56 
GeneralRe: Get Databack from combobox. Pin
Dave Kreskowiak27-Feb-18 5:35
mveDave Kreskowiak27-Feb-18 5:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.