|
I have just completed a big C# project and have descoverd that i have to create a variable list, i was wondering if there is a way of automatically creating this in visual studio. or do i have to go through each line to manualy create it?
any help?
|
|
|
|
|
|
A list of the variable names for strings, int, char and arrays. it also can have object names like memory streams and networkstreams.
i hope thats cleard it up a bit
|
|
|
|
|
I don't think there's something like this in VS (well, intellisense and the member dropdowns use this info, but I don't think you can export it).
But using reflection you can build this functionality on your own.
Regards,
mav
|
|
|
|
|
hi
if i have the yaw,pitch,roll angels and the legnth of an obect (line for example) which is drawen for example from point 0,0,0 how can i calculate the coordinates of the end of line point (x,y,z)
thanks for help
|
|
|
|
|
First of all I have to say, that I really have some difficulties to understand what your problem is!
There seems to be a problem with your question!
When you have a line starting at one point, and you also got the 3 angles vor x, y and z, then you need to know the length of that line to calculate the end point!
Have a look at vector maths.
Don't try it, just do it!
|
|
|
|
|
hi
thanks for your reply
i already tried to make that using the matrixtransformation but the output is not correct :
x1=X*m.M11+Y*m.M21+Z*m.M31+1*m.M41;
y1=X*m.M12+Y*m.M22+Z*m.M32+1*m.M42;
z1=X*m.M13+Y*m.M23+Z*m.M33+1*m.M43;
where x1,y1,z1 is the new point of the old x,y,z point after the rotation Matrix m is applied which contains the yaw,pitch,roll rotations
so what is the problem ? any suggestions?
thanks
|
|
|
|
|
Hi there on CodeProject. This is my very first post here.
I need a quick an easy way of building a visual tree (n-ary with the root at the top) in C# using some sort of extra GUI graphics package. I have looked at the netron project website but i choose to create a thread here since i need a quick an painless solution - fast. I am new to C# but have a good understanding of OOP from experience with Java.
So if somebody know how to do this - please give some tips or better yet - some source code I know of the TreeView Class, but it do not like the way it is drawn. I need the tree with the nodes of the same level/height drawn adjacent to eachother.
You know - like this:
() (root)
/\
/ \
() ()
/\ \
/ \ \
() () ()
Please - I need this to work fast.
Intel4004
|
|
|
|
|
In this case you should create a UserControl and then override the OnPaint method.
After that you can start to draw this tree by your own.
As far as I know there is no easier way to do this and there is no way around to do the drawing by your own.
|
|
|
|
|
Hello,
I have written Client and Server applications in C-Sharp language. They are communication with each others using sockets. The problem is that when client connects to the server, and if i disable the network (disconnect the network cable) at client side, it does not give any notification at the Server side that client is abnormally disconnected. I have put the code in try...catch, where I am reading client stream and i expect that i get an exception at server side in this case... but i don't (Note: I do get exception here if my client and server are running on same machine).
Anybody has any idea how to handle such situation.
Thanks,
Kamran
|
|
|
|
|
You shuld implement somethink like a check, maybe every 3sec a ping or somethink.
|
|
|
|
|
You should check for such an exception constantly. I would place a timer with the try..catch block inside and set the interval to 1000 or something like that.
Polis.
Can you practice what you teach?
|
|
|
|
|
Hi !
I have a very large 2D matrice of double values (10000 x 10000 cells). How can I convert this matrice into an image so that I'll be able to plot the values ? looping over the cells and drawing with GDI is out of the question.
Thanks
|
|
|
|
|
I don't see how you're going to be able to plot anything without looping over the cells somehow. Also, plot the image on what? It's going to be 10,000 pixel by 10,000 pixels. The screen is out of the question to plot an image that big. It all depends on what and how you want this image to be displayed. If it's acceptable to show the entire image inside the screen dimensions, alot of detail will be lost, but you can shorten the time it takes by mapping pixel coord onto the matric and only return the values at those pixel coords.
For instance, 1024, 768 on the screen would map to 10000, 10000 in the matrix.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi Dave,
Of course I'll have to loop over the cells and to loose information when displaying the smaller picture. The question is how am I displaying the picture ?. I can define a Bitmap object (smaller than the array) but how can I display the bitmap without saving it on H.D. ?
Thanks
|
|
|
|
|
Create a custom control, its the easiest.
override OnPaint(PainteventArgs pea)
{
Bitmap b = new Bitmap(10000,10000);
pea.Graphics.Transform = new Matrix(Width/10000f,0,0,Height/10000f,0,0);
pea.Graphics.DrawImage(b);
b.Dispose();
}
xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots
|
|
|
|
|
Hi,
can anyone suggest some source code to read XML files.
Any help would be much appreciated...
Cheers
|
|
|
|
|
Search MSDN msdn.microsoft.com[^] for XmlTextReader . Or search web for "reading XML in C#" or something like that. It usualy saves out time and leads to your answer When you run into problem come back.. you are welcomed.
David
Never forget: "Stay kul and happy" (I.A.)
David's thoughts / dnhsoftware.org / MyHTMLTidy
|
|
|
|
|
hi can anyone help me to append this code, to have autocomplete combobox in datagrid ?
using System;
using System.Windows.Forms;
using System.Drawing;
using System.Data;
using System.Diagnostics;
namespace Stock
{
// Derive class from DataGridTextBoxColumn
public class DataGridComboBoxColumnNAME : DataGridTextBoxColumn
{
// Hosted ComboBox control
// private AutoCompleteComboBoxNAME comboBox;
private ComboBox comboBox;
private CurrencyManager cm;
private int iCurrentRow;
// Constructor - create combobox, register selection change event handler,
// register lose focus event handler
public DataGridComboBoxColumnNAME()
{
this.cm = null;
// Create ComboBox and force DropDownList style
this.comboBox = new ComboBox();
this.comboBox.DropDownStyle = ComboBoxStyle.DropDown;
this.comboBox.Sorted = true;
// Add event handler for notification of when ComboBox loses focus
this.comboBox.Leave += new EventHandler(comboBox_Leave);
}
// Property to provide access to ComboBox
public ComboBox ComboBox
{
get { return comboBox; }
}
// On edit, add scroll event handler, and display combo box
protected override void Edit(System.Windows.Forms.CurrencyManager source, int rowNum, System.Drawing.Rectangle bounds, bool readOnly, string instantText, bool cellIsVisible)
{
Debug.WriteLine(String.Format("Edit {0}", rowNum));
base.Edit(source, rowNum, bounds, readOnly, instantText, cellIsVisible);
//
if (!readOnly && cellIsVisible)
{
// Save current row in the datagrid and currency manager associated with
// the data source for the datagrid
this.iCurrentRow = rowNum;
this.cm = source;
// Add event handler for datagrid scroll notification
this.DataGridTableStyle.DataGrid.Scroll += new EventHandler(DataGrid_Scroll);
// Site the combo box control within the bounds of the current cell
this.comboBox.Parent = this.TextBox.Parent;
Rectangle rect = this.DataGridTableStyle.DataGrid.GetCurrentCellBounds();
this.comboBox.Location = rect.Location;
this.comboBox.Size = new Size(this.TextBox.Size.Width, this.comboBox.Size.Height);
// Set combo box selection to given text
this.comboBox.SelectedIndex = this.comboBox.FindStringExact(this.TextBox.Text);
// Make the ComboBox visible and place on top text box control
this.comboBox.Show();
this.comboBox.BringToFront();
this.comboBox.Focus();
//this.comboBox.SelectedIndex = 0;
}
}
// Given a row, get the value member associated with a row. Use the value
// member to find the associated display member by iterating over bound datasource
protected override object GetColumnValueAtRow(System.Windows.Forms.CurrencyManager source, int rowNum)
{
Debug.WriteLine(String.Format("GetColumnValueAtRow {0}", rowNum));
// // Given a row number in the datagrid, get the display member
object obj = base.GetColumnValueAtRow(source, rowNum);
// // Iterate through the datasource bound to the ColumnComboBox
// // Don't confuse this datasource with the datasource of the associated datagrid
CurrencyManager cm = (CurrencyManager)
(this.DataGridTableStyle.DataGrid.BindingContext[this.comboBox.DataSource]);
// Assumes the associated DataGrid is bound to a DataView, or DataTable that
// implements a default DataView
DataView dataview = ((DataView)cm.List);
int i;
for (i = 0; i < dataview.Count; i++)
{
if (obj.Equals(dataview[i][this.comboBox.ValueMember]))
break;
}
if (i < dataview.Count)
return dataview[i][this.comboBox.DisplayMember];
return DBNull.Value;
}
// Given a row and a display member, iterating over bound datasource to find
// the associated value member. Set this value member.
protected override void SetColumnValueAtRow(System.Windows.Forms.CurrencyManager source, int rowNum, object value)
{
Debug.WriteLine(String.Format("SetColumnValueAtRow {0} {1}", rowNum, value));
object s = value;
// Iterate through the datasource bound to the ColumnComboBox
// Don't confuse this datasource with the datasource of the associated datagrid
CurrencyManager cm = (CurrencyManager)
(this.DataGridTableStyle.DataGrid.BindingContext[this.comboBox.DataSource]);
// Assumes the associated DataGrid is bound to a DataView, or DataTable that
// implements a default DataView
DataView dataview = ((DataView)cm.List);
int i;
for (i = 0; i < dataview.Count; i++)
{
if (s.Equals(dataview[i][this.comboBox.DisplayMember]))
break;
}
// If set item was found return corresponding value, otherwise return DbNull.Value
if(i < dataview.Count)
s = dataview[i][this.comboBox.ValueMember];
else
s = DBNull.Value;
base.SetColumnValueAtRow(source, rowNum, s);
}
// On datagrid scroll, hide the combobox
private void DataGrid_Scroll(object sender, EventArgs e)
{
Debug.WriteLine("Scroll");
this.comboBox.Hide();
}
// On combo box losing focus, set the column value, hide the combo box,
// and unregister scroll event handler
private void comboBox_Leave(object sender, EventArgs e)
{
try
{
DataRowView rowView = (DataRowView) this.comboBox.SelectedItem;
string s = (string) rowView.Row[this.comboBox.DisplayMember];
Debug.WriteLine(String.Format("Leave: {0} {1}", this.comboBox.Text, s));
SetColumnValueAtRow(this.cm, this.iCurrentRow, s);
Invalidate();
this.comboBox.Hide();
//MessageBox.Show(s);
this.DataGridTableStyle.DataGrid.Scroll -= new EventHandler(DataGrid_Scroll);
}
catch
{
}
}
}
}
|
|
|
|
|
i can not programmaticly set dateee.Checked = false; once it was set true.
Where is the trick?
|
|
|
|
|
If the .ShowCheckBox property set to true ?
DateTimePicker.Checked Property[^] docs on MSDN.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
ShowCheckBox is set true ...and its checked in my datepicker box.
now i wana set it to unchecket state again (while program running) with Checked = false but nothing happen. the datepicker checkbox stays checked.
|
|
|
|
|
That's indeed a bug. When you set its Checked property to false , it actually becomes false , but the control still is painted as if it were true .
I remember reading about it, and what I recall to have worked is to set the Checked property to true and then immediately to false .
Try that and tell us if it works.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
thats exactly how i solve it. if i want to set checkbox in unchecked state, i have to set it first true and then immediately to false. i also noticed...
if you programmaticly set value to same date that already is (checkbox is unchecked), checkbox dont get automaticly checked. i think that checkbox should get checked=true(automaticly) every time you set a value, if we look that checked is set to false by default.i see checkbox as an confirmation that value was really set.
|
|
|
|
|
I have used the checkbox in the DateTimePicker control to register the date when a vaccine was applied to a child. If the the checkbox is checked, then the vaccine has been applied and the date specifies when. If the checkbox is unchecked, the vaccine hasn't been applied, and the date doesn't matter (it's grayed out.)
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|