|
hey guys.. i'm trying to make a comic strip creator application in c#.. it involves character creation so that the users can customize the characters that they want to put in their comic strip.. just imagine the character/avatar creator that we see in the internet.. that's what i'm trying to do.. my problem is that i don't know what approach am i going to use for this part of my program.. i tried using picture box and merging the combination that was chosen as a single image but i can't do it.. and i think that approach was wrong too.. this is my first time to make an application that involves image manipulation so i really need suggestions on how to do this..
and also, is it possible to insert images using the paint event??
|
|
|
|
|
strife19 wrote: and also, is it possible to insert images using the paint event??
Yes, I would recommend using the paint event and a panel.
So I am assuming you have a load of images (for each part of the character) that you want to effectively place on top of each other?
Create a number of Class Level Image Objects...
Image Hair;
Image Face;
Image Body;
Set the Images with whatever method you want, example...
Hair = ImageListHair.Images[2];
PanelMain.Invalidate();
Then in paint event draw them on the panel...
void PanelMainPaint(object sender, PaintEventArgs e)
{
e.Graphics.DrawImage(Body, xPos, yPos, width, height);
}
...Hope that makes sense?
This is a very basic idea, you could, and probably should, have a Character class with properties for each of the different body parts and a method that draws the character by taking a Graphics object as a parameter.
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
thank you for your suggestion.. i will try this approach right away and post whatever the outcome is..
|
|
|
|
|
Hi
I need to capture screenshots from DirectX games. I am using this code but sometimes I get totally blank images or the image of the desktop (but the game is open)
int screenWidth = Screen.GetBounds(new Point(0, 0)).Width;
int screenHeight = Screen.GetBounds(new Point(0, 0)).Height;
Bitmap bmpScreenShot = new Bitmap(screenWidth, screenHeight);
Graphics gfx = Graphics.FromImage((Image)bmpScreenShot);
gfx.CopyFromScreen(0, 0, 0, 0, new Size(screenWidth, screenHeight));
bmpScreenShot.Save("test.jpg", ImageFormat.Jpeg);
I really need help.
Thanks.
|
|
|
|
|
|
I have seen that code but I thought it was to use on your own DirectX application to save a screenshot of your own DirectX application.
Can you tell me how to use that code?
Thanks.
|
|
|
|
|
|
Thank you, I am looking into those links.
|
|
|
|
|
Please let the forum and I know if any of those helped; that way if the question comes up again we can reference those links.
Thanks!
leckey
|
|
|
|
|
None of those links worked.
|
|
|
|
|
Hi
I made a window service application and I used system.timers.timer class . I set timer interval from config file. I would like to fire timer as specified interval in config file. It works fine but while running the windows service I want to change timer interval in config file and timer should be fired at latest interval . When I stop the service and restart the service then timer fire as specified value in config file.
Pseudo code
private System.Timers.Timer timer2 = new System.Timers.Timer();
protected override void OnStart(string[] args)
{
// dblValue = 30000
double dblValue = Convert.ToDouble(ConfigurationManager.AppSettings.Get("Interval"));
timer2.interval = dblValue
timer2.Elapsed += new System.Timers.ElapsedEventHandler(timer2_Elapsed);
timer2.Enabled = true;
}
void timer2_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
timer2.Enabled = false;
// doing some operation
// Now I want to change the value in config file like dblValue = 60000
double dblValue = Convert.ToDouble(ConfigurationManager.AppSettings.Get("Interval"));
timer2.interval = dblValue
timer2.Enabled = true;
}
but timer always fired after 30000 milliseconds. But I want , timer should be fired after 60000 milliseconds , means latest value define in config file. Please tell me how to do this ?
Regards
Rajesh
rajesh
|
|
|
|
|
Its because config files are only read once and then cached.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
Write your own config system and read it on each cycle.
Personally, I use a database for that.
|
|
|
|
|
Thanks.
I have created an xml file and stored interval . While running the windows service interval is set well through xml.
Regards
Rajesh
rajesh
|
|
|
|
|
Hello I'm beginner in c# and I'm working on a small application and my problem is that I have put a TextBox in my application form which I need to set a font a font that I have downloaded, it means that it's not in the C:\Windows\fonts directory, how I'm going to do please help me
Thank you .
modified on Wednesday, July 29, 2009 7:21 AM
|
|
|
|
|
|
Hello "stancrm" Thanks for the answer but I'm steel have a problem which is when I try to play the application on an other PC I'll be obliged to do the same thing (copying the font into C:\Windows\fonts) which isn't really a good solution , is there any better idea? thanks a gain
|
|
|
|
|
If you see the "big" application, like coreldraw or adobe photoshop, they copy also custom fonts to c:\windows\fonts.
I think, it is the best solution, instead of drawing your own fonts and write lot of own codes.
|
|
|
|
|
Ok I think I got it and I'll try it thank you stancrm
|
|
|
|
|
made in 44 wrote: set a font a font that I have downloaded
Go to the location where you saved the font to and copy it into the Windows Fonts directory after scanning it for viruses etc.
Now that that's done. Inside the properties pane for the TextBox control, you should be able to open the list and see your new font.
Regards,
Jason Pezzimenti.
If you liked the answer that I have provided, then please click the 'Good Answer' link on the bottom-right of this post. Thank you.
|
|
|
|
|
You can access the Exists method of System.IO.File class directly like so:
bool fooExists = System.IO.File.Exists("C:\foo.txt");
I have created a class that has a method in it that logs an exception to an XML file, such as:
namespace Matt.Clarkson
{
using System;
using System.IO;
using System.Xml;
using System.Security;
using System.Windows;
public class ExceptionLogging
{
public bool LogException(Exception ex)
{
[code for logging file]
}
{
}
I can access this fine with the following code:
Matt.Clarkson.ExceptionLogging foo = new Matt.Clarkson.ExceptionLogging();
try
{
System.IO.Path.GetDirectoryName(">?|>FDA{}{}!@'#~¬");
}
catch (Exception ex)
{
foo.LogException("Epic Fail", ex);
}
But I cannot do:
Matt.Clarkson.ExceptionLogging.LogException("Epic Fail", ex);
I understand why I cannot do the above line of code but how can i structure my classes/namespace so that i can use methods like in the .NET framework File.Exists example above. I have no need to create a new ExceptionLogging class as I just want the method inside.
I know that the above method could just be the constructor of the class but I am looking to understand the way to do this structure.
I would love to read a tutorial on this subject but I'm not even sure what this falls under?
Thanks for any help,
Regards,
Matt Clarkson
|
|
|
|
|
public static class ExceptionLogging
{
public static bool LogException(Exception ex)
{
[code for logging file]
}
}
|
|
|
|
|
|
To extend the previous answer, you do not need to decvlare the class as static, only the method.
The usage rules are very simple, an object can call any static, or class, methods but class methods can only call instance methods of passed references.
An object can reference class variables; there is a single instance of a class variable shared by all of the instances.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Dear Experts,
I want to develop an instant messaging software for LAN, like YPressChat, I'm new to socket programing in c#. Is there any example or any help or any idea about??
thanks in advance
|
|
|
|