|
ab-tools wrote: is there any thumbnail control that supports the sorting of thumbnail images by drag & drop?
Yes and no. It's not a "thumbnail"-control, but the standard PictureBox does provide all the functionality you're after;
- Set the size and width of the desired thumbnail-image
- Set the SizeMode[^] to
StretchImage - Support for Drag and Drop[^]
--edit;
Sounds logical to have multiple of those in a Panel
I are Troll
|
|
|
|
|
Hello Eddy,
first thank you for your fast answer.
Yes, I already thought about doing that with PictureBoxes.
But it's not just the drag & drop of the PictureBoxes themselves, but also an additional label (e. g. for a file name or a page number) for each PictureBox and, of course, it also should look good: so the user can see which PictureBox is selected at the moment and also sees where he has to drop it for changing the sorting.
So I just hoped there exists already a control that does such things. Of course, I would also pay some money for it if I save the time implementing it by myself.
Best regards and thanks for any futher ideas on that topic
Andreas
|
|
|
|
|
ab-tools wrote: also an additional label (e. g. for a file name or a page number) for each PictureBox
Still thinking along the lines of the PictureBox, that would be done by overriding the Paint-handler, drawing the text onto the picture yourself.
ab-tools wrote: it also should look good: so the user can see which PictureBox is selected
"Pretty" is an opinion, I can't help there
The selection would be done by drawing a square around the box, in the current "selection" color as defined by the users' configuration.
ab-tools wrote: So I just hoped there exists already a control that does such things.
There's probably a lot that comes close, like the Tiles control from Infragistics[^].
I are Troll
|
|
|
|
|
Hello Eddy,
thanks again.
Then I'll do it on my own - just thought there would be a control that I can use out of the box...
Best regards
Andreas
|
|
|
|
|
Hi,
I am trying to make an application which tries to read the website ip's currentely visited. I have found an example of packet sniffer in c# (http://www.codeproject.com/KB/IP/CSNetworkSniffer.aspx).
My problem is that i dont want to run the call conitnuously. So i kept the call in a timer. All works fine, but when i plugged in my wifi internet connection( in addtion to my current lan connection), i was not able to view webpage. So i modified the code such a way to montior the ip through all the port. Then i am getting
System.Net.Sockets.SocketException: An invalid argument was supplied
at System.Net.Sockets.Socket.IOControl(Int32 ioControlCode, Byte[] optionInValue, Byte[] optionOutValue)
at System.Net.Sockets.Socket.IOControl(IOControlCode ioControlCode, Byte[] optionInValue, Byte[] optionOutValue) Here is my code
private void checkIP()
{
mainSocket = new Socket(AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.IP);
mainSocket.Bind(new IPEndPoint(IPAddress.Any,0));
mainSocket.SetSocketOption(SocketOptionLevel.IP,
SocketOptionName.HeaderIncluded,
true);
byte[] byTrue = new byte[4] { 1, 0, 0, 0 };
byte[] byOut = new byte[4] { 1, 0, 0, 0 };
mainSocket.IOControl(IOControlCode.ReceiveAll,
byTrue,
byOut);
mainSocket.BeginReceive(byteData, 0, byteData.Length, SocketFlags.None, new AsyncCallback(OnReceive), null);
timer1Sec.Enabled = true;
}
private void OnReceive(IAsyncResult ar)
{
try
{
int nReceived = mainSocket.EndReceive(ar);
ParseData(byteData, nReceived);
}
catch (Exception ex)
{
}
} checkIP is called from a timer. I am getting exception in mainSocket.IOControl
|
|
|
|
|
hi guys.
Any one has idea about how can we give enum member like A+,B+...
public enum Color
{
Any,
D+,
D,
D-,
E+
};
I tried creating above enum but bad luck its giving error saying } expected.
dipak
|
|
|
|
|
You can't.
Enum members follow the normal rules for names - same as methods, properties, fields and namespaces.
All you can do is use the word "Plus" or "Minus" instead.
You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
|
|
|
|
|
Does it mean that ther is no way to make such member in enum?
dipak
|
|
|
|
|
Yes.
In C#, all identfiers (methods, properties, fields, and namespaces) must adhere to the following rules:
The name can contain letters, digits, and the underscore character (_).
The first character of the name must be a letter. The underscore is also a legal first character, but its use is not recommended at the beginning of a name. An underscore is often used with special commands, and it's sometimes hard to read.
Case matters (that is, upper- and lowercase letters). C# is case-sensitive; thus, the names count and Count refer to two different variables.
C# keywords can't be used as variable names. Recall that a keyword is a word that is part of the C# language.
The characters '+', '-', '(' ')', '=', ',', ';' and many others cannot be used in the name of any identifier.
So, no. You can't do it. At all. Ever.
You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
|
|
|
|
|
You can only use underscores and alphnumeric characters in enum ordinal names. You also can't start the name with a digit.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Add a Description attribute, and use reflection to extract the description from that e.g
[Description("D+")]
DPlus There are numerous samples showing how to do this.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
thankyou so much ....all guys..
dipak
|
|
|
|
|
That's what I would have said too.
|
|
|
|
|
As Pete said, use a System.ComponentModel.DescriptionAttribute .
See also my Enum Utilities[^] for ways to work with them more easily.
|
|
|
|
|
Hi;
i am working on a mobile application with csharp.
I want to know how can i use a parameter related to a form in another form.
what can i do.
thank you for your help.
|
|
|
|
|
If it is web application
Use Query String
Ex Reponse.Redirect("SecondPage.aspx?Param="+Param);
If it is windows application
add module and declare a varible in it assign a value and retrieve it in another page
I hope it ll help u
|
|
|
|
|
thank you for your help,
But i am working on a mobile application and it is not a web application.
I found finallay the solution for the problem.
It was very simple: add a parameter to the constructor of the form and call it with this parameter.
|
|
|
|
|
Hello
I am a beginner in programming in c #, I am trying to program a windows service that has as role of a PC scanner and collect information from WMI such as (disk space, machine name ...), and store these data in a SQLite database that I already create.I've managed to make the WMI connection and SQLite database but I wanted to know how do I do to store the results I get from WMI directly into my SQLite database.
Does anybody have an idea?
Thank you.
////////////connexion Wmi///////////////////
ConnectionOptions conop = new ConnectionOptions();
ObjectQuery query = new ObjectQuery("SELECT Name,Manufacturer,SerialNumber
from Win32_BaseBoard");
ManagementObjectSearcher searcher = new ManagementObjectSearcher(query);
ManagementObjectCollection queryCollection = searcher.Get();
///////////connexion sqlite////////////////////
using (DbConnection cnn = new SQLiteConnection("Data Source=import.db3"))
using (DbCommand cmd = cnn.CreateCommand())
{
cnn.Open();
cmd.CommandText = "CREATE TABLE carte_mére (Name VARCHAR(50),Manufacturer
VARCHAR(50),SerialNumber VARCHAR(50))";
cmd.ExecuteNonQuery();
foreach (ManagementObject m in queryCollection)
{
try
{
SQLiteDataAdapter adapter = new SQLiteDataAdapter(req,cnn);
adapter.InsertCommand = new SQLiteCommand("insert into carte_mére
Name,Manufacturer,SerialNumber values
(@Name,@Manufacturer,@SerialNumber)");
adapter.InsertCommand.Parameters.AddWithValue("@Name", d);
adapter.InsertCommand.Parameters.AddWithValue("@Manufacturer",
m.Properties["Manufacturer"].Value.ToString());
adapter.InsertCommand.Parameters.AddWithValue("@SerialNumber",
m.Properties["SerialNumber"].Value.ToString());
adapter.InsertCommand.ExecuteNonQuery();
} //Console.ReadLine();
catch (Exception)
{
Console.WriteLine("error");
}
|
|
|
|
|
Good Morning,
I work with Visual Studio2008.I create a listview.When running,the items appear in the same ligne and very near to each other.How can arrange their disposition to see them everyone in a ligne?
I do that but change nothing in my disposition:
.
.
.
if (dat.Tables["SQL Temp Table"].Rows.Count > 0)
foreach (DataRow dataRow in dat.Tables[0].Rows)
{
ListViewItem item = new ListViewItem();
item.Text = dataRow[0].ToString() + "- " + dataRow[1].ToString();
listView1.Items.Add(item);
listView1.View = View.Details;
listView1.LabelEdit = true;
listView1.AllowColumnReorder = true;
listView1.CheckBoxes = true;
listView1.FullRowSelect = true;
listView1.GridLines = true;
listView1.Sorting = SortOrder.Ascending;
.
.
. }
This is the link of my image show of my problem http://yfrog.com/b6captureugwj
[^]
I wanna informe u that I work with Csharp smart device
Thanks
modified on Thursday, April 22, 2010 7:03 AM
|
|
|
|
|
|
I have created a data source (Access MDB file) runtime using following snippet:
CatalogClass cat = new CatalogClass();
cat.Create(connstr); // connstr: Connection string
It returns me a MDB file created.
I have a DataSet object with Tables shema defined in it...
I want to create a Table in MDB file with same table name and schema defined for DataSet.
I have tried following snippet to add table into data base:
cat.Tables.Append((object)table); // where 'table' is the ADOX.Table
It throws an Exception 'Column Id is invalid.'
System.Runtime.InteropServices.COMException (0x80040E11): Column ID is invalid.
How could I resolve it and will get data base schema created similar to the schema defined in DataSet?
|
|
|
|
|
You have to write some code to look at the schema in the DataSet and create each item seperately, building up the schema in the database. There is nothing in the .NET Framework that will create this stuff for you. That's not what the Schema stuff in the DataSet class was designed to do.
|
|
|
|
|
I have the following classes
[XmlRoot]
public class AList
{
public List<B> ListOfBs {get; set;}
}
public class B
{
public string BaseProperty {get; set;}
}
public class C : B
{
public string SomeProperty {get; set;}
}
public class Main
{
public static void Main(string[] args)
{
var aList = new AList();
aList.ListOfBs = new List<B>();
var c = new C { BaseProperty = "Base", SomeProperty = "Some" };
aList.ListOfBs.Add(c);
var type = typeof (AList);
var serializer = new XmlSerializer(type);
TextWriter w = new StringWriter();
serializer.Serialize(w, aList);
}
}
Now when I try to run the code I got an InvalidOperationException at last line saying that
The type XmlTest.C was not expected. Use the XmlInclude or SoapInclude attribute to specify types that are not known statically.
I know that adding a [XmlInclude(typeof(C))] attribute with [XmlRoot] would solve the problem. But I want to achieve it dynamically. Because in my project class C is not known prior to loading. Class C is being loaded as a plugin, so it is not possible for me to add XmlInclude attribute there.
I tried also with
TypeDescriptor.AddAttributes(typeof(AList), new[] { new XmlIncludeAttribute(c.GetType()) });
before
var type = typeof (AList);
but no use. It is still giving the same exception.
Does any one have any idea on how to achieve it?
|
|
|
|
|
I have a tcp server that cooperates with a windows forms aplication. Now I have the following problem:
When I run it outside Visual Studio everything works just fine. But when I want to debug the application inside Visual Studio I get the message:
"Cross-thread operation not valid: Control '' accessed from a thread other than the thread it was created on."
What can be the reason for this? Any suggestions?
|
|
|
|
|
Just put
CheckForIllegalCrossThreadCalls = false;
in the constructor of your main form in your Windows Application. It will solve the problem.
|
|
|
|
|