|
What control's paint event is it that you use, then?
Are you using the graphics object that is supplied to you in the event attributes, or are you creating a completely new graphics object? If you don't use the graphics object that is supplied, you will always be drawing to the screen, even when the DrawToBitmap is trying to make you draw to the bitmap.
If you do it correctly, there is no need to draw the lines to the bitmap separately.
---
b { font-weight: normal; }
|
|
|
|
|
ssoffline wrote: but no lines or graphics why?
Because they are not on the bitmap, you must be drawing them on top of the bitmap, direct to the screen.
That seems obvious, but beyond that, it's impossible to answer without seeing the code ( and the code you posted doesn't count, it doesn't show how/where the lines are being drawn )
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Point ps = new Point(l1.Source.X - 110, l1.Source.Y - 50);
Point pd = new Point(l1.Destination.X - 110, l1.Destination.Y - 50);
Graphics graph = this.MainPanel.CreateGraphics();
Pen penCurrent = new Pen(Color.Red,4);
penCurrent.EndCap = LineCap.ArrowAnchor;
graph.DrawLine(penCurrent, ps, pd);
penCurrent.Dispose();
This is the code for line drawing, these are drawn no a panel which is located at 110,50 hence the adjustments, or u mean to save here that i should save the form, i tried saving the whole form but then also i have no lines
Sameer Sood
Microsoft Student partner
NIT Durgapur,india
|
|
|
|
|
ssoffline wrote: these are drawn no a panel which is located at 110,50
OK, why are you using a Panel ? Surely you should be creating a bitmap in memory, drawing it in your paint method, and drawing onto that bitmap. If you're not drawing onto a Bitmap, how are you hoping to save it ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
i am using a panel because my app is used for making diagrams, so al objects other than lines are user controls, and secondly how to do that in memory,Do you mean that i shoul draw lines manually on the bitmap i am gonna save?
Sameer Sood
Microsoft Student partner
NIT Durgapur,india
|
|
|
|
|
ssoffline wrote: so al objects other than lines are user controls
No, they should be different classes with a common base class, which are used to draw the objects on your main control.
ssoffline wrote: Do you mean that i shoul draw lines manually on the bitmap i am gonna save?
Yes, obviously. If you don't draw lines on the bitmap, when you save the bitmap, they aren't going to be there, are they ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
ok thanks i 'll try and tell
also i posted earlier today how to make lines resizable?
i mean i should be able to select them like controls and resize with mouse?
i can move them but how to resize?
Sameer Sood
Microsoft Student partner
NIT Durgapur,india
|
|
|
|
|
ssoffline wrote: i mean i should be able to select them like controls and resize with mouse?
The way to do this is to create a struct that defines each item. Then keep them in a list, and render them from that list. when the user clicks, you iterate over the list and see if an item was selected. If so, you change the attributes of that object in the list when the user drags or whatever.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
hi
thanks for previous suggestions, i am already doing the same only, in fact i can save and compile my diagram and even reopen it using XML, my problem is how to show those selected points as are shown in windows form editor around that graphics object, of course if it becomes selectable like other controls then resizing is no big thing.
Sameer Sood
Microsoft Student partner
NIT Durgapur,india
|
|
|
|
|
actually when you move window or minimize/maximize it all the controls redrwan but since you have written your code in some function that doesn't get refresh.Do one thing put that code in in OnPaint() method of your form.you'll be able to show your alll the time
sameer
|
|
|
|
|
@sameer
i am doing that in onpaint event only and they don't diappear in maximize minimize
Sameer Sood
Microsoft Student partner
NIT Durgapur,india
|
|
|
|
|
Hi there, I wonder if anyone can help... i have a small issue with typed datasets, specifically my row (see below) variable has intellisense for my fields as it should because its a typed dataset... but ds.LOB.Rows[0]. etc etc.. i can't seem to get the fields to show up
Basically i am trying to add certain data from Row 0 from ds and ds1 ... they both only have 1 row ... to a new row in ds2... the new row in ds2 shows all its typed fields... but the ds and ds1 do not..
of course if do the old fashioned way of row.Value = ds.LOB.Rows[0]["myField"].ToString() then it works ....
Every single dataset below is a typed dataset.
Here is what is happening
CD.LOBDataSet ds = new CD.LOBDataSet();
CD.LODDataSet ds1 = new CD.LODDataSet();
ds.Merge(testdata.Data); // testdata is just a class with a dataset
ds1.Merge(testdata.Data1); // testdata is just a class with a dataset
// Now I have data in ds and ds1 ..
// i have proved there is data there...
// Now going to add data to ds2 from ds/ds1
CD.LOTempDataSet ds2 = new CD.LOTempDataSet();
CD.LOTempDataSet.LOTempRow row;
row = ds2.LOTemp.NewLOTempRow();
// below both field names Description and Value show up in intellisense as it is a typed dataset
row.Description = "This is a test!";
row.Value = ds.LOB.Rows[0]. // this line.. row.Value is a field and has intellisense but ds.LOB doesn't
Any help anyone can offer would be gratefully appreciated
Thanks in advance
Ian
|
|
|
|
|
Have you tried casting ds.LOB.Rows[0] to a typed row?
|
|
|
|
|
No I didn't know you had to .... can you give me an example?
Thanks
Ian
|
|
|
|
|
I'm not sure this will work for you, but it's worth a try:
NewLOTempRow row = ds.LOB.Rows[0] as NewLOTempRow;
if(row != null)
{
row.
}
The question is, of course, whether the row itself is a NewLOTempRow. If it isn't, then you're losing your custom fields. If that is the case, let me know, I have another idea what it could be.
|
|
|
|
|
Excellent! THat worked great
Thanks!
Ian
|
|
|
|
|
where can i find free c# to download, and a beginner's manual?
daniela
|
|
|
|
|
Hi daniela,
On this site:
http://msdn.microsoft.com/vstudio/express/visualcsharp/
You can download C# express edition for free.
I don't know where to find a beginner's manual......
Good luck!
|
|
|
|
|
|
|
If you want a really good beginner's book, look at C# Step by step. I don't normally recommend MS books, but the Step by Step series is a very good one for getting started with something new.
HTH
WhiteWizard
aka Gandalf
|
|
|
|
|
Hi Everybody
I have a question I wish someone help me with his answer and why
Do you prefer data binding - which is ready with c#- or doing it yourself -I mean to write the complete code yourself?
Really I tried the two but I found data binding is fast but may come with error that hardly you find it, on the other hand Writting the code by myself is safe and easy to find any errors but very long time I take!!!!!!!!!
Regards,
Hisham Galal <me4webby@yahoo.com>
|
|
|
|
|
I prefer writing the hook up code myself, however, you can save time and bugs by having databinding do it for you.
|
|
|
|
|
i make databinding and change query strings and other parameters in code where required it saves time and iss more reliable but this meathod dosent work so well with crystal reports ( in case when you have schema changes in dataset )
It is Good to be Important but!
it is more Important to be Good
|
|
|
|
|
how to select a perticular cell on DataGridView.Are there any method? without
" cell.selected=true " are there any? same....tell me how to move on cell by
arrow skipping unwanted columns...every code sample with DataGridView Control
plz post to me......i welcome all.
additional***
i want to select a cell (set focus to the cell) it means when cell got F2 mode.i'm developing VS.net 2005 IDE.here in a cell select and press F2 it comes to edit mode.i want set focus to a cell programitically.send sorce code.
like "TextBox.Focus()" the same thing should happen here also..
-- modified at 9:08 Monday 16th October, 2006
|
|
|
|