|
Well, everytime I've scanned uses the "traditional" method. From any Office application, Paint Shop.... so I don't think it's so bad for scanning.
There's an article here I saw a few days ago about using DirectShow to capture images from a webcam. I quickly searched for it but I couldn't find it. Maybe if you searched more deeply.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
The following code crashes when I try to pass an image
______________________________________________________________________________
private void zoomin_Click(object sender, System.EventArgs e)
{
dxfviewer.Image =ScaleByPercent(dxfviewer.Image,50);
}//end function
static Image ScaleByPercent(Image imgPhoto, int Percent)
{
float nPercent = ((float)Percent/100);
int sourceWidth = imgPhoto.Width; //with is null when passed this way
int sourceHeight = imgPhoto.Height;
int sourceX = 0;
int sourceY = 0;
_____________________________________________________________________________
Any thoughts on why this happens.
Thanks
|
|
|
|
|
Reanalyse wrote:
imgPhoto.Width; //with is null when passed this way
You need to add code to check if imgPhoto is null then, in which case, you have no image to scale and need to just return null.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
How do you refer to a control that belongs to a different class within the same namespace?
I have two classes one is named Form1 and the other is named MyClass.
I created a RichTextBox in Form1 and set it's access to Public
When I try to refer to it from within MyClass like so:
Form1.richTextBox1.Text = "";
It tells me that i need to create a reference. How can I do this without setting the control to be a static control?
|
|
|
|
|
The problem is that unless the form is visible, the richTextBox is null, it gets created as the form is created. You should name it something meaningful, make it private, and add a public property for the string. Then in your initialisation code, set the text to equal the value of that string.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
in source code you type( using calasename)
then let you to use public object in calss
|
|
|
|
|
You have to create an instance for Form1, and then access the control.
Form1 form = new Form1();
form.richTextBox1.Text = "whatever!"; You don't pick a color for Ferrari cars. You pick a color for *one particular* Ferrari.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
Hi,
I am wanting to create a Treeview Thread for loading the tree. I tried just calling the procedure that loads it and I got a control invoke issue. I have never created a thread before so I am looking for a sample if possible.
Thanks
Stephen
|
|
|
|
|
StephenMcAllister wrote:
I tried just calling the procedure that loads it and I got a control invoke issue.
Controls should be manipulated in the application thread. At best, you can load your data into an in-memory table or some sort of structure using a thread, then populate the tree in the application thread.
Marc
MyXaml
Advanced Unit Testing
YAPO
|
|
|
|
|
There's somenthing you can do. I've not done it, but I'm thinking it might be possible.
You can see this article[^] but the main steps are something like this:
public delegate void AddTreeNodeHandler(TreeNode node);
...
void myAddTreeNode(TreeNode node)
{
treeView.Nodes.Add(node);
}
...
MyThread t = new MyThread(treeView, new AddTreeNodeHandler(myAddTreeNode));
Thread t = new Thread(new ThreadStart(t.ThreadMain));
t.Start();
...
class MyThread
{
Control ctl;
AddTreeNodeHandler atn;
void MyThread(Control ctl, AddTreeNodeHandler atn)
{
this.ctl = ctl;
this.atn = atn;
}
void ThreadMain()
{
while(all nodes you need to add)
{
TreeNode node = new TreeNode("text");
ctl.BeginInvoke(atn, new object[] { node });
}
}
}</code> I did it all from the top of my head, without checking docs, and obviously without compiling it, so it might have some mistakes. But it's a good start for what your trying to do.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
|
Hey!
I am looking for some performance gain in my program.
I have a textbox that shows incomming data, this textbox can be set to any size.
Will the textbox take any performance even if its only 5 height and is coverd by an other control, shold i Hide it instead?
BestRegards
SnowJim
|
|
|
|
|
Snowjim wrote:
Will the textbox take any performance even if its only 5 height and is coverd by an other control, shold i Hide it instead?
I honestly can't imagine that this would have even a measurable impact on performance. Even if you're updating the textbox continuously, the OS should only place one repaint message in the message queue. And the screen rendering is often hardware accelerated nowadays. Your best alternative is not to update the textbox at all, or look for other performance improvements.
Why do you think changing the textbox size will have an impact? Have you done any testing that shows some improvement? I'm truly curious.
Marc
MyXaml
Advanced Unit Testing
YAPO
|
|
|
|
|
Quite simply just what the title says.
What i want to do is have all of my files built into the app, but i cant seem to play a music file from the resources so i want to move it to a temporary folder, play it there, then delete it when im done.
|
|
|
|
|
Fine leave me to die... I'll just come back to haunt you, HAUNT YOU ALL I SAY
|
|
|
|
|
Hi,
When my file is right clicked, under the version tab,there are details like file version & language. May i know how to retrieve these details of that file in C# program(without right clicking)
|
|
|
|
|
what kind of file? If it is .NET assembly - reflection. If not, it's Win32 resource (IIRC)... I don't know how to get it from executable... but PE is documented format, right? must be on the web...
e.g here[^]
David
Never forget: "Stay kul and happy" (I.A.)
David's thoughts / dnhsoftware.org / MyHTMLTidy
|
|
|
|
|
I need to find for the files such as bootstrap.exe or instmsiw.exe-installer for the windows installer
|
|
|
|
|
|
|
First question - I've run into what appears to be a very odd behavior. I create a custom type converter based on ExpandableObjectConverter. Assign it to a class using the TypeConverter attribute. Nothing happens - the PropertyGrid displays the property disabled and extracting PropertyDescriptor for it I can see that the converter field is null. What is going on here ? Why was the custom converter not assigned? For a sanity check - if I set the converter to be the base ExpandableObjectConverter then it works fine and the converter is properly assigned.
All the classes are contained within one source file. Perhaps there is some order of instantiation problem going on?
Second question - how do I modify property attributes at run-time? For instance on certain occasions I would like to disable certain properties ( or, if possible - prevent them from being shown in the grid at all ). I can find PropertyDescriptors for each property but all the fields I'm interested in are read-only.
Thanks for any help!
Disclaimer: I'm farily new to C# so excuse my ignorance if the above questions are trivial or just plain dumb
|
|
|
|
|
Hey!
I have the following XML containt
<br />
-<br />
<settings><br />
<Port>0</Port><br />
<StopBits>4</StopBits><br />
<Parity>2</Parity><br />
<BoudRate>9</BoudRate><br />
<DataBits>4</DataBits><br />
<AddTimeStamp>True</AddTimeStamp><br />
<SaveToFile>True</SaveToFile><br />
<SizeOfWindow>MEDIUM</SizeOfWindow><br />
<MountedDisplay>True</MountedDisplay><br />
</settings>
I am using this C# code to fetch it:
<br />
xTR = new XmlTextReader("PortSettings.xml");<br />
xTR.MoveToContent();<br />
<br />
while (xTR.Read())<br />
{<br />
if (xTR.NodeType == XmlNodeType.Element)<br />
{<br />
switch (xTR.Name)<br />
{<br />
case "Port":<br />
MessageBox.Show("Port : " + xTR.ReadElementString("Port"));<br />
break;<br />
case "StopBits":<br />
MessageBox.Show("StopBits : " + xTR.ReadElementString("StopBits"));<br />
break;<br />
case "Parity":<br />
MessageBox.Show("Parity : " + xTR.ReadElementString("Parity"));<br />
break;<br />
case "BoudRate":<br />
MessageBox.Show("BoudRate : " + xTR.ReadElementString("BoudRate"));<br />
break;<br />
case "DataBits":<br />
MessageBox.Show("DataBits : " + xTR.ReadElementString("DataBits"));<br />
break;<br />
case "AddTimeStamp":<br />
MessageBox.Show("AddTimeStamp : " + xTR.ReadElementString("AddTimeStamp"));<br />
break;<br />
case "SaveToFile":<br />
MessageBox.Show("SaveToFile : " + xTR.ReadElementString("SaveToFile"));<br />
break;<br />
case "SizeOfWindow":<br />
MessageBox.Show("SizeOfWindow : " + xTR.ReadElementString("SizeOfWindow"));<br />
break;<br />
case "MountedDisplay":<br />
MessageBox.Show("MountedDisplay : " + xTR.ReadElementString("MountedDisplay"));<br />
break;<br />
default:<br />
break;<br />
}<br />
}<br />
}<br />
xTR.Close();<br />
Problem: It only read Port, Parity, DataBits, SaveToFile and Monted Display. With other words its only reads every other.
Probley this is a simple mistake, pleas help.
Best Regards
SnowJim
|
|
|
|
|
tries the XML file again
<br />
<?xml version="1.0"?><br />
<!--Settings for TerminalSoftware--><br />
<!--By Changing this settings manually could result in instability. <br> This XML file is generated from TerminalSoftware.saveProgramSettings()--><br />
<br />
<settings><br />
<Port>0</Port><br />
<StopBits>4</StopBits><br />
<Parity>2</Parity><br />
<BoudRate>9</BoudRate><br />
<DataBits>4</DataBits><br />
<AddTimeStamp>True</AddTimeStamp><br />
<SaveToFile>True</SaveToFile><br />
<SizeOfWindow>MEDIUM</SizeOfWindow><br />
<MountedDisplay>True</MountedDisplay><br />
</settings>
I know that there is nothing wrong with the XML, it should be the C# code.
|
|
|
|
|
There most be a simple explenation for this, and how to solve it? Else XML will be as good as regular text file in this case.
SnowJim
|
|
|
|
|
Im not 100% sure but I think the ReadElementString function also calls Read internally. Thus every call of this function will result in making the reader moving forward twice.
You could do something like this (although there is probably a more elegant solution):
xTR = new XmlTextReader("PortSettings.xml");
xTR.MoveToContent();
ArrayList neededElements = new ArrayList();
neededElements.Add("Port");
neededElements.Add("StopBits");
neededElements.Add("Parity");
neededElements.Add("BoudRate");
neededElements.Add("DataBits");
neededElements.Add("AddTimeStamp");
neededElements.Add("SaveToFile");
neededElements.Add("SizeOfWindow");
neededElements.Add("MountedDisplay");
while (xTR.Read())
{
if (xTR.NodeType == XmlNodeType.Element)
{
if (neededElements.Contains(xTR.Name)) {
MessageBox.Show(xTR.Name + " : " + xTR.Value);
}
}
}
xTR.Close();
(I only added the ArrayList thing to keep the code short )
|
|
|
|