|
Hi Bob,
I tried both sets of code, but in my post I was referring to your class, I only referenced the other link/set of code because it has a picture of how I would like my listbox to appear.
It is changing the text color and I would like the background color changed instead, and omit the scroll bar it attaches. I didn't see that function/option.
Here is what I am seeing ... is that what I should be seeing?
http://img404.imageshack.us/img404/8830/lineeditor1.jpg[^]
private void testFunction()
{
try
{
LineEditor lineEditor = new LineEditor();
lbxOutput.Controls.Add(lineEditor);
lineEditor.ShowSelection = false;
lineEditor.BottomAligned = false;
lineEditor.Selectable = false;
lineEditor.Lines.Add(new Line(Color.Red, "Liverpool"));
lineEditor.Lines.Add(new Line(Color.Red, "Another test2"));
lineEditor.Lines.Add(new Line(Color.Green, "Another test3"));
lineEditor.Lines.Add(new Line(Color.Black, "Another test4"));
lineEditor.Lines.Add(new Line(Color.Orange, "Another test5"));
lineEditor.Lines.Add(new EditableLine(Color.Green, "Editable text"));
lineEditor.Lines.Insert(new Line(Color.Black, "At the front"), 0);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message + " " + ex.StackTrace + " " + ex.Source);
}
}
|
|
|
|
|
Thank you for the help Bob.
Here is what I ended up doing
And here is how it looks, I'm going to try and make the colors softer so the black text is easier to read, but I'm happy with it besides that.
http://img690.imageshack.us/img690/8922/lineeditor2.png[^]
public class MyListBoxItem
{
public MyListBoxItem(Color t, string m, Color c)
{
BackgroundColor = c;
Message = m;
TextColor = t;
}
public Color BackgroundColor { get; set; }
public string Message { get; set; }
public Color TextColor { get; set; }
}
private void testFunction()
{
try
{
lbxOutput.DrawMode = DrawMode.OwnerDrawFixed;
lbxOutput.DrawItem += new DrawItemEventHandler(listBox_DrawItem);
lbxOutput.Items.Add(new MyListBoxItem(Color.Black, "Validated data successfully", Color.Green));
lbxOutput.Items.Add(new MyListBoxItem(Color.Black, "Failed to validate data", Color.Red));
lbxOutput.Items.Add(new MyListBoxItem(Color.Black, "Validated data successfully", Color.Green));
lbxOutput.Items.Add(new MyListBoxItem(Color.Black, "Failed to validate data", Color.Red));
lbxOutput.Items.Add(new MyListBoxItem(Color.Black, "Validated data successfully", Color.Green));
lbxOutput.Items.Add(new MyListBoxItem(Color.Black, "Failed to validate data", Color.Red));
lbxOutput.Items.Add(new MyListBoxItem(Color.Black, "Validated data successfully", Color.Green));
lbxOutput.Items.Add(new MyListBoxItem(Color.Black, "Failed to validate data", Color.Red));
lbxOutput.Items.Add(new MyListBoxItem(Color.Black, "Validated data successfully", Color.Green));
lbxOutput.Items.Add(new MyListBoxItem(Color.Black, "Failed to validate data", Color.Red));
lbxOutput.Items.Add(new MyListBoxItem(Color.Black, "Validated data successfully", Color.Green));
lbxOutput.Items.Add(new MyListBoxItem(Color.Black, "Failed to validate data", Color.Red));
lbxOutput.Items.Add(new MyListBoxItem(Color.Black, "Validated data successfully", Color.Green));
lbxOutput.Items.Add(new MyListBoxItem(Color.Black, "Failed to validate data", Color.Red));
}
catch (Exception ex)
{
MessageBox.Show(ex.Message + " " + ex.StackTrace + " " + ex.Source);
}
}
private void listBox_DrawItem(object sender, DrawItemEventArgs e)
{
MyListBoxItem item = lbxOutput.Items[e.Index] as MyListBoxItem;
Graphics g = e.Graphics;
if (item != null)
{
g.FillRectangle(new SolidBrush(item.BackgroundColor), e.Bounds);
e.Graphics.DrawString(
item.Message,
lbxOutput.Font,
new SolidBrush(item.TextColor),
0,
e.Index * lbxOutput.ItemHeight
);
}
else
{
}
}
|
|
|
|
|
Glad you got it sorted out!
|
|
|
|
|
Thanks
I've broken the scrolling now somehow, so I have to figure out what is causing that
|
|
|
|
|
Hi Bob,
Hopefully you are still following this.
My scrolling is broken, when I scroll to the bottom of the results, it will erase all text from the listbox . When I scroll back up to the very top, the text will come back, but if I move the scroll bar the slightest bit, the form listbox goes all white.
I'm sure this has to do with me taking manual control of the event, do you have any idea that I can try to fix this with?
Thanks for reading.
|
|
|
|
|
I am trying to use the SpeechSynthesizer as QMS for calling token number same like what is there in hospitals and other counters but the calling is going too fast for something like:
Ticket number 2 Please proceed to Counter 7
|
|
|
|
|
See the SpeechSynthesizer.Rate property.
/ravi
|
|
|
|
|
I have MDI parent.
I want to have a fixed side bar panel in the right left side (docked to right) and then everytime an MDI child is shown it will docked to fill which means it will take the entire mdi parent area - (minus) - the side bar area.
how can I do this?
|
|
|
|
|
|
If MDI children are always maximised then it's not really MDI. Try a Visual Studio type tabbed layout instead.
|
|
|
|
|
I have downloaded a source code from CP Articles. The address is here:
Farsi Library - DatePickers[^]
It has written in .Net2 but my project is in .Net4; So when I download it first visual studio converts that, but it didn't build successfully until I delete this line of code in CommonAssemblyInfo.cs:
[assembly: AssemblyKeyFile(@"C:\KeyFile.snk")]
After that all of the projects in this solution builded.
My problem starts as I create a class in my own project which inherits form one of the class in the new dll added to my project.
public class DatePicker: FarsiLibrary.Win.Controls.FADatePicker
{}
I have three project in my solution:
1. VMS.Application
2. VMS.Data
3. VMS.Library
Now when I want to build my own solution there are 35 error, that they have the same message:
The type or namespace name 'Library' does not exist in the namespace 'VMS' (are you missing an assembly reference?)
when I comment the inheritance the errors will go:
public class DatePicker
{}
Please tell me if you have any idea!
Meysam
|
|
|
|
|
Meysam Tolouee wrote: [assembly: AssemblyKeyFile(@"C:\KeyFile.snk")]
That's the license key to mark it as a trusted assembly. I've never bothered with them, but if my understanding is correct, you can't compile with someone else's key, so that's expected.
Meysam Tolouee wrote: Now when I want to build my own solution there are 35 error, that they have the
same message:
The type or namespace name 'Library' does not exist in the namespace 'VMS' (are you missing an assembly reference?)
when I comment the inheritance the errors will go:
See where it asks you whether you're missing an assembly reference? Did you add the compiled DLL to your project references? Right-click on the "References" item in your Solution Explorer, click "Add Reference", and locate that library. If it's in the same solution, grab it from the Project tab... Otherwise find it in the Browse tab.
|
|
|
|
|
Are you kidding me? The assembly that error is talking about is one my namespaces(VMS.Library).
Of course I have added the dll(s) to my project.
Meysam
|
|
|
|
|
Wait a second... This control you're creating that inherits from the DatePicker... Is that inside VMS.Library?
If so, those errors might just be the symptoms, not the actual problem. There's probably one error that's different.
1) Project A references project B
2) Project B has an error
3) Project A can no longer access anything in Project B, because Project B didn't compile, so anything that references Project B is reported as an error.
Find that other error, and you'll be closer to the real issue.
|
|
|
|
|
No. The FarsiLibrary.Win.Controls.FADatePicker class is in the dll that I added from source code of article.
Meysam
|
|
|
|
|
Not the FADatePicker... The class you created to inherit from it. The one that you comment out to make it compile.
Check the entire error list... Find the one that's different... The one that occurs in VMS.Library. If I'm right, that's the one you need to look at, and once you fix that and get VMS.Library to compile, all of those "does not exist" errors will vanish.
|
|
|
|
|
Here is my code:
namespace VMS.Library.Controls
{
public class DatePicker: FarsiLibrary.Win.Controls.FADatePicker
{
}
}
Note: I've done this in .Net3.5 without any problem.
Meysam
|
|
|
|
|
Yes, you posted that... Now look through all of those errors when you try to compile, and find the error that occurs inside VMS.Library. That'll point you toward the real problem.
Just like the old kids shows... "One of these things is not like the other"
|
|
|
|
|
I chenged the Target Framework to .Net3.5 because as I said before it has no incompatibility with .Net3.5 but there is a new error:
Could not load file or assembly 'System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified
It is so clear why it doesn't compile in this new situation but I did my best.
Meysam
|
|
|
|
|
If you're getting that error when compiling for .NET 4.0 too, it would explain things. A .NET 2.0 control is going to be based on WinForms, whereas a .NET 4.0 project is probably using WPF and won't load the WinForms libraries (System.Drawing among them) unless you specifically add them.
|
|
|
|
|
Hello everyone
I need to generate a PDF417 bar code and do the reverse operation.
but the problem is that the text I need to encode is in Arabic like "أ ب ت ث ... "
I found a lot of SDK and online programs that help generating and reading pdf417 bar codes, but non of them support the Arabic language.
could anyone help me with that? and do I need to build a program for the whole pdf417 encoding which needs time?
|
|
|
|
|
Well, I haven't done any PDF417 processing in about twenty years, but if you've already found libraries to convert the Latin (English) alphabet, then why not just convert? Just build a quick mapping table to translate each Arabic character to a Latin character... There are more than 26, but they don't seem to use upper or lower-case, so you've got 52 items to map to.
|
|
|
|
|
thank you Ian for your reply
It's a good idea when the bar code is decoded by only my decoder,
but I want it to be also decoded by any decoder that supports Arabic if exists
|
|
|
|
|
Well, after some quick googling, it seems PDF417 was never updated to support Unicode (Even the much newer QR codes don't do it), so it only does single-byte characters. As there doesn't seem to be a widespread standard for encoding them, you might be out of luck there.
Looks like most people are using Base64 encoding to get Unicode data in there, though, so if anything later becomes standard, that'll probably be it.
|
|
|
|
|
I'm trying to update a portion of a byte array with modified data and for some reason it's always unchanged. Any input would be appreciated.
Right now, I have a temporary array that I'm trying to do an array copy for part of the array to update the data. This isn't working. Before that, I didn't have a temporary array and was doing basically the same thing with the destination array. The data locations I'm writing to are 0 after the update, but I am seeing the correct data in my tempStrings and convertStringToBytes method.
private void updateDatWithData()
{
int returnCode = 0;
byte[] tempByteArr = new byte[Dat.Length];
String tempString = (configNum[0].ToString() + configNum[1].ToString());
byte tempByte = 0;
returnCode = convertStringToByte(tempString, ref tempByteArr[index + 4]);
...
Array.Copy(tempByteArr, (index+ 4), Dat, (index + 4), 5);
}
private int convertStringToByte(String theString, ref byte theByte)
{
int returnCode = 1;
try
{
theByte = System.Convert.ToByte(theString);
}
return returnCode;
}
|
|
|
|
|