|
What do you mean by 'implimenting some graphics' ? If you have bitmaps you can skin buttons with them or draw them on your form if you're just looking to improve the way it looks.
To draw a picture on the background of a form, handle it's OnPaint event, this is passed a graphics object and you can draw your bitmap to that.
You can search the web for ways to make forms an irregular shape, there's almost certainly example projects here on Code Project.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
|
I am the new about class and objects in c#. I just want to define an object for this issue after than I will save and restore from a file this ExamFile.
ExamFile.Title = "Test Exam File";
ExamFile.FileName = "my First Exam.mfe";
ExamFile.Exam[0].ExamName = "This is my First Exam";
ExamFile.Exam[1].ExamName = "This is my Second Exam";
ExamFile.Exam[0].Question[0].Remark = "First Exam's first Q";
ExamFile.Exam[0].Question[0].Type = "Multiple";
ExamFile.Exam[0].Question[1].Remark = "First Exam's Second Q"
ExamFile.Exam[0].Question[1].Type = "Single";
ExamFile.Exam[1].Question[0].Remark = "Second Exam's First Q";
ExamFile.Exam[1].Question[0].Type = "Multiple";
Thanks
|
|
|
|
|
Something like..
public class ExamFileBase
{
public string Title { get; set; }
public string FileName { get; set; }
public List<exambase> Exam { get; set; };
public ExamFileBase()
{
Title = "Default title";
FileName = "default_filename.mfe";
Exam = new List<exambase>();
}
}
public class ExamBase
{
public string ExamName { get; set; }
public List<questionbase> Question { get; set; }
public ExamBase()
{
ExamName = "Default exam";
Question = new List<questionbase>();
}
}
public class QuestionBase
{
public string Remark { get; set; }
public string Type { get; set; }
}
</questionbase></questionbase></exambase></exambase>
Only problem is, for the List<t> properties, you'd have to initiate a class before accessing it.
IE:
ExamFileBase ExamFile = new ExamFileBase();
ExamFile.Exam.Add(new ExamBase());
Unless you made them static so each was initialized auto-matically.
|
|
|
|
|
From your code it's evident that you want ExamFile to be a collection of Exam objects. Exams have names and a collection of Question(s), and Question has two string attributes, Remark and Type.
This object model is easily expressed in C#:
public class ExamFile
{
public string Title { get; set; }
public string Name { get; set; }
readonly public List<exam> Exams = new List<exam>();
}
public class Exam : List<question>
{
public string Name { get; set; }
readonly public List<question> Questions = new List<question>();
}
public class Question
{
public string Remark { get; set; }
public string Type { get; set; }
}
</question></question></question></exam></exam>
You could construct the object graph and then set properties as in your posted code, like this:
ExamFile file = new ExamFile();
file.Add(new Exam());
file.Add(new Exam());
file.Exams[0].Questions.Add(new Question());
file.Exams[0].Questions.Add(new Question());
file.Exams[1].Questions.Add(new Question());
file.Exams[1].Questions.Add(new Question());
and then do as in your posted code
file.Title = "Test";
...
file.Exams[1].Questions[1].Remark = "tough question";
However, in most cases you'd create a question object and set it's properties before adding it to an exam. Also note that the types themselves should usually have constructors that take some parameters. This has two side-effects: Less code to write to use the type, which is not very important but a marginal benefit, and a guarantee that an instance of a type cannot be created without certain minimum information.
Types should typically be designed to be flexible and general. Coding convenience can be achieved by writing little "helper methods" separately from the type itself. In this case, you could do something like this:
void addQuestion(Exam e, string remark, string type)
{
Question q = new Question();
q.Remark = remark;
q.Type = type;
e.Questions.Add(q);
}
Exam addExam(ExamFile f, string name)
{
Exam e = new Exam();
e.Name = name;
f.Exams.Add(e);
return e;
}
ExamFile file = new ExamFile();
f.Title = "test";
f.Name = "my first exam.mfe";
Exam e = addExam(file, "First Exam");
addQuestion(e, "remark #1", "Mutiple");
addQuestion(e, "remark #2", "I don't know");
and so on.
|
|
|
|
|
Hello,
You question is very large. I will try to answer you with a simple and short answer, and if you feel you need more explanations, feel free to post back here.
You will need more than a single object to hold your information. For instance, you could use a ExamFile, Exam and Question objects. In the ExamFile object, you could have a List<exam>, and in Exam object you could have a List<question>.
Here is a concrete example of a data structure to hold your information :
using System;
using System.Collections.Generic;
public class ExamFile
{
public String Title { get; set; }
public String FileName { get; set; }
public List<exam> Exams { get; set; }
}
public class Exam
{
public String ExamName { get; set; }
public List<question> Questions { get; set; }
}
public class Question
{
public String Remark { get; set; }
public String Type { get; set; }
}</question></exam>
|
|
|
|
|
I want to build a generic web analytic application using C#
I want to do it by making an addin to IE (and using windows hooks to catch all the user's events)
I tried to find some examples on how to build an addin to IE using C# but I didnt find anything
can someone please point me to where I can find some examples to get me started?
thanks
|
|
|
|
|
i have a c# executable which connects to an sql database and uses active directory for authentication. it runs fine from any folders as long as it's from any of my local drives but it silently doesn't do anything if i run from a network folder. anyone has an explanation for this? and how to fix it? thanks.
----------------------------------------------------------
"unzip; strip; touch; finger; mount; fsck; more; yes; unmount; sleep" - my daily unix command list
|
|
|
|
|
The reason is that Network drives are not automatically on trusted zone. One way to fix this is to increase assembly trust with .NET Framework configuration utility. Also you can sign the assembly and based on the signature add privileges etc.
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
|
Even though this has changed in .NET 3.5 SP1, you may still want to read up on "Code Access Security" to understand why your code doesn't work from a network share.
|
|
|
|
|
Hello,
I want to capture the pc desktop screen when any event is fired like start menu is clicked or "my documets" is opened. So for that any listener is needed to listen continuous system events?
And how i recognize when any event is fired?
Help me if anyone knows.
|
|
|
|
|
Why have you asked the same thing three times ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hello,
I have made different queries, 1. how can i open start command using mouse coordinates, 2. is there any listener is needed to listen continuously and perform task when any event is fired like open c:drive.
So please help me out for that. It will be great for me.
|
|
|
|
|
Hello,
I had capture the windows screen of my pc, if i click on "start", the start ,menu should be opened.
Will you please help me for doing this?
|
|
|
|
|
Hello,
I have developed the basic screen capturing of the remote pc to my pc, now when i click on start menu from my pc i need to open start menu on that remote pc n my pc also. So i have the coordinate of start menu but for remote pc how can i use that coordinte?
Please help me out if anyone knows .
Thank you.
|
|
|
|
|
I want to research broadcast, how can I get the VNC open source?
|
|
|
|
|
Try Google.
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.
|
|
|
|
|
|
Hello everyone,
I want to generate an XML file like below. My confusion is what technologies could I use to concatenate all information into a single XML document.
The root confusion is, I have a class called teacher which matches the teacher sub-section (ID, name and major) -- which I could use serialization technologies to generate teacher part XML information.
For other parts, like department, I also have a class to represent the information -- I could also use serialization technologies to serialize the information to XML -- but it has no relationship between teachers. So, my confusion is, how to concatenate different parts altogether, like department, club and teachers, and also make the whole XML document looks like below to reflect the relationships and hierarchies between them?
<?xml version="1.0" encoding="utf-8"?>
<Department>
<DepartmentInfo ID ="100">
<Location> San Jose </Location>
<Type> Computer Science</Type>
</DepartmentInfo>
<Clubs>
<Club ID="200">
<Name>Football</Name>
</Club>
<Club ID="201">
<Name>Basketball</Name>
</Club>
</Clubs>
<Teachers>
<Teacher ID="300">
<Name>Thomas</Name>
<Major>Algorithm</Major>
</Teacher>
<Teacher ID="301">
<Name>Zhou</Name>
<Major>Linear Programming</Major>
</Teacher>
</Teachers>
</Department>
thanks in advance,
George
|
|
|
|
|
|
Thanks Mika,
Do you have any samples or tutorials to recommend?
regards,
George
|
|
|
|
|
|
Thanks Mika!
I like them!
One more question, you option to my problem solution is to generate the XML document manually, not creating a class which contains all information and serialize the class?
regards,
George
|
|
|
|
|
If you only have to deal with XML files created by your application (no external ones), then I'd use XML serialization, it's just so comfortable to use
regards
modified 12-Sep-18 21:01pm.
|
|
|
|