|
Hi,
I want to combine two drawings into one,and place in a line as show below
How to Upload pictures!!!
|
|
|
|
|
You need to provide a lot more detail about this problem: what sort of drawings, place on a line where ... ?
Use the best guess
|
|
|
|
|
Could you teach me how to upload pictures? I have no idea
|
|
|
|
|
What sort of pictures, and where do you want to upload them from and to? You really need to think about what problem you are trying to solve, and provide some more useful details.
Use the best guess
|
|
|
|
|
You are not allowed to upload pictures here. You should upload them to a free image hosting site and provide a link in your question. You also need to be a bit clearer in your question, as I don't think anyone understands what you are trying to get at. If your English is not so good, try use Google translate.
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
What format are the drawings in and how do you want to combine them?
|
|
|
|
|
The drawings are designed by AutoCAD(*dwg/*dxf). For each drawing document, there is only one drawing of A4 size. Now, I want to gather 2 drawing-files into a drawing file, so that ,I can preview the 2 drawings in a file at the same time.
|
|
|
|
|
Seems simple enough, and I have looked hard and found many code sources (because some here might say this has been asked and answered), but none of them seem to work (I am showing some below...there are more).
Teh primary error seems to be the following error (unable to cast object of type 'system.data.datarowview' to type 'system.string ) or something similar to this. It seems like I solved this problem a while ago by giving up on the check list box and using a list view box with the show checkbox property added, but I cannot find my original code. So, in a nutshell....I want to simply return the string values for the checked items in the control and add them to an array or arraylist (either will do). BTW...the checklistbox control was filled using an SQL query (shown also), in case that makes a difference. You guys have almost always come up with a solution of sorts, and I thank you again in advance for your great assistance and talent...Regards, Pat
//Query Code
ArrayList al = new ArrayList();
Conn.Open();
SqlDataReader dr = Comm.ExecuteReader();
if (dr != null)
while (dr.Read())
{
al.Add(dr[0]);
}
Conn.Close();
foreach(string s in al)
{
checkedListBoxServices.Items.Add(s);
}
|
|
|
|
|
using System;
using System.Windows.Forms;
using System.Collections.Generic;
namespace test
{
class Program
{
public static void Main(string[] args)
{
using (var f = new Form())
{
var tb = new TextBox()
{
Multiline = true,
Dock = DockStyle.Top,
Height = 50
};
var clb = new CheckedListBox() { Dock = DockStyle.Fill };
clb.Items.AddRange(new string[] { "One", "Two", "A half" });
clb.SetItemChecked(0, true);
clb.SetItemChecked(2, true);
f.Controls.AddRange(new Control[] { clb, tb });
foreach (var element in clb.CheckedItems)
{
tb.Text += ((string)element) + Environment.NewLine;
}
f.ShowDialog();
}
}
}
} "CheckedItems" will return the objects that are checked. If you throw strings in there, then it's strings that it returns. Otherwise, it'll return the object, and you'd prolly need to call the "ToString" method on that object or build a string of it's properties.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
YES YES YES YES YES YES YES YES ...........
Thank You Eddy...VERY Much...I'd be too embarrassed to tell you how much time I spent of this yesterday. The following is the actual code that I extracted from your sample to resolve this:
foreach (var element in checkedListBoxServices.CheckedItems)
{
textBox1.Text += ((string)element) + Environment.NewLine;
}
It seems that your use of the new context (var) replacing my use of string and then casting for the result later with (string) makes a big difference ... I need to look at this again to really understand it, but I know that I can thanks to you. Much appreciation and thanks...Best Regards, Pat
ps: after searching for this yesterday, and finding 'solutions' that were a page long and STILL did not work, I am sure that hundreds of others will be wanting the thank you as well for a concise usable solution... Pat
|
|
|
|
|
You're welcome 
|
|
|
|
|
Hi at all & tks in advance.
I wrote a class for manage backdata (data,error and so on) from a wcf which expose several and different function.
The scope is to make a same frame for back data.
This class are like this:
[DataContract(Name = "WS Back Data Frame",IsReference = true)]
[System.Serializable()]
public class WSBackDataFrame <C> where C : class
{
[DataMember]
public List<C> DataCollection;
[DataMember]
public bool IsOk
{
get { return this.FaultType == AppFaultType.NoFailure; }
private set { }
}
...
....
}
Now i declare exposed methods like this:
public WSBackDataFrame <Class_1> (....);
public WSBackDataFrame <Class_2> (....);
...
...
but i recived error for duplicated reference for WSBackDataFrame...
I've done a porting from WebServices to WCF ... in WebServices when i published the system created 2 different classes like
WSBackDataFrameofClass_1
WSBackDataFrameofClass_1
What is wrong in declaration?? What WCF expects?
tks and sorry for my bad english
|
|
|
|
|
anymalo wrote: but i recived error for duplicated reference for WSBackDataFrame...
During compilation? Sounds like you added the same class more than once, and that would confuse the compiler. Try renaming your class; if it works after that, you've got a copy of the class "somewhere" in your code.
anymalo wrote: WSBackDataFrameofClass_1
WSBackDataFrameofClass_1
When you mention "WSBackDataFrameofClass_1" in code, how would the compiler know which of those two classes you meant? Put them in a separate namespace to make them unique, or change on of the names.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Eddy Vluggen wrote: During compilation? Sounds like you added the same class more than once, and that would confuse the compiler. Try renaming your class; if it works after that, you've got a copy of the class "somewhere" in your code.
No, i have not specified.
The error appear on execution of wcf
Eddy Vluggen wrote: When you mention "WSBackDataFrameofClass_1" in code, how would the compiler know which of those two classes you meant? Put them in a separate namespace to make them unique, or change on of the names.
The reference file created by WBServices export this definition of those classes but in a prevoius prj that are not wcf(and it work!!!!).
I specified this only because i though wcf will be same behaviour...
modified 20-Mar-13 9:17am.
|
|
|
|
|
anymalo wrote: The reference file created by WBServices export this definition of those classes but in a prevoius prj that are not wcf(and it work!!!!).
Same problem; two classes with the samen namespace/classname in a single project will fail.
Also, the client would need a reference to the assembly containing the WBServices.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I have a very simple WCF service, :
<br />
[service contract]<br />
<br />
public class Service1 : IService1<br />
{<br />
<br />
List<int> m_list = new List<int>();<br />
<br />
public Service1()<br />
{<br />
for (int i = 0; i < 10; i++)<br />
{<br />
m_list.Add(i);<br />
}<br />
}<br />
<br />
<br />
[OperationContract]<br />
public string GetData(int value)<br />
{<br />
for (int i = 0; i < 4; i++)<br />
{<br />
Thread t = new Thread(() => simpleThread(i));<br />
t.Start();<br />
}<br />
return "text";
}<br />
<br />
void simpleThread(int i_in) <br />
{<br />
Trace.WriteLine(m_list[i_in].ToString());<br />
}<br />
<br />
}<br />
The code stores 0,1,2,3 as values inside m_list. So m_list[0] is 0, [1] is 1 .. [3] is 3.
And when we print it through "SimpleThread(int i)" Thread function, In the log it's supposed to be 0,1,2,3 but it's always like 2,2,3 or something weird. And the index passed in itself is wrong. It never passes 0,1. And sometimes it prints...
4 : 4
4 : 4
4 : 4
4 : 4
And the problem is random. I'm missing something very fundamental with threading on WCF. Any help please?
I would like to get it :
0 : 0
1 : 1
2 : 2
3 : 3
modified 20-Mar-13 3:24am.
|
|
|
|
|
Hi,
This is because environment is multithreaded. You need to add one more statement to let first thread complete and process on another. This is because you need your process in sequence.
Use
t.Join() to let first thread complete before second starts in your GetData function.
Thanks
-Amit Gajjar (MinterProject)
|
|
|
|
|
well, I don't think that's the reason because the reason for using threads here is _not_ to let it wait for the next call. Otherwise I would have made a simple for loop without threads right?
The loop is running too fast, before the thread function could pick up the variable's value.
If I put a Thread.Sleep(100) after each call, the sequence comes in the right order.
Just as a POC , try this on a C# console Application, it would put them in right order. As simple as that!
But I sense WCF requires something else, to persist the value of the passed variable. But No search helps.
|
|
|
|
|
There is difference between normal loop and using thread.
if you are using normal loop your application will hang till your loop completed. while in thread other thread will run and your application will not hang.
Thanks
-Amit Gajjar (MinterProject)
|
|
|
|
|
Yup, but still Thread.Join wouldn't let the control go past the function scope. It makes it wait there until the threads complete their execution. In short, it "BLOCKS" too.
|
|
|
|
|
Yes ofcourse it will block that thread execution. but it will not block others. let me know if that works for you.
As you have mention earlier you are using thread.sleep but why you need it ?
Thanks
-Amit Gajjar (MinterProject)
|
|
|
|
|
I removed it, I just tried "Sleep"ing to check if it's a Sync issue. Sleep helped to print the index in order, but misses the whole point of using threads. - need to run fast. And Sleep is just for debugging. never a solution, unless the BugFix-Priority-Column says "Fix Right NoW". 
|
|
|
|
|
For your knowledge, Thread is used when you do not want any task in sequence. if you need some task to be in sequence you need to use single threaded function. if you are doing thread.join() it will not degrade performance of your application, although it will impact on your current thread. at that time other thread will keep executing. First you need to decide if your current process is not meant to execute in sequence then you can defiantly use thread. hope this makes sense.
Thanks
-Amit Gajjar (MinterProject)
|
|
|
|
|
I'm quite reluctant to believe you're getting any kind of result at all as your code wouldn't even compile:
[OperationContract]
public string GetData(int value)
{
for (int i = 0; i < 4; i++)
{
Thread t = new Thread(() => simpleThread(i));
t.Start();
}
}
Compilation would fail because of the missing return statement.
Regards,
— Manfred
"I had the right to remain silent, but I didn't have the ability!"
Ron White, Comedian
|
|
|
|
|