|
:p
thanks for discussing my problemo!!!
I agree with all re points!!!
I am sticking with the situation where i have 2 queues for presentation and communication layer, I will need another event receiver class, that makes it separate for the two projects, thus simplifying everything, with a little more code...
Thanks again!!!
P.s. By the way i am an electronics engineer not a software one, so my jargon on technical terms is a bit low...
Just programming for my Ground control station for a helium powered autonomous airship.
bye
|
|
|
|
|
Glad to help. Good Luck!
|
|
|
|
|
Hi All,
I have a problem with a serialport component ...
In a form, for read from a serial port I write:
Load
{
serialPort1.Close();
serialPort1.NewLine = "\r\n";
serialPort1.PortName = "COM18"; // GPS COM
serialPort1.Open();
}
in the dataReceived event, the app stopped with this error: cross-thread not true...
private void serialPort1_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
{
textBox1.Text = serialPort1.ReadLine(); //error line
}
Why error on thread-safe? Help me please (with example).
Many thanks.
Alex
|
|
|
|
|
Message Closed
modified 23-Nov-14 7:13am.
|
|
|
|
|
Perfect!
Thanks.
Alex
|
|
|
|
|
|
thanks Luc ... rich documentations ...
Alex
|
|
|
|
|
you're welcome.
|
|
|
|
|
hi everyone,
how can we do that window minimizing and maximizing at fixed position in java Script like this site?
http://examples.adobe.com/flex3/devnet/dashboard/main.html
is it possible like this?
can u give me sites like that in java script?
Thank u in advance.
|
|
|
|
|
Message Closed
modified 23-Nov-14 7:13am.
|
|
|
|
|
yes,but i did nt get javascript forum,
can u tell me that functionality?
|
|
|
|
|
I need to display a digital book in ritchtextbox and the same time i like to link the topics. I have the list of the chapters and page number i want to jump at the position in the ritchbox when i click on a chapter or a page number from the list.
Thanks in advance
Suheb Ahmad
New Delhi INDIA
|
|
|
|
|
If I understand you correctly you can use RichTextBox.SelectionStart[^] property. It allows you to move to char indicated by this property.
Hope that helps
|
|
|
|
|
SuhebAhamd wrote: I need to display a digital book in ritchtextbox and the same time i like to link the topics.
Display a picture at that position, and create a hyperlink to it. Creating a hyperlink is described here[^].
SuhebAhamd wrote: i want to jump at the position in the ritchbox when i click on a chapter or a page number from the list.
Embed the pagenumber as a parameter into the hyperlink. Once you have the pagenumber, you can jump
I are Troll
|
|
|
|
|
Hi ,
What is the difference between Activator.CreateInstance and new operator
thanks in advance,
Azeez.
|
|
|
|
|
The former allows you to determine, at runtime, the object to be instantiated, while the latter requires that you know that information at design time.
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|
|
Hello........
I have a problem of printing High resolution image to a spesific sized pages.
I want it to fit in the page.After scaling down the image based on destination sizes(paper sizes),
I am able to fit the image to a page but the quality of the image is not good.
Is there any solution for this????
|
|
|
|
|
Determine the resolution of the printout beforehand, calculate the number of pixels wide and tall, then resize the image using a custom resizing technique (there are quite a few out there). Some sharpen, some blur, some average pixels, some just take the nearest pixel. If you resize the image so it prints out in the native resolution of the printer, then it won't have to do the shoddy resizing (probably nearest pixel) and you'll get the type of resizing you specifically code for.
|
|
|
|
|
Hi All,
Can anyone tell me how can I have a multicolor string in a single cell of a datagridview.
For example " 000 0000 0000000 0000000 0000000000", now I want the four consecutive zeros "0000" in red and rest in black. Is it possible to do that.
Thanks and Regards
Akshay
|
|
|
|
|
Hi,
You need to override the paint method for the cell object. Cells that contain just text are instances of DataGridViewTextBoxCell Class, so override that. Below is my attempt at a new class with over-ridden paint method. The draw method also only draws what will fit in cell so there will be no overlapping of data between cells. I have tried to make it as reusable as possible so you can define what colour you wish to change to and the number of consecutive numbers that should have colour changed. I also include code I used to test the class out and a couple of screenshots showing it working.
public class MultiColourDataGridViewTextBoxCell : DataGridViewTextBoxCell
{
public MultiColourDataGridViewTextBoxCell():base()
{
}
protected override void Paint(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
{
int fontSize = 9;
Brush textBrush = Brushes.Green;
Font font = new Font(FontFamily.GenericSansSerif,fontSize,FontStyle.Regular);
String stringPrint = (String)formattedValue;
graphics.FillRectangles(Brushes.White,new Rectangle[]{cellBounds});
StringPrintInfo[] stringPrintInfo = GetConsectiveNumbers(4, stringPrint, Brushes.Black, Brushes.Red);
PrintConsectiveNumbers(stringPrintInfo,graphics, font,textBrush,cellBounds,StringFormat.GenericDefault);
this.PaintBorder(graphics, clipBounds, cellBounds, cellStyle, advancedBorderStyle);
}
public StringPrintInfo[] GetConsectiveNumbers(int numberConsecutive, String input, Brush bOriginal, Brush bConsecutive)
{
List<StringPrintInfo> formatInformation = new List<StringPrintInfo>();
int inputCount = 0;
StringPrintInfo tmpStrPrntInfo;
String regExp = "\\b[0-9]{4}\\b";
Regex exp = new Regex(regExp);
foreach (Match match in exp.Matches(input))
{
if (inputCount < match.Index)
{
tmpStrPrntInfo = new StringPrintInfo();
String strTmp = input.Substring(0, match.Index);
tmpStrPrntInfo.str = strTmp;
tmpStrPrntInfo.brush = bOriginal;
inputCount = match.Index;
formatInformation.Add(tmpStrPrntInfo);
}
tmpStrPrntInfo = new StringPrintInfo();
tmpStrPrntInfo.str = match.Value;
tmpStrPrntInfo.brush = bConsecutive;
inputCount = match.Index + match.Length;
formatInformation.Add(tmpStrPrntInfo);
}
if (inputCount < input.Length)
{
tmpStrPrntInfo = new StringPrintInfo();
String strTmp = input.Substring(inputCount);
tmpStrPrntInfo.str = strTmp;
tmpStrPrntInfo.brush = bOriginal;
inputCount = input.Length;
formatInformation.Add(tmpStrPrntInfo);
}
return formatInformation.ToArray();
}
public void PrintConsectiveNumbers(StringPrintInfo[] toPrint,Graphics graphics, Font font ,Brush textBrush,Rectangle cellBounds, StringFormat stringFormat)
{
float xOffset = 0;
for(int i = 0;i<toPrint.Length;i++)
{
if (i > 0)
{
SizeF stringSize = graphics.MeasureString(toPrint[i-1].str, font);
xOffset += stringSize.Width;
}
if (cellBounds.X+ xOffset + graphics.MeasureString(toPrint[i].str, font).Width > cellBounds.X + cellBounds.Width)
{
string cutDown = toPrint[i].str;
for (int j = cutDown.Length; j > 0; j--)
{
cutDown = cutDown.Substring(0, j);
if (cellBounds.X + xOffset + graphics.MeasureString(cutDown, font).Width <= cellBounds.X + cellBounds.Width)
{
graphics.DrawString(cutDown, font, toPrint[i].brush, cellBounds.X + xOffset, cellBounds.Y, stringFormat);
break;
}
}
}
else
{
graphics.DrawString(toPrint[i].str, font, toPrint[i].brush, cellBounds.X + xOffset, cellBounds.Y, stringFormat);
}
}
}
public struct StringPrintInfo
{
public String str;
public Brush brush;
}
}
DataSet dataSet = new DataSet();
DataTable dStable = new DataTable();
DataColumn dSCol1 = new DataColumn("name", typeof(string));
DataColumn dSCol2 = new DataColumn("value", typeof(string));
DataRow rTemp;
DataGridViewColumnCollection dGVColumnCollection;
DataGridViewColumn dGVColumn1 = new DataGridViewColumn();
DataGridViewColumn dGVColumn2 = new DataGridViewColumn();
public partial class Form1 : Form
{
DataSet dataSet = new DataSet();
DataTable dStable = new DataTable();
DataColumn dSCol1 = new DataColumn("name", typeof(string));
DataColumn dSCol2 = new DataColumn("value", typeof(string));
DataRow rTemp;
DataGridViewColumnCollection dGVColumnCollection;
DataGridViewColumn dGVColumn1 = new DataGridViewColumn();
DataGridViewColumn dGVColumn2 = new DataGridViewColumn();
public Form1()
{
InitializeComponent();
dStable.TableName = "sample";
dStable.Columns.Add(dSCol1);
dStable.Columns.Add(dSCol2);
rTemp = dStable.NewRow();
rTemp.ItemArray = new object[]{"bill", " 000 0000 0000000 0000000 0000000000"};
dStable.Rows.Add(rTemp);
rTemp = dStable.NewRow();
rTemp.ItemArray = new object[]{"ted", " 111 1111 1111111 1111111 1111111111"};
dStable.Rows.Add(rTemp);
rTemp = dStable.NewRow();
rTemp.ItemArray = new object[] { "john", " 222 2222 2222222 2222222 2222222222" };
dStable.Rows.Add(rTemp);
dataSet.Tables.Add(dStable);
dGVColumnCollection = dataGridView1.Columns;
dGVColumnCollection.Add("col1", "Name");
dGVColumnCollection.Add("col2", "Value");
dGVColumn1 = dGVColumnCollection[0];
dGVColumn2 = dGVColumnCollection[1];
foreach(DataRow row in dataSet.Tables[0].Rows)
{
DataGridViewRow dGVRow = new DataGridViewRow();
DataGridViewTextBoxCell textCell = new DataGridViewTextBoxCell();
MultiColourDataGridViewTextBoxCell textCel2 = new MultiColourDataGridViewTextBoxCell();
textCell.Value = row.ItemArray[0];
textCel2.Value = row.ItemArray[1];
dGVRow.Cells.Add(textCell);
dGVRow.Cells.Add(textCel2);
dataGridView1.Rows.Add(dGVRow);
}
}
}
http://img2.pict.com/b4/07/ad/2401377/0/gridcellcolour1.jpg
http://img2.pict.com/91/13/8d/2401376/0/gridcellcolour2.jpg
modified on Tuesday, January 5, 2010 9:17 PM
|
|
|
|
|
Mind blowing..... thanks a lot .....
|
|
|
|
|
Hi All,
I am using VS 2008, 3.5 and am trying to add drag and drop functionality to the treeview. However, the allowdrop property is non existent on the treeview control.
I am baffled as to why this is the case.
Even when Ive instantiated the control it is neither existant nor does it appear behind the server control. help is much appreciated.
|
|
|
|
|
Uhm what treeview control are you using, the standard MS one (I presume you are using winforms) certainly has all the drag drop functionality.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
using VS 2008, asp.net 3.5 sp1. From what I am gathering the treeview control for webcontrols has no capacity for drag and drop, which exists for the winforms.
|
|
|
|
|
Have you ever seen drag and drop implemented on a web form? I think I have but VERY rarely. I notice the web control is categorised as a navigation control rather than a normal or data control, I would expect it to have different functionality.
I have a requirement for a web treeview (with D&D) coming up so I will be interested in your results.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|