|
The disabled appearance of RTB (and most other controls) is built in, and cannot be changed without a deep understanding of WINAPI, and I'm not sure that it can be changed even then.
[Edit]
As an alternative, as you are hiding the built in Enabled Property, why not use your override to set ReadOnly to true. You will then be able to use your own colouration scheme. I know that ReadOnly is not quite the same as Disabled, but would suffice for most purposes.
[/Edit]
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
How creative of you
Regards,
Jason Pezzimenti.
|
|
|
|
|
Add a class to your project
In your designer InitializeComponent() section:
this.txtq = new test.txt();
where txtq is the richtexbox and test.txt is the class.
Place following code in class:
class txt : System.Windows.Forms.RichTextBox
{
public override System.Drawing.Color BackColor
{
get
{
return System.Drawing.Color.White;
}
set
{
base.BackColor = System.Drawing.Color.White;
}
}
}
|
|
|
|
|
I need to display data in Hexa.
I will be geting data in asci which will be getting stored in string and i need to convert theis string to hexa and display it in textbox.
Ex Receiving "50 3F 52 40" as string
Need to covert in to hex as -> "P ? R @"
|
|
|
|
|
Your example seems to do the opposite of what you want.
Simplest solution might be to use String.Format.
What have you tried? If you post code then you're more likely to get a helpful response.
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
|
|
|
|
|
This is the code snip i am working on...kindly look and let me know the answer
MessageBox.Show(this.listBox1.Text.ToString());
this.txtToSend.Text = string.Format("{0:X}", "3F 50");
i must get an output as "? P" in Hex
|
|
|
|
|
You seem to be confused about what Hex means.
This is Hex (well a string of Hex characters):
pallaka wrote: 3F 50
And this is (printable) ASCII or whatever the encoding is.
pallaka wrote: ? P
If you have a string of Hex characters separated by spaces (which is what your example shows) I suggest using Split on txtToSend.Text to get an array and then loop through the array to output the chars. You will need convert the array entries to numeric and then the numeric to char.
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
|
|
|
|
|
|
It is doing opposite to me...
i mean if i send "?"
it is giving output as "3F" I agree i really confused...3F is my Hex value and i need to convert to asci
I need fully opposite way.....
I need to send "3F" and i should get result as "?"
|
|
|
|
|
Ah i think this will work then. When i try it prints out the correct ascii number
label1.Text = Convert.ToInt32("3F", 16).ToString();
may not be the most efficient way.
|
|
|
|
|
It Prints the value 63.
But i need "?"
how can i convert 63 to symbol representation.
You can have a look in www.asciitable.com
|
|
|
|
|
I have just learnt something new to. This may work simple cast will convert the int (ascii) to a char / symbol.
int i = 63;
char c = (char)i;
label1.Text = c.ToString();
|
|
|
|
|
Hi,
The solution will take some 10 lines of code including an explicit loop.
here are a few things you will need:
1. split the input string (which is a hex string) into parts, each holding 2 hex digits; you could use string.Split() or string.Substring()
2. convert a 2-digit hex string to its numeric value; you need int.Parse() or int.TryParse() with some options
3. convert that number to an ASCII character; you might try that with a (char) cast, the safer way would use an Encoding method.
4. concatenate all the results; either use a string operator or StringBuilder class.
If all this is too much for you, this is what you should have done: http://lmgtfy.com/?q=convert+hex+string+to+ASCII[^]
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
I have created a windows form to represent a real life joystick, i have represented the x and y axis with click and drag. With a track bar to represent z axis. ( Activated with mouse wheel)
Currently the trackbar is enabled when the middle button is clicked and dissabled when clicked again. I am just looking for a way to dissable the left click on the trackbar control as left click on the form should represent the x and y axis with middle click then scroll representing z.
Thanx George
|
|
|
|
|
Add an event for MouseDown or MouseUp...
You can check against the .Button property of the MouseEventArgs if it's the middle that was pressed.
Also:
You could use a MouseMove, and compare against the buttons there. So you could drag it around.
Ninja (the Nerd)
Confused? You will be...
|
|
|
|
|
Problem with ReadExisting in serial communication...i am sending data in hexa decimal but i am reciving it in asci.....
How to get the proper data....how to convert data from asci to Hex.
as i need to display the data in the Text box in the Hex format.
|
|
|
|
|
Encoding.ASCII.GetString(byte[] bytes)
or
Encoding.ASCII.GetBytes(string input)
|
|
|
|
|
I need to convert text to asci and asci to hex
|
|
|
|
|
Try string.format("{0:X2}", asciByte); which converts asciByte to a two digit Hex string.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
No It didnt work.......
Lets take an example
string data "3F 50"
after conversion i should get "? P"
but i am not getting any thing
|
|
|
|
|
Look at
Parse(str, System.Globalization.NumberStyles.HexNumber)
You will have to use it a few times and skip the spaces, but it will convert hex "3F" to byte '?'
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Hi all
I made a custom control. I use it programatically in another project. the problem is I get change the label content(the text that appear)
any idea?
question 2:
I have a grid. I want only part of the grid to be scrolable.so that the first row and culomn are fixed. just like the header of a browser-is fixed and the rest of the page can be scrol. is it posible in the same grid?
I prefer to use 1 grid so the culomn size are the same
question3:
can any one direct me to a window 3 layer sample project, that is working by "best practise" ?
thanks
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:MyCustomControl}" >
<Border Background="{TemplateBinding Background}" >
<Border.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<TranslateTransform/>
</transformgroup>
<Border.RenderTransform>
<Label Name="lbl" >cool</label>
</border>
</controltemplate>
</setter.Value>
</setter>
|
|
|
|
|
I guess your question is not posted correctly. Please check this Chekbox "Do not interpret HTML tags (good for code snippets)" Before post the code.
And this is C# Forum. Please Post it on WPF Forum.
|
|
|
|
|
I'm creating a static ContextMenu at runtime in program.cs, which works fine except that it has a slightly different visual style to ContextMenus created at design-time (doesn't highlight properly, menu items won't check, etc.) despite having all properties manually set to the default design-time specs.
Suggestions?
|
|
|
|
|
it works fine for me. probably you are using the old context menu from vs2003 ?
or you can copy and paste your code here..
|
|
|
|