|
Hi!
I want to draw a Map for a Webgame (C#, VWD 2005 EE). I draw Lands, units...
But unfortunatly the borders of the String are not "clearly", good, drawn, as you can see at the link of the german csharp forum. There is a picture where you can see what I mean.
http://www.mycsharp.de/wbb2/thread.php?threadid=13557[^]
So I create the Graphics Device.
G_WorldMap = new Bitmap(3500, 2000, PixelFormat.Format32bppArgb);<br />
Graphics newBmpGraphics = Graphics.FromImage(G_WorldMap);<br />
So I draw the strings
foreach (Land land in G_Game.Lands.LandsAL)<br />
{<br />
Font font = new Font("Comic Sans MS", 10);<br />
SizeF stringSize = newBmpGraphics.MeasureString(land.Name, font);<br />
newBmpGraphics.DrawString(land.Name, font, new SolidBrush(Color.Black),<br />
new Point(land.CenterX - (int)(stringSize.Width / 2), land.CenterY - (int)(stringSize.Height / 2)));<br />
<br />
font = new Font("Courier", 12, FontStyle.Bold);<br />
stringSize = newBmpGraphics.MeasureString(land.Id.ToString(), font);<br />
<br />
newBmpGraphics.DrawString(land.Id.ToString(), font, new SolidBrush(Color.Black),<br />
new Point(land.CenterX - (int)(stringSize.Width / 2),<br />
3 + (int)stringSize.Height + land.CenterY - (int)(stringSize.Height / 2)));<br />
}<br />
Any ideas ?
lg ifoko
|
|
|
|
|
Set the graphics objects quality settings before drawing to it: (I used G where you have newBmpGraphics)
Graphics G = Graphics.FromImage(bmp);<br />
G.PageUnit = GraphicsUnit.Pixel;<br />
G.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;<br />
G.CompositingQuality = CompositingQuality.HighQuality;<br />
G.CompositingMode = CompositingMode.SourceCopy;<br />
G.TextRenderingHint = TextRenderingHint.SingleBitPerPixelGridFit;<br />
G.InterpolationMode = InterpolationMode.High;
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
|
|
|
|
|
Thx a lot, it is better now.
There is some "interpolation" at borders from the strings and the polygons, which I want to turn off complete.
A new picture is at http://www.mycsharp.de/wbb2/thread.php?postid=72430#post72430[^]
Do you have a link where I can read (good explained) what setting has which effects ? Example ?
lg ifoko
|
|
|
|
|
Best I can suggest is to refer to the MSDN help for the valious properties, or do what i did and pay around with the possibilities until you find the combination you like.
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
|
|
|
|
|
Thx
Now I work with the png format and it works fine.
New screeni at www.axamit.at (3MB)
lg ifoko
|
|
|
|
|
Hi
I want to develop an Intelligent Agent in .NET environment. I want to know that is there any support for Agent Technology in .NET like Agelets in Java? If not. Then What can be its possible solution? I am not talking about the user interface like MSAgent control.
Thanks for your time
Bye
|
|
|
|
|
What's your definition of "Agent Technology"?? Jade?
If so, then no, there isn't that I can find. But that won't stop you from writing one anyway.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Yes, something like JADE. What other possiblities are there to solve such problem? If someone do not want to write JADE in .NET.
|
|
|
|
|
There are none that I know of. You'd have to write your own "JADE" library for .NET.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Issue/Requirements:
1. Use an SQL database to store text and MS Word documents
Data Source: Desktop
Initial Catalog (Database Name): BLOB
Table Name: tblBLOB
'Maybe some other columns will be added for later use.
Columns: BLOBID, BLOBName, BLOBDescription, BLOBDocument
2. Use Microsoft Visual Basic .NET to retrieve the information/documents
From Name: Form1.vb
Text Boxes: txtBLOBID, BLOBName, BLOBDescription
Picture Box: BLOBDocument
In the past I used MS Access and its internal forms to display the OLE Objects (MS Word documents) embeded (linked) into the table. However, I would like to start using an SQL Database and use an application to retrieve the BLOB
3. Functionality of the .NET form.
I would like to use the form to (1) retrieve and display a picture of the MS Document. (2) Search the SQL database for documents based on the BLOBDescription and or other fields. (3) Add new documents into the tblBlob. (4) Have basic database functions: NEXT, PREVIOUS, ADD, DELETE buttons.
i Have a majority of this complete (ie, the SQL database, The .NET form, but I just can't get the two to work together to insert a new document, and or view a new document.:->
Completely lost
John Rodriguez
Thank you all for your knowledge and help.
|
|
|
|
|
It's likely that the picturebox control is NOT going to render the word document like the Access Ole contro did. PictureBoxes understand graphics images, not ole documents. You will probably have to use word interop or something similar to render the document...
This post might get better expertise in the SQL/ADO forum...
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
This post might get more a
|
|
|
|
|
Thank you for the quick response.
What about using a unbound or bound object? Is there any work arounds? This is a link to what I've been attempting to put togther but no luck in following the code.
http://www.xtremevbtalk.com/showthread.php?t=239178&highlight=document+database
OR
http://www.xtremevbtalk.com/showthread.php?t=173268
John
|
|
|
|
|
Perhaps this [^]will help.
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
|
|
|
|
|
I try to run my C# application from a network drive and I get a Security Exception saying: "Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."
Why does this happen? what should I do?
|
|
|
|
|
CAS (Code Access Security) at work You need to increase the trust level for assemblies that load off the network drive. See this[^] link to know how to do that.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
I am doing a design where there is a menu of actions that the user can perform. This isn't about the user interface part. It is about the logic part. I've got a 3-teir architecture going and there are classes in the business logic layer that define what actions are available at a particular time. But there is a problem. I've discovered that there are 3 types of action, although there are many more actions than this. Some actions are optional (the user can choose whether or not to take those actions), some actions are mandatory (the user must take that action before a certain point. Before that point they may choose certain other optional actions, but not others), finally, there are potential actions (these are actions that the user has potentially available to them, but they must satisfy some other condition first before they can take that action. Some of those potential actions are optional and some are mandatory).
So far I have an action class. I also have a potential action class, and a mandatory action. The potential action class contains a field which is an action object. The mandatory action class is an abstract base class. The actual actions derive from either the action itself, or the mandatory action class.
What I am trying to do is keep coupling to a minimum, but I'm having problems with it. I also have a controller class that contains a list of the actions, this list is passed to the user interface. They user gets to see all the actions. However, if they pick a potential action where the condition is not met they get a message telling them what they need to do in order to take that action. The action of the potential action is to generate the message.
I don't know if I'm explaining myself very well. I guess that is part of my problem. If I could explain it well, I would understand it enough not to need to ask the question.
Any ideas would be welcome.
|
|
|
|
|
Andy MacAngus wrote: I've got a 3-teir architecture going and there are classes in the business logic layer that define what actions are available at a particular time.
So the actions that are mandatory and optional change over time? For example, an action that is optional at one point in time can become mandatory later? Can you model this as a state machine? Each state is responsible for providing a list of actions that are mandatory, optional, etc.
|
|
|
|
|
Leslie Sanford wrote: So the actions that are mandatory and optional change over time? For example, an action that is optional at one point in time can become mandatory later?
Not exactly, but I think this is probably going in the right direction.
The states are:
* Optional
* Potential, but optional
* Mandatory
* Potential, but mandatory
Potential meaning that a certain condition must be met first. Any potential action can transition to plain optional or mandatory. Certain actions are, by necessity, potential while there is a mandatory action available as the condition to be met is the invokation of the mandatory action.
I will look in to state machines, but I have to admit to not having read much about them. I'll look for some information on it. If you know of a good article to read on the subject I'd be grateful for a recommendation.
Cheers.
|
|
|
|
|
Andy MacAngus wrote: The states are:
* Optional
* Potential, but optional
* Mandatory
* Potential, but mandatory
Potential meaning that a certain condition must be met first. Any potential action can transition to plain optional or mandatory. Certain actions are, by necessity, potential while there is a mandatory action available as the condition to be met is the invokation of the mandatory action.
What I was thinking is that you could have a list of all actions, maybe represent these actions as an enumeration. Your application has a number of discrete states. Each state understands which actions are optional, potential, etc. You could possibly store this information in some kind of lookup table.
Anyway, my point is to not look necessarily at the actions as states, but rather have states that know what actions are mandatory, optional, etc.
Also, if some actions are mandatory, you could have a state execute them regardless of whether the user has selected them. In your UI, you could make sure the right radio buttons, check boxes, or whatever are selected programmically (and maybe switch to readonly so they can't be deselected).
I could go on and on. Hope this has given you some ideas.
Andy MacAngus wrote: I will look in to state machines, but I have to admit to not having read much about them. I'll look for some information on it. If you know of a good article to read on the subject I'd be grateful for a recommendation.
You may find Part I[^] of my State Machine Toolkit articles helpful.
Here is an article[^] describing finite state machines and UML statecharts.
And an article[^] by H. S. Lahman. One of my personal heros and a regular on comp.object.
|
|
|
|
|
There is method called CopyTo(src_start,dst,dst_start, length) in class String. While dst is a Char or __wchar_t array. What will be the best way to Copy part of First String to another String? For example, String *Str=S"dirName/filename", I would like just take the file name so I start copy from 8 from Str to another Char dst[]. But dst is not String instance.
Any better ideal? Thanks
|
|
|
|
|
System.IO -> file.* has all proper methods to parse any string like this...
Mikail Çetinkaya . The C# DEveloper
|
|
|
|
|
Let me solve the problem by myself to see if it is correct
Char str1[]={' ', ' ',' ', ' ',' ', ' ',' ', ' ',};
String* str2 =S"Long String";
str2->CopyTo(5, str2, 0, 6);
String* fileName= __gc new String(str);
Then fileName will be "String"-- which is part if str2.
|
|
|
|
|
How can I either detect that the onscreen keyboard has popped up and resize/rearrange my form elements, or have the form autoresize when the keyboard is displayed.
Right now my input field is hidden underneath the keyboard.
Andreas
|
|
|
|
|
u can get the proper windows handles of all app windows that are loaded on desktop by a series of activeDesktop api functions; refer to this function 's owner api doc for details
Function GetForegroundWindow Lib "user32.dll" () As Long
Function GetDesktopWindow Lib "USER32" () As Long
Mikail Çetinkaya . The C# DEveloper
|
|
|
|
|
Dear all,
I am a University Student. I am doing research on Web Service. My Topic is sending SMS, Short Message Service From Within My PC. Now, I got a problem of sending SMS using .NET Framework. Could please anyone giving me some ideas or sending my some code sample????
Thank you in advanced.
CamMan
|
|
|
|
|