|
If it's a Canon, read my article on the Canon SDK. Otherwise, WIA is your best bet.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
It's Sony, WIA hmmmmm
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
I had write this code to do drag and drop at window form panel. How can i do the reorder panel because this code only to do drag and drop?
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace CMSMS
{
public class mypanel:System.Windows.Forms.Panel
{
private bool isDragging=false;
public int x,y;
protected override void OnMouseDown(MouseEventArgs e)
{
base.OnMouseDown (e);
isDragging = true;
x = e.X;
y = e.Y;
}
protected override void OnMouseUp(MouseEventArgs e)
{
base.OnMouseUp (e);
isDragging = false;
}
protected override void OnMouseMove(MouseEventArgs e)
{
if (isDragging == true)
{
this.Left= e.X + this.Left - x;
this.Top = e.Y + this.Top - y;
}
}
}
}
|
|
|
|
|
Hello everyone,
I am trying to save some data of type (Int & String) into a CSV file. I am able to save one set of data. But I need to open the priviously created CSV file which already contains some data and save some more data into it.
Can someone be kind enough to tell me how I can achieve this please?
The following is the code that I am using for this:
FileStream sb = new FileStream("MyFile.txt", FileMode.OpenOrCreate);
sw.Write(userName);
sw.Write(",");
sw.Write(userSureName);
sw.Write(sw.NewLine);
sw.Close();
Thank you very much and have a great day.
Khoramdin
|
|
|
|
|
For god's sake people, stop asking this CSV question! I see it almost everyday
Why don't you try to search in the posts instead, I bet you will find millions of it
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Hello Muammar,
You need to cut down on Coca Cola, mate! Those stuff seems to get you far too hyper.
If I am not mistaken this is a Message Board and people are Free to ask question as long as they don't get too sexual or emotional. Lucky for people like me who are learning and not afraid of asking; there are knowledgeable and kind people, unlike you, whom are happy to take a moment and teach.
I guess that explains why some of my teachers sucked and some others were exceptional and made a long lasting impression.
Any ways, just stay way from Coca Cola and I am sure everything is going to work out just fine, mate.
Have a great weekend.
Khoramdin
Ps. There is a movie called "Pay it forward". I suggest you to rent and watch it.
|
|
|
|
|
.. I hope you found what you're looking for though!
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Hello Muammar©,
I am sure I will, mate. Just don't let little things gets into you.
By the way, can you be more specific with your question about Camera pix. I think I have the answer to your question. Just would like to be sure I can give you what it is you are looking for, mate.
Have a great weekend.
Khoramdin
|
|
|
|
|
Khoramdin wrote: I am sure I will
Good!
Khoramdin wrote: about Camera pix
oh, thanks, but don't worry, I think I found something.
Have a nice weekend too.
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Use FileMode.Append .
"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." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hello Stefan,
Thanx for the help. you are correct. That was the problem and I am very greatful for your help.
have a great weekend.
Khoramdin
|
|
|
|
|
Have you thought about using StreamWriter instead of FileStream ?
Although similar results can be achieved with both, It is specifically designed for writing text into streams.
See this: http://msdn2.microsoft.com/en-us/library/system.io.streamwriter.aspx
Following your example, the code would be something like:
StreamWriter sw = File.AppendText( FileName );
sw.WriteLine( "{0},{1}", userName, userSureName );
sw.Close();
The above code would append or create the file if it didn't already exist.
Does this help?
Regards
Wayne Phipps
____________
Time is the greatest teacher... unfortunately, it kills all of its students
View my Blog
|
|
|
|
|
Hello Wayne,
Thanx so taking the time and help, mate. I tried your suggestion and it work.
I am very greatful for the help.
Have a great weekend.
Khoramdin
|
|
|
|
|
iam working in c#2005 desktop application
i have data grid that fill with data one column is date column when i click the row it's fill comboboxs and textboxs with selected row data i need to take the date from date column and change the date in datetimepicker
i write that code but it generate error why
**********************************************************
dateTimePicker1.Value = Convert.ToDateTime(dataGridView1[2,rowno].Value.ToString());
***********************************************************
ma_refay
|
|
|
|
|
ma_refay wrote: i write that code but it generate error why
What error?
By the way, what do you mean by date column; do you store string representations of dates or DateTime objects. In case of the latter you could directly assign them to the DateTimePicker without turning them into a string representation and then reparsing to a DateTime object.
"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." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hi,
I'm a newbie and am working on this project for about a week now. I need to create a Dog class where the user will be able to interact with the class using "Pet (dog not angry), Tease(dog angry), Feed(dog not hungry), Age(dog hungry), GoToSleep(dog asleep) and WakeUp(dog not asleep).
This is the code in my Dog class
[CODE]
class Dog
{
private bool isHungry;
private bool isAngry;
private bool isSleeping;
public bool IsHungry
{
get
{
return isHungry;
}
}
public bool IsAngry
{
get
{
return isAngry;
}
}
public bool IsSleeping
{
get
{
return isSleeping;
}
}
public Dog()
{
isHungry = false;
isAngry = false;
isSleeping = false;
}
public void Pet()
{
isAngry = false;
}
public void Tease()
{
isAngry = false;
}
public void Feed()
{
isHungry = false;
}
public void Age()
{
isHungry = true;
}
public void GoToSleep()
{
isSleeping = true;
}
public void WakeUp()
{
isSleeping = false;
}
}
[/CODE]
I created buttons.
[CODE]
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public void pictureBox1_Click(object sender, EventArgs e)
{
}
public void buttonPet_Click(object sender, EventArgs e)
{
}
public void buttonTease_Click(object sender, EventArgs e)
{
}
public void buttonFeed_Click(object sender, EventArgs e)
{
}
public void buttonAge_Click(object sender, EventArgs e)
{
}
public void buttonGoToSleep_Click(object sender, EventArgs e)
{
}
public void buttonWakeUp_Click(object sender, EventArgs e)
{
}
}
[/CODE]
I have placed images of dogs in an image list but don't know how to proceed from here. How do I get the button to do what it is supposed to do and show an image? The images are as follows:
angry_dog.bmp
eat_dog.gif
happy_dog.jpg
sleep_dog.jpg
I also wrote the following code but have no clue where to put it. Right now it is in Program.cs under main.
[CODE]
Dog myDog;
myDog = new Dog();
myDog.Pet();
myDog.Tease();
myDog.Feed();
myDog.Age();
myDog.GoToSleep();
myDog.WakeUp();
[/CODE]
Please help.
|
|
|
|
|
apricotsun wrote: public void buttonGoToSleep_Click(object sender, EventArgs e)
{
}
This is an event handler. Assuming that myDog is a member variable ( declared inside a class, not inside any method, and therefore visible to all methods for this instance of this class ), you should do myDog.GoToSleep(); here. I trust you can see how this pattern would apply to your other methods/events.
apricotsun wrote: I have placed images of dogs in an image list but don't know how to proceed from here.
There are a number of controls that will show an image from an image list, they will take the image list and an index into the list. So, if you use such a control, you can just change the index in the control that shows the image, inside those event handlers.
An alternative is to add the images to your resources, and load them from there. Then you can just use a PictureBox and keep changing what image it shows.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Thank you. I will try that.
|
|
|
|
|
Picture box sounds like a great idea. How do I get it to change images when the appropriate button is clicked on?
|
|
|
|
|
Also, where do I declare myDog? I tried declaring it in the Dog class but that did not work. Then I tried declaring it under Main in the Program.cs but that did not work. Then I tried declaring it in the form itself and that did not work. Would I have to create another class for it? I'm sorry for asking so many questions. As I said I'm a newbie and want to learn.
|
|
|
|
|
I am confused. I want Windows to act like this: When the user double clicks the icon in Windows Explorer, it opens up the file my program opens with my program. But how do I set up my program so that this will happen? Thanks in advance.
|
|
|
|
|
C# does Shell, Part 2[^]
"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." - Rick Cook www.troschuetz.de
|
|
|
|
|
I am trying to add a tool bar using ToolStrip. When I run my application, the tool bar is correctly display, but once I get an OnPaint, I get red box with an X through it where the tool bar should reside. Here is my code.
ToolStrip toolStrip = new ToolStrip();
toolStrip.Parent = this;
ToolStripButton toolStripFileOpen = new ToolStripButton("Open", new Bitmap("openHS.png"), new EventHandler(MenuFileOpenOnClick), "Open");
ToolStripButton toolStripFileSave = new ToolStripButton("Save", new Bitmap("saveHS.png"), new EventHandler(MenuFileSaveOnClick), "Save");
toolStripFileOpen.DisplayStyle = ToolStripItemDisplayStyle.Image;
toolStripFileSave.DisplayStyle = ToolStripItemDisplayStyle.Image;
ToolStripSeparator toolStripSeparator = new ToolStripSeparator();
toolStrip.Items.Add(toolStripFileOpen);
toolStrip.Items.Add(toolStripFileSave);
toolStrip.Items.Add(toolStripSeparator);
Controls.Add(toolStrip);
|
|
|
|
|
Sounds like when you run it, it cannot file those png files. I'd suggest making them resources inside your program, or at least, copy them to the debug/release directories.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
The png files belonged to the project and were made an "Embedded Resource" so I don't think that is the problem. The funny thing is they are displayed fine until I get an OnPaint. I am missing something but I can't find a good reference on ToolStrip.
|
|
|
|