|
I think you want this:
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
GraphicsPath capPath = new GraphicsPath();
Point[] cappoints = new Point[] { new Point(0, 10), new Point(-10, 0), new Point(10, 0), new Point(0, 10) };
capPath.AddLines(cappoints);
CustomLineCap myCap = new CustomLineCap(null, capPath);
Pen capPen = new Pen(Brushes.Black, 1);
capPen.CustomEndCap = myCap;
capPen.CustomStartCap = myCap;
myCap.StrokeJoin = LineJoin.Round;
myCap.WidthScale = 2;
e.Graphics.DrawLine(capPen, new Point(100, 100), new Point(300, 100));
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi,brother.Thanks for your help!:->
|
|
|
|
|
Can you tell me why set cappoints variable like this way.If I changed the array of the points,the line will not anchor the middle point of the bottom line triangle.Because I am a beginner in GDI+,please help me in any case.Thanks a lot!;)
|
|
|
|
|
I am accessing database (Informix) using ADO.NET and not using any transaction, what could be the default transaction status? In this case is system suppose to have dirty read? [ReadUnCommited]
If yes, any idea, what is the difference between using transaction with read Uncommited, or not using transaction.
Are there any performance difference?
Appreciate your help
- ashish
|
|
|
|
|
Hi
I am facing one problem while opening my Dot net project ?Error is coming like there "There is error on 1 Line:Expected '<' but found Auto attach" and the corresponding project file is not a valid project.
if anybody knows please help me out
dimp
|
|
|
|
|
I've never encountered this before but you can try to open the class that is causing the problem with a text editor (recommend CrimsonEditor as it color codes c#, vb, j# etc..) and have a look at the code yourself to try and determine the problem.
Thats the only thing I can suggest.
Sorry I couldn't be more help!
|
|
|
|
|
two projects,BusinessLayer and DataAcessLayer.
DataAcessLayer includes CustomerDB.cs, App.config.
App.config is like this:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="ConncetionString" value="Server Port Address=;Server Name='';Character Set=iso_1;Network Protocol=Winsock;Provider='Sybase.ASEOLEDBProvider.2';User ID=;Password=;Initial Catalog=" />
</appSettings>
</configuration>
CustomerDB class has method GetCustomers
public DataTable GetCustomers()
{
string ConnectionString =
ConfigurationSettings.AppSettings
["ConncetionString"];
............
}
when i call GetCustomers() in BusinessLayer, the ConncetionString is always null.
but i did have a successful try before.
please help me,thanks.
-- modified at 23:06 Tuesday 27th September, 2005
|
|
|
|
|
just a WAG...
You might want to try including an \ before each of the quotes in your connection string.
There also seems to be a missing quote after Server Name ="
If the value needs to be null I would try:
Server Name =\"\"
Provider might also need to use \" instead of '
but alas it's just a WAG and I'm sure someone else will point me (or you) the right way
Let me know if it works.
www.lovethosetrains.com
|
|
|
|
|
i delete some detail of the connection string because here is messageboards.
i can get right value of connection string if i call GetCustomers() in project
DataAccessLayer.
but if i call GetCustomers() in BusinessLayer the conncetion string is always
null.
thanks anyway.
|
|
|
|
|
Using \ as escape character does not work in xml.
If you check closely, there is no quoute after server name, it is two apostrophes.
---
b { font-weight: normal; }
|
|
|
|
|
How are the projects related? Have you referenced the business layer in the web project?
---
b { font-weight: normal; }
|
|
|
|
|
there were two project BLL and DAL, BLL use DAL to complete
some CRUD jobs. i have referenced DAL in BLL.
thanks ^_^
|
|
|
|
|
Ok I'll byte again...
by chance are u creating a new instance of your DAL in BLL and then not reading the app.config? If the variable holding your connection string is not static then it would be null when you created a new instance of DAL. You could try declaring your connection string variable in DAL as static (might not be good practice) and see what you get.
I was thinking maybe your method only returns a (GET) value and does not actually go out and read the app.config.
:+)
www.lovethosetrains.com
-- modified at 22:20 Wednesday 28th September, 2005
|
|
|
|
|
Is it possible to have the menustrip and toolstrip have Office XP 2000 look and feel?
Thanks
|
|
|
|
|
I'm trying to implement a functionality that will allow the user to rename a node in a treeview by right clicking on the node and selecting 'Rename'(the same as in windows explorer). How do I trigger the editting event for the nodes from within the code?
Thank you in advance
|
|
|
|
|
The triangular arrow like generalization description of the UML, I have think about it for some days,but I'm still have no any ways and means.Can you tell me how to draw it? If you can give some code to me,I'll be thankful to you for it.
|
|
|
|
|
e.Graphics.DrawPath(Pens.Black, new System.Drawing.Drawing2D.GraphicsPath(
new Point[]
{
new Point(20, 20),
new Point(40, 40),
new Point(0, 40),
new Point(20, 20)
},
new byte[]
{
(byte)System.Drawing.Drawing2D.PathPointType.Start,
(byte)System.Drawing.Drawing2D.PathPointType.Line,
(byte)System.Drawing.Drawing2D.PathPointType.Line,
(byte)System.Drawing.Drawing2D.PathPointType.Line
}
));
Assuming that you're drawing it in your Paint handler.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I guess that you must understand UML shapes,do you remenber the inher inherit shape? That has a line and a triangular?
I want to draw the shape use with GDI+. I have write some code.But there are some error,Can you help me?
-----------------------------------
private void Form2_Paint(object sender, PaintEventArgs e)
{
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
GraphicsPath capPath = new GraphicsPath();
Point[] cappoints = new Point[] { new Point(0, 0), new Point(10, 0), new Point(0, 10), new Point(0, 0) };
capPath.AddLines(cappoints);
CustomLineCap myCap = new CustomLineCap(null, capPath);
Pen capPen = new Pen(Brushes.Black, 1);
capPen.CustomEndCap = myCap;
capPen.CustomStartCap = myCap;
myCap.StrokeJoin = LineJoin.Round;
myCap.WidthScale = 2;
e.Graphics.DrawLine(capPen, new Point(100, 100), new Point(300, 100));
---------------------------------------------
|
|
|
|
|
I don't see any error, unless the shape being drawn is not what you want, in which case you just need to move the points until it is ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Okay, I think this is going to sound like a crazy question and I think I already know the answer, but I thought I'd throw it out there just to see if I've missed something.
I have a DAO/DAL (Data Access Object/Data Access Layer) class that communicates with SQL Server. The methods have a number of parameters which map to the parameters being sent into the stored procedure. Because I use a cradle-to-grave naming convention the name of the SQL Parameters are exactly the same as the parameters passed into the method.
Is there any way to iterate over the values being passed into the method and create the appropriate SqlParameter objects? I want to do something like this:
SqlCommand cmd = new SqlCommand("myStoredProcedure");
foreach(ParameterInfo paramInfo in methodParameters)
{
string name = paramInfo.Name;
object value = somethingIDontKnowWhat[name].Value;
cmd.Parameters.Add("@"+name, value);
}
I did think of passing in a Hashtable and iterating over that, but I want the security of the compiler throwing out errors if there are parameters missing.
Any other ideas?
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
The basic idea of layering an application is that the data storage should be totally isolated from the user interface. Your code should not be relying on the fact that the method parameters should have the same names as the parameters in the database. If you change the data storage you might have to change the parameter names, then you have to change the names in the entire application. This is exactly what layering the application is meant to prevent.
So, either layer the application propely, or not at all.
---
b { font-weight: normal; }
|
|
|
|
|
Guffa wrote:
The basic idea of layering an application is that the data storage should be totally isolated from the user interface.
Who mentioned anything about the user interface?
Guffa wrote:
Your code should not be relying on the fact that the method parameters should have the same names as the parameters in the database.
This goes against the ethos of Crade-to-grave naming conventions. This is actually a very constructive part of design. To call something a "name" in one part of the code and a "title" in another part and an "id" in yet another leads to confusion and increases maintenance costs. The design should be precise enough that there is no ambiguity over what something is. If I have to spend 10 minutes tracing through code every time I want to know what some variable actually represents then this is a loss on my time and increases my costs and reduces my productivity.
Guffa wrote:
If you change the data storage you might have to change the parameter names, then you have to change the names in the entire application
I use stored procedures to buffer any changes in the underlying data source. I also have a well designed DAO/DAL to ensure that changes in the return is buffered properly also. I have no worries about changes to the underlying database causing a negative impact on the code above it.
Guffa wrote:
This is exactly what layering the application is meant to prevent.
Layering an application is meant to decouple the various parts of an application. My application is very well decoupled. My DAL/DAO class knows nothing about the business layer and it will never need to. The business layer knows nothing about the backend database and it will never need to. The DAO/DAL classes are the interface into the Data Layer - some people consider them part of the Data Layer as they operate at the boundary between the data and the business layer. The design of my application means that, since my code only ever interacts with the abstract base class, the concrete class can speak to SQL Server, Access, Oracle, MySql or whatever - the factory class decides which needs to be instantiated.
Guffa wrote:
So, either layer the application propely, or not at all.
As I've explained, it is properly layered. Crade-to-grave naming does not mean that coupling increases, it is just a technique to improve the quality of code and reduce maintenance time and costs.
I hope this helps explain my architecture and that I am quite well aware of how to design applications properly. I won't say that it is perfect as I've never found a perfect example of a design as there are always trade offs due to some limitation or another. But I will say that it is a design that I would expect to hold up against many future cycles of development as it moves and changes due to changing business requirements.
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
So your application is so decoupled that you decided it needed to be more coupled?
Well, the information you could get from the method parameters is just not enough to create the parameters. For an example, a string doesn't have a specified maximum length, but a varchar field in the database does.
---
b { font-weight: normal; }
|
|
|
|
|
I was just looking for a way to transfer the parameters passed into the method to parameters to the Stored Procedure. The method is just a proxy to the stored procedure, everything is passed straight through with no real processing. This is not coupling the layers together. It is using the surrogate pattern (see Design Patterns: Elements of Reusable Object Oriented Software by Gamma et al.)
For example at the moment I might have a method in my DAO assembly that looks like this:
public bool InsertData(int id, string name, int someValue)
{
SqlParameter[] spParams = new SqlParameter[3];
spParams[0] = new SqlParameter("@id", id);
spParams[1] = new SqlParameter("@name", name);
spParams[2] = new SqlParameter("@someValue", someValue);
int result = (int)SqlHelper.ExecuteScalar(ConnectionString,
CommandType.StoredProcedure, "InsertData", spParams);
return result==1;
}
As you can see all that is happening is that there is a stored procedure with exactly the same signature (only in SQL) and my DAO class is acting as a proxy or surrogate for the Stored Procedure so that I can layer my application properly and don't have lots of SQL calls dispersed randomly throughout my code.
All I wanted was to see if there was some automated mechanism to transfer the parameter values passed into the method to Stored Procedure without having to manually build up a SqlParameter array.
Now, obviously, if there isn't such a mechanism then that's fine - I just have a bit more work to do for each Stored Procedure.
Guffa wrote:
Well, the information you could get from the method parameters is just not enough to create the parameters
As you can see from my example above, all I need is the name of the parameter and its value. You don't NEED to put in other information.
Guffa wrote:
a string doesn't have a specified maximum length, but a varchar field in the database does.
That isn't of concern the business rules prevent bad data getting through. The Stored Procedures also do their own sanity checks. The EXECUTE permissions on the Stored Procedures will only allow certain users to access them. Users cannot access the tables directly and must go through stored procedures.
As you can see I have thought a lot about the design of the application to ensure that it is properly decoupled and that bad data gets stopped as early as possible, but there additional checks in place to catch anything bad that might get through. I am also constantly refactoring the application to improve the ability to maintain it and improve security.
Are you happy yet that I am actually a competent developer and that I just wanted my original question answered rather than enter into a discussion about my abilities to design an application properly?
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
Colin Angus Mackay wrote:
As you can see from my example above, all I need is the name of the parameter and its value. You don't NEED to put in other information.
No, you don't need to. But then the provider has to do an extra round trip (or several?) to the database to query for the data type to use for each parameter.
Colin Angus Mackay wrote:
Are you happy yet that I am actually a competent developer and that I just wanted my original question answered rather than enter into a discussion about my abilities to design an application properly?
I have never questioned your ability to design an application, I have only pointed out where the method seems to break the entire basis of application layering. I didn't mean to offend you, the answer was only based on you initial question, and what people usually try to do when asking things like that.
---
b { font-weight: normal; }
|
|
|
|
|