|
No, it does not change result.
I also tried "protected override" methods instead of "private void",but result did not change.
maybe I should write codes again in new project.
|
|
|
|
|
First, try setting breakpoint at renkKontrol(e.X, e.Y);//check color and look if you get called every time your mouse is at different rectangle. Make sure you have enabled your form to be top most and your IDE at side. When you reach breakpoint, don't move mouse, just continue and try next one.
|
|
|
|
|
That is unreadable withour proper formatting. Please edit and insert PRE tags.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
Hi all,
I have an app that is currently being built for a windows mobile 6 device and a CE5 device.
The screens on these devices are different - one is landscape the other is portrait.
I need to display the app correctly on both devices. but was wondering what is the best way to approach this ?
1) Should i find screen orientation from Windows.Forms.screens.... then simply create a form for each of the orientations?
2) make a form that has anchored controls (in some way) so it doesn’t matter the orientation.
3) Has Microsoft got some other way of doing this ?????
The app has an output type of windows Application.
Any ideas would be gratefully appreciated !
Thanks
John
|
|
|
|
|
I had a similar problem; I needed my app to look good at any resolution.
My solution: I designed the GUI for the lowest resolution, then on startup I got the actual resolution and added the extra space in the X and Y directions to selected controls on each window.
Certain controls (like listboxes) could use extra space to show longer lines (X direction) or show more lines (Y direction). So each control had a percentage of extra space it would use in each direction.
In my case, I designed for 800x600, and my approach gave good results for 1024x768 and 1280x1024. After the app was released, some people used it at resolutions I had never heard of and it still looked good!
|
|
|
|
|
Hi,
That sounds like exactly what i want to do !!
Could i be really cheaky and ask if you have any sample code to get me started
Thanks
John
|
|
|
|
|
The code I have is in C++/MFC, so I don't know if you could use it. I don't have it here right now, but here's the general approach I used:
1. I invented a language called WASP (Window Arrangement Specification Protocol) which consisted entirely of ints, so I could easily store it in a static array in the class. This avoided all parsing and syntax issues. #defines were used for the ints to make the WASP program human-readable.
2. Each WASP op code was followed by the MFC int ID(s) of one or more dialog controls, and parameters. Each percentage (for the extra space for that control) was an int representing the numerator, assuming a 32768 denominator. This avoided having to encode floating-point percentages in the WASP program.
3. Sample WASP ops: Add a given percentage of the extra space in the X direction to the following control(s), terminated by a -1. Space the given controls evenly in the allotted extra space.
4. I also created a Wasp class that (as I recall) took a pointer (reference in C#) to the dialog, and the int array containing that dialog's WASP program. Each dialog called a method in the Wasp class to execute the WASP program to arrange the controls before it was first shown.
5. On startup, the screen dimensions are obtained and stored in static members in the WASP class to get the extra space we have to work with in both dimensions.
|
|
|
|
|
Hi Friends
An error "Access to the registry key 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run' is denied." occured in below code. How can i solve this problem
Registry.SetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", "hello", "c:\\hello.exe");
thanks in advance-kk.tvm-
|
|
|
|
|
A non-administrative user does not have write access to HKEY_LOCAL_MACHINE.
What is the purpose of your project? Would it be ok to put a link into the user's startup folder? Or are you trying to create a Windows service? Then its installation routine would be run in administrative context and can write that key.
|
|
|
|
|
Hi bhiller
I am trying to build a program which appears as system tray, that starts everytime when system starts.
If i put program in user's starup folder, it will easily disable.
thanks in advance-kk.tvm-
|
|
|
|
|
Hi, I'm having a 1.4M record table stored in MS Access file and I thought the fastest way to retrieve some row data was to load it in a DataTable once in the first loading screen and then just filter it using the .Select() but surprisingly, it is very slow!!
Any similar experience??
Thanks!
|
|
|
|
|
did you try assigning it to a view and change row filter?
|
|
|
|
|
Som Shekhar wrote: assigning it to a view and change row filter?
Can you kindly shed some more light on that??
Thanks!
|
|
|
|
|
Look as Dave suggested, the first preference should be to let it be handled by the database since they are more optimized to do this.
However, if you insist on loading all data into a datatable, you can try using a dataview. However i am not so sure about the performance. Test it atleast.
DataView view = table.DefaultView;
view.RowFilter = "Value>2";
|
|
|
|
|
Thanks mate, unfortunately, I can't do that as I need to load the whole table to the datatable to cut down trips to the database.. And using the dataGridView control is not an option too as I'm using the listView control!.. Thanks anyways mate!
|
|
|
|
|
I used the following code and Dataview method is faster than the select method. I do not know why but it is.
Try it. May be it helps you.
DataTable table = new DataTable();
table.Columns.Add(columnName);
for (int i = 0; i < 1000000; i++)
{
table.Rows.Add(i);
}
MessageBox.Show("Loaded", "");
string condition = columnName + ">500 AND " + columnName + "<10000";
DateTime timeStart = DateTime.Now;
DataView view = table.DefaultView;
view.RowFilter = condition;
DataTable newTable = view.ToTable();
DateTime timeStop = DateTime.Now;
TimeSpan span = timeStop - timeStart;
MessageBox.Show(span.TotalMilliseconds.ToString(), "");
timeStart = DateTime.Now;
DataRow[] rows = table.Select(condition);
timeStop = DateTime.Now;
span = timeStop - timeStart;
MessageBox.Show(span.TotalMilliseconds.ToString(), "");
|
|
|
|
|
Did you also try just letting the database do the work by having it just return the rows you need instead of 1,400,000 of them and throwing a bunch out?
|
|
|
|
|
Hey there Dave,
Dave Kreskowiak wrote: just return the rows you need
My first reply to such post would've been exactly the same
Ok, here are some more details.. I have this phone list that I want to filter out whenever the user types the first letters of the phone holder name and the list should shrink as the name builds up to match those with the very same name typed so far "something like the VS.Net intelli-sense"..
No you have the full picture, tell me how would you do it??
ps. I'm glad you saw this post Dave, I truly dmire your logic!
|
|
|
|
|
I wouldn't start with the loading the entire database.
I'd start by building the list from the first characters typed. The first character would return just the entries that started with that character, and I'd probably return only the top 20 to 30 entries. After all, you're not going to show ALL of those entries to the user, only enough to give them an idea they are on the right track. Keep doing this until the user either enters the entire entry themselves or have picked one from the list.
|
|
|
|
|
I am able to send mail from my gmail account to any other mail id.
No error.
But when i try to send mail from my yahoo account, it shows error.
I changed all required smtp server, port no etc .
If i configure same yahoo account in MS Outlook express, it send mail, but i cant do that from my application.
Before asking here, i searched a lot, but all the examples exist uses gmail, not a single one for yahoo.
Some says you need yahoo plus account, but if this is the case then why MS outlook able to access my normal yahoo account.
Any help/comment/guidance !! 
|
|
|
|
|
Well, you could read the message they send.
Since I wrote an application which can send email via smtp, I just created an account at yahoo and tried myself.
"Transaction failed : Cannot send message due to possible abuse; please visit
http://postmaster.yahoo.com/abuse_smtp.html for more information"
I.e. Yahoo blocks the mails!
|
|
|
|
|
Hi ,
Is it possible to add a blank generic item to the List before binding it to the datasource?
I hope this makes sense.
Thanks,
|
|
|
|
|
It depends on what type your List is. Do you mean that you want to add a blank item to something like a combobox? If so, and you are using Win Forms or ASP.NET, you can bind to your data source, then insert the blank to the top of the list afterwards using something like myCombo.Items.Insert(" ", " "); "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
|
|
|
|
|
yes thats right I want to add a blank item to the combobox. I have tried the
combobox.items.insert("","") but am getting the error "Cannot add items to the combobox when a datasource is assigned". Using WINFORMS
So I thought of creating a generic list of type T and pass a new instance of the item T to the list before the List is bound to the datasource.
private static List<T> CreateList<T>(List<T> data)
{
List<T> list = new List<T>();
list.AddRange(data);
return list;
}
I hope this makes sense.modified on Friday, February 26, 2010 6:26 AM
|
|
|
|
|
If you don't know what is the blank value in advance, you can't do it the way you are trying.
You can, for example, add a "" (or string.Empty) in a list of strings, but this will not work for other types.
A possible solution is to create a generic "wrapper".
For example:
public struct MyWrapper<T>
{
public MyWrapper(T value)
{
_value = value;
_hasValue = value != null;
}
private T _value;
public T Value
{
get
{
return _value;
}
}
private bool _hasValue;
public bool HasValue
{
get
{
return _hasValue;
}
}
public override string ToString()
{
if (!_hasValue)
return "";
return _value.ToString();
}
}
As this wrapper is a struct, it can be initialized by the default constructor, in which case the _hasValue is false, so the ToString will return blank. If you initialize it with null (considering T is a reference type) it will do the same.
So, you can create a List<MyWrapper<T>> and add the first value as new MyWrapper<T> and then add a wrapper value for each value of the original list.
But, if the original list is changed, this list will not be.
*I didn't test the code, so maybe there is an error, but I think you can get the idea.
You can also go even further and create an IList wrapper over another IList. It is a big work, but:
You can always return Count as Count + 1.
When requested for item 0, you always return the empty wrapper value.
When requested for any other item, you return a wrapper over the real list item at (index-1) [after all, requesting item 1 means item 0 in the real list].
The advantage is that changing any item in the real data-source will be reflected in your wrapper data-source also, but it is a much more complex task.
|
|
|
|