|
You can definately use p/invoke to call any windows API you like.
I don't know of any libraries tho.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Invoking native API from C#? Mhm, I guess that's too much for my current c# skills. Especially since I would need a representation for the CRegion equivalent in C# so the api can work with it. Sounds not more easy than the triangulation approach, does it?
Besides, why can't the Compact Framework simply offer the GraphicsPath class, so I could construct my polygon as Region? Grrr.... can I trick somehow with RegionData!? I guess not.
Thanks so far anyhow!
|
|
|
|
|
It is easy to get the answer for a Region:
<br />
Region r = new Region(new Rectangle(0, 0, 100, 100));<br />
Point p = new Point(99,10);<br />
bool b = r.IsVisible(p);<br />
If you region is not simple one you have to use GraphicsPath to build the region:
<br />
GraphicsPath path = new GraphicsPath();<br />
path.AddRectangle(new Rectangle(0, 4, 2, 5));<br />
path.AddEllipse (new Rectangle(4, 2, 7, 10));<br />
Region region = new Region(path);<br />
path.Dispose();<br />
|
|
|
|
|
As I wrote in my first post, and 5 minutes before yours: I must also work with compact framework, and there is no graphicspath available.
But thanks anyhow!
|
|
|
|
|
hi ,
After reading a few articles , i made this printEngine class that
derives from PrintDocument. The print engine takes any class that
exposes the IPrintableDocument interface. This interface defines a
method that supplies a PrintablePage to the exposing class which
should fill the page with classes that expose IPrintableSection.
Its not very complicated but it does have a few flaws. Like although it
_can_ handle pagination , it does'nt do it very well. The class that exposes IPrintableDocument has to return true/false depending on whether it need to add another page! Also , the TableRowSection does'nt work very well. Obviously , i have to make a whole table class because there needs to be column sizes added. The TableRowSection draws cells according to its own cell text sizes. To make a whole Table class i need to have the graphics class to calculate the sizes of largest text and the whole table. Should i have the PrintablePage send a graphics to the Table class?
Also Could someone please check the code and tell me if the design is ok?
I should mention that i'm a self taught newbie!
Heres the code:
http://gidsfiles.googlepages.com/PrintingCore.cs
http://gidsfiles.googlepages.com/PrintableSections.cs
http://gidsfiles.googlepages.com/PrintTest.cs
This is how the print engine is used with the printTest class:
PrintEngine pDoc = new PrintEngine();<br />
pDoc.PrintableDocument = new PrintTest();<br />
PrintDialog prt = new PrintDialog();<br />
prt.Document = pDoc;<br />
prt.ShowDialog();<br />
PrintPreviewDialog prev = new PrintPreviewDialog();<br />
prev.Document = pDoc;<br />
prev.ShowDialog();<br />
<br /> Thanks so much
Gideon
|
|
|
|
|
Hi,
Hard to say what to change without having more detailed requirements. It would be interesting to know if you need to print one large table spread over several tables.
First of all you will by sure need one PrintableSection for a whole table. Like you already noticed you will need this to calculate proper widths for all the table entries. I also think this makes it easier and provides better variability than trying to make one section for each row. Surely ot needs the Graphics to determine its size, but you already have the GetSize function which should be sufficient also for the TableSection.
Personally I would change the IPrintableDocument.SetPage call to something like PrintablePage[] GetPages(Graphics g, Rectangle pageBounds) . This way IPrintableDocument implementations can straight away return any number of pages with its own page break logic. As you already have a return value in the AddSection function the IPrintableDocument would even have an easy hint when it needs to create a new page. With the array of pages your PrintEngine could than easily print page by page until done.
Robert
|
|
|
|
|
hi,
thanks so much for replying. Somehow, i did'nt get a notification when you replied , so i figured that this , like the other copies i've posted over serveral forums had'nt been.
I only saw your reply today. I made a whole lot of changes in the code. I made a table class that just creates TableRow sections. Like rightly said , i need the tables , but just for the calculations. So table figures sizes and creates Rows , the Rows ghtexpose IPrintableSection so they are added into the page. I gace the page the Bounds because i thought it was more correct , since bounds would belong to the page. But , yes , it does make sense returning a number of pages. Right now , i have to loop in IPrintableDocument.Print().
There still is a problem though. The rows dont print on the right Y line. They either overlap or a consecutive rows top is just after the previous rows bottom , and this varies acco rding to the font and size.
Could you please just check it one more time??
Here's the source(updated):
http://gidsfiles.googlepages.com/PrintingCore.cs[^]
http://gidsfiles.googlepages.com/PrintableSections.cs[^]
http://gidsfiles.googlepages.com/PrintTest.cs[^]
Thanks so much!!
Gideon
|
|
|
|
|
Hi,
hard to say why your positioning isn't correct by just looking at the code. Next time you should pack a sample project which can be debugged.
Only thing I noticed is that you calculate the row height for each row seperately only looking at the first cell. For me this sounds like a possible source for the error. I would determine one height which should be used by all rows and is the maximum height of all contained strings. This could be done in your table class while it calculates the column widths.
Robert
|
|
|
|
|
Hi everyone,
Any idea how to include a sub-table under a table in a DataGrid control??
Many thanks guys
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
use Janus Grid ... checkout this site.. www.janusys.com
|
|
|
|
|
hi, i have datagrid filled from xml document, i want to make update, delete, add on the xml document through the datagrid, for example for the edit there will be a hyperlink located on the cloumn will direct me to another windows form and i will have the row data in controls on that windows form and i will make the edit from there, please i need a sample code for an urgent project
Thanks alot
Hamody
|
|
|
|
|
I tried the following code in my windows form which has a datagrid and i place it in the double click event of the datagridview
Form2 f = new Form2();
f.val = dataGridView1.Rows[dataGridView1.CurrentCellAddress.Y].Cells[0].Value.ToString();
f.Show();
where val is a public variable declared in form2, i an haveing the first field as the primary key field so i referred it as cells[0].
and in the load event i placed the val to the textbox, now we got the key then using this value you can populate the form fields with the values from the xml file know.
I am not sure about your expectation.
Best Regards,
M. J. Jaya Chitra
|
|
|
|
|
thnx,
I did n some way else, but noww, do u know whow to delete from xml file,
i deleted but i want to remove the node after deletion, for example if we have the following:
<city>
<name>Inida</City>
<time>5:55</time>
</city>
<city>
<name>Jordan</City>
<time>5:55</time>
</city>
and if i want to remove the city where name = India, i want to make it as:
<city>
<name>Jordan</City>
<time>5:55</time>
</city>
not as:
<city>
</city>
<city>
<name>Jordan</City>
<time>5:55</time>
</city>
thanks for helping me
-- modified at 3:21 Monday 11th June, 2007
Thanks alot
Hamody
|
|
|
|
|
Have you find the solution and can you post me the code how you have tried to populate and delete it
Best Regards,
M. J. Jaya Chitra
|
|
|
|
|
hello, realy no i havent got the solution up 2 this time, may u send me a code sample for adding a hyperlink to the datagat will redirect me to another windows form, and dnt worry after i will send u a full code sample
Thanks alot
Hamody
|
|
|
|
|
In .net 2005
This is a windows application
I have adapted the following code in order to populate the datagridview from xml file
DataSet ds = new DataSet();<br />
ds.ReadXml(@"D:\myappl\Student.xml", XmlReadMode.Auto);<br />
dataGridView1.DataSource = ds.Tables[0];
While the datagrid is clicked then it mead=ns the user is tring to edit the record so that i can get the selected row and the selected rows first cell contains the primary key so i am passing that to the form 2 (edit form) as follows in that the constructor of the form 2 takes one string argument which is the primary key of the selected field passed from the form1 as follwos
In form 1
private void dataGridView1_DoubleClick(object sender, EventArgs e)<br />
{<br />
MessageBox.Show("" + dataGridView1.CurrentCellAddress.Y);<br />
MessageBox.Show(dataGridView1.Rows[dataGridView1.CurrentCellAddress.Y].Cells[0].Value.ToString());<br />
Form2 f = new Form2(dataGridView1.Rows[dataGridView1.CurrentCellAddress.Y].Cells[0].Value.ToString());<br />
f.val = dataGridView1.Rows[dataGridView1.CurrentCellAddress.Y].Cells[0].Value.ToString();<br />
f.Show();<br />
}
In form 2
public Form2(string value1)<br />
{<br />
InitializeComponent();<br />
textBox1.Text = value1;<br />
DataSet ds = new DataSet();<br />
ds.ReadXml(@"D:\myappl\Student.xml", XmlReadMode.Auto);<br />
ds.Tables[0].PrimaryKey = new DataColumn[] { ds.Tables[0].Columns[0] };<br />
DataRow dr = ds.Tables[0].Rows.Find(textBox1.Text);<br />
textBox2.Text =Convert.ToString( dr[1]);<br />
<br />
}<br />
if the Datarow and DataSet object is global and if you give the following code it will be deleted.
<br />
dr.delete();<br />
ds.WriteXML(...)<br />
Please tell me whether this is working or not but keeping a linklabel inside a datagrid is not possible if it is a web application then you can do that by keeing the hyper link field in the gridview control and it is possible to hide the primary key also
-- modified at 5:43 Monday 11th June, 2007
Best Regards,
M. J. Jaya Chitra
|
|
|
|
|
Hi all,
I'm new to WPF and I'm trying to create a sheet music renderer. In order to be able to lay out notes on lines and in between lines, I am using grids to put my notes in rows and columns.
To acheive this, I would like to be able to have two grids with one superimposed on the other (this is easy to do). However, I would like to be able to position one grid to always be offset from the other grid by half the height of a row of the other grid (all rows are equally sized). I can achieve this somewhat by using a RenderTransform for a given scale, however the alignment changes when grid dynamically resizes to fit its container or when I scale transform the grid. The same goes by setting the margin. Instead I would like to somehow databind the y-offset of the one grid to half of the row height property of the other grid, but I can't figure out how to do so. This offset could be set by using a top margin or a render transform, but it must be dynamically calculated based on the current row height *0.5 of the other grid.
Any help or ideas would be much appreciated!
Thanks,
Tian
|
|
|
|
|
hi, I am using the C#.net 2.0 (2005)
what should i use for display the data...DatagridView or DataGrid...?
Please Help and also send the reason
Regards
Pankaj Joshi
|
|
|
|
|
DataGridView is easier to maintain but you cant format it in a good way.
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
try MS-FlexGrid
|
|
|
|
|
Hi,
hard to say without knowing your requirements. Generally I would go for the DataGridView. Its a bit easier to use. Customization capabilities are nearly equal in both grids.
If you want to show a DataSet with different tables and relations between them than you should use the DataGrid.
Robert
|
|
|
|
|
The reason that many options exist is that different ones are better suited to different situations. Use the most lightweight object that lets you achieve your goal.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hello All,
I have a desktop application which have the a MDI from and some childs forms.
when i cleck on MDI's menu one form is open like
Form1 frm=new Form1();
frm.show();
this is OK. But whenever user again click onto the menu again a form is displayed
I know this is because of
Form1 frm=new Form1();
But i want to show form only once i.e. If form open then no need to show it else show...
how I can do this..?
Regards
Pankaj Joshi
|
|
|
|
|
Hi,
there are many ways to do this, e.g. keeping a counter (or boolean flag).
The preferred one however is by simply disabling the menu item so the user sees he will
not be able to do it again.
|
|
|
|
|
Thx For Your Reply ,
I tried what you said ... but unable to got success because of the following regions.
1. Public Variables are not allowed in C#.
2. Every thing is object oriented that means you have to decalare a new instance of class variable before use it.
Say I have one MDI and two childs forms when I click on the menu and form1 is shows I use a class say class1
which public variable i assign as true say
public bool isForm1Shows=false;
When I use this in MDI I have to make a object of class1 to use isForm1Shows when I done this
isForm1Shows automatically goes false and creates problem. say after displaying the form1 i assign
this like
form1 frm= new form1();
isForm1Shows=true;
frm.show;
Then its ok but when i close the form1 what happned..? i have to write code on disposing method of the
form1 and again if i want to use Class1 here I have to create an object by keyword NEW then
isForm1Shows automatically goes to false. and this creates problem to me.
I think You got what i want to say
please Help me....
Regards
Pankaj Joshi
|
|
|
|