|
If you want to draw on a child panel, handle the Paint event of the child panel and do the drawing there. That way, your drawing gets done every time the panel paints itself.
Just in case you have not yet discovered how to do this:
1. Select the child panel in the designer
2. Bring the Properties Window into view
3. On the toolbar at the top of Properties Window, click the Lightning Bolt button, this will switch to events view
4. Look down the list, find Paint and double-click it. This will put a Paint event handler stub in your code file
5. Put your code in there.
Good luck!
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Henry Minute wrote: If you want to draw on a child panel, handle the Paint event of the child panel and do the drawing there. That way, your drawing gets done every time the panel paints itself.
Just in case you have not yet discovered how to do this:
1. Select the child panel in the designer
2. Bring the Properties Window into view
3. On the toolbar at the top of Properties Window, click the Lightning Bolt button, this will switch to events view
4. Look down the list, find Paint and double-click it. This will put a Paint event handler stub in your code file
5. Put your code in there.
Good luck!
Thanks for the quick response.
In this way I have to write them all the code for all the geometric shapes that I have to draw, right?
I can not do this because I do not know what I have to draw, but I will have to read from a file.
I want something where the GUI alone remember all that has already designed and I would add only the new figure by the code . This way I can read from the file one figure at the time and add it to the plan to put all figures.
Thank you...
Hello.
Mirko
|
|
|
|
|
lor3n7o wrote: I want something where the GUI alone remember all that has already designed and I would add only the new figure by the code . This way I can read from the file one figure at the time and add it to the plan to put all figures.
Thank you...
What you need for this is a collection of some sort to hold details of what has been drawn, as a field of your Form. This collection can be serialized, or otherwise saved to a file when the application closes, ready for loading the next time it starts.
However you decide to implement that, the simplest way to ensure that your 'drawings' are displayed is to iterate over the collection drawing each item in the Paint event of the panel. The point is that each control in a Widows Forms application has its own Graphics object this object has methods for painting stuff on its surface.
There are plenty of examples of how to do all of these things. Just Google for drawing program c# or painting program c# and you will get lots of useful examples to study.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Thank you very much.
One question again:
For my problem may be a solution to use a library dll autocad to solve the problem?
or is it the equally persistent?
Thank you.
Hello
|
|
|
|
|
There is a distinct probability that the owners of Autocad might object to your using their intellectual property, you would need to check their site for that.
Even if it turns out to be OK to do that, you seem to be having enough problems dealing with drawing shapes on a panel, without trying to learn the whole new skill set involved in using third-party libraries, particularly if you don't have documentation about their API.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
|
Hi
I want to populate a combobox with the name of the tables of one access database. I use the following statment
I get stuck on the error Record(s) cannot be read; no read permission on 'MSysObjects'.
Any help?
My code:
<
Database db;
OleDbConnection cn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\DB1.mdb");
OleDbDataAdapter adt;
DataSet ds;
cn.Open();
adt = new OleDbDataAdapter("select name from msysobjects where type=1 and flags=0", cn);
ds = new DataSet();
adt.Fill(ds);
comboBox1.DataSource = ds;
>
|
|
|
|
|
KIDYA wrote: ("select name from msysobjects where type=1 and flags=0", cn);
I might be wrong but I would say rewrite the above as follows:
(Select Name1 FROM msysobjects WHERE type = '"1"' AND flags = '"0"', cn);
SQL is case sensitive and the values must be wrapped in '" "'.
Give this a try and see. I would also change the Column Name to Name1.
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
When first released, ASP.NET lacked a template engine.
So now, for .NET 2.0, ARE "master pages", ASP.NET'S version of a template Engine?
If no, how do regular Template engines (StringTemplate) differ from 'Master Pages'?
Thanks in advance,
Laura
|
|
|
|
|
This is not the best place to ask ASP.NET Questions. There is a seperate forum for it.
Either you love IT or leave IT...
|
|
|
|
|
I cannot get generics to return a type that it does not know is correct.
I have a collection of general objects each with a sorted keyfield ID
cTypeA 2
cTypeB 3
cTypeA 7
cTypeA 9
cTypeB 12
in one ArrayList, all of which derive from cType.
I want to create a separate list of ID references using generics, but which returns the actual objects in an indexer. That way I am assured of type safety when using the object (displaying in a listview say) rather than casting at the end use point:
public class cList<T>
{
public cList(cIDList UseOwner)
{
Owner = UseOwner;
ListItems = new ArrayList();
}
public T this[int Index]
{
get
{
if ((Index >= 0) && (Index < ListItems.Count))
{ return (T) Owner.GetObject((int)ListItems[Index]);
}
}
}
private cIDList Owner;
private ArrayList ListItems;
}
to implement this
cList<cTypeA> AItem = new cList<cTypeA>(MyIDList);
(assume items added)
cTypeA UseA = AItem[2];
Is there a way to solve this problem? The only way I can see is to do the above without generics, copy and paste then change the return cast type for what I use now, and in the future. Not easily manageable!
Thanks.
|
|
|
|
|
You can use a generic List instead of an untyped ArrayList , then copy the required references in the c'tor. (This assumes you are using .NET 3.5 - and of course your cIDList must be an IEnumerable , i.e. derived from any of the usual .NET collection classes).
Here's what it will look like:
public class cList<T>
{
private readonly List<T> ListItems = new List<T>();
public cList(cIDList UseOwner)
{
if (UseOwner != null)
{
ListItems.AddRange(UseOwner.OfType<T>());
}
}
public T this[int Index]
{
get
{
if ((Index >= 0) && (Index < ListItems.Count))
{
return ListItems[Index];
}
return null;
}
}
}
Regards
Thomas
www.thomas-weller.de
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. Programmer - an organism that turns coffee into software.
modified on Sunday, May 3, 2009 11:35 AM
|
|
|
|
|
You probably need to redesign whatever it is you're trying to do.
Otherwise, try cTypeA UseA = AItem[2] as cTypeA ;
|
|
|
|
|
from where i can download sql database template for visual studio
can any buddy provide link plz
|
|
|
|
|
What (kind of) template are you looking for?
I'm having trouble understanding what it is that you seek, please rephrase the question.
I are troll
|
|
|
|
|
if you go to your solution explorer there is an option "Add new item". then there will be a "Sql DataBase" template. i dont have that n i want that.
thanks
|
|
|
|
|
I guess that the template is installed by SQL Server (Express?). Try downloading/installing that, or repairing the Visual Studio installation itself.
I are troll
|
|
|
|
|
It would appear that you have to Express edition of Visual Studio, which does not come with Database project templates. There is no legal place to download those templates.
|
|
|
|
|
I want to control some hardware by internet. In order to do that I want to use ASP.NET and C# language. Suppose I want to turn on a LED which is placed in a PCB board. That PCB board is connected to a computer which has internet connection. From remote distance I will do some thing so that that LED will be turned on. If any body know some things abut the above meter please inform me as soon as possible.
Rashed
|
|
|
|
|
Are you hoping to become a developer or just spamming the site with a stupid question?
If you are then I suggest you start with something simpler, maybe "hello world" would be a good start. Read, study, try some things and ask specific questions about problems you encounter.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
rashed.info wrote: In order to do that I want to use ASP.NET and C# language.
That means that the computer who has the PCB-card in it needs to be an ASP.NET server
I suggest you browse the Coding 4 Fun[^] blog, it has some hardware-related projects that could get you started.
I are troll
|
|
|
|
|
Hi All
I Install my Windows Project In PC .
In The First Run Of the Application Is Run As Correct Way.
but the secound Run Of the Application The Windows Give Me the Error In Message Box
The Message IS :
Unable to find a version of the runtime to run this application .
and the Caption of a message is
Management.exe .Net FramWork Initailization Error
What Is this Error ??
How I Can Solve It ??
Thanks All
Thaer
modified on Sunday, May 3, 2009 2:46 AM
|
|
|
|
|
|
Usage of this thing
But not that good help
I have all the solutions proposed, but did not change something
We put that question to answer me one of them has been successful with the process and not to provide a teacher how to search
Thanks Mr
Thaer
|
|
|
|
|
HI
when i want to input my equation (ex: ((Math.Pow(x,5)) + x - 1) ) from textbox to function this erro
appear . format exeption was unhandeld .
my code is here
public double func(double x)
{
return (double.Parse((txtEq.Text)));
}
i want to user can input equation from textbox.
Thank u so much
|
|
|
|