|
We don't do homework. Guessing what the question of the homework is, we don't do either.
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 am working on a Win32 application. We are enhancing it by creating some part of UI in .Net/WPF. Our core code is in C/C++ and some part of UI is in .Net/WPF. And We integrate these modules (C/C++ and .Net) via Managed C++.
Now I have to provide drag drop support. I need to drag some content from .Net UI and dropping it in C++/Win32 UI.
Can anybody help me knowing how to go about it?
Or let me know please how to implement drag drop from outside a .Net application (I mean drag from a .Net application and dropping outside it)
If some sample code or hyper-link can is there, please let me know.
Thanks and Regards
Aseem
|
|
|
|
|
|
Thanks Saksida,
It will really help me.
|
|
|
|
|
I wrote some codes for my usercontrol,but my codes doesn't work properly.I am trying to fill or unfill rectangles on my grid with colors during mouseMove event.When I move mouse from right to left or top to bottom, it works fine,but when I move mouse left to right or bottom to top it doesn't work properly.
I couldn't solve that problem after many efforts.
thank you in advance.
|
|
|
|
|
ahmetkoc wrote: I couldn't solve that problem after many efforts
Neither can we without seeing what you have done. I know the language. I've read a book. - _Madmatt
|
|
|
|
|
This is a little vage. Can you post a sample code of your mouseMove event.
|
|
|
|
|
private void zemin_MouseMove(object sender, MouseEventArgs e)
{
if (!this.ClientRectangle.Contains(e.X, e.Y)) return;
AtkiCozguNo(e.X, e.Y);
if (!tusaBasildi) return;
if (atki == sonAtki & cozgu == sonCozgu) return;
sonAtki = atki;
sonCozgu = cozgu;
renkKontrol(e.X, e.Y);
}
private void renkKontrol(int x, int y)
{
if(bitmapPixel.GetPixel(this, x, y).ToArgb()==this.BackColor.ToArgb())
{
kutuDoldur(Color.Red);
}
if(bitmapPixel.GetPixel(this, x, y).ToArgb()==Color.Red.ToArgb())
{
kutuDoldur(this.BackColor);
}
}
private void kutuDoldur(Color renk)
{
using (Graphics myKutu = Graphics.FromImage(kutuResmi))
{
myKutu.FillRectangle(new SolidBrush(renk),new Rectangle(xKoordinat,yKoordinat,kutuEbadı,kutuEbadı));
}
Invalidate();
}
private void zemin_Paint(object sender, PaintEventArgs e)
{
e.Graphics.DrawImage(kutuResmi, 0, 0);
}
|
|
|
|
|
First, it is hard to read your code, because it isn't formated (with <pre></pre> tags) and because there are a lot of non english variable names.
I woud love a few screenshot, how it shoud be and how it does happen. Have you thought of adding MouseUp and MouseDown events?
|
|
|
|
|
Hi Saksida,
I have already used MouseUp and MouseDown events to ensure left-mousebutton pressed.
I have screenshot but dont know how to send via forum.
The idea is on mousemove event check the grid cells whether filled or not with color red while left-mousebutton pressed.Cells were checking by GetPixel static method,checking is being done only entering new cell.
private void zemin_MouseMove(object sender, MouseEventArgs e)
{
if (!this.ClientRectangle.Contains(e.X, e.Y)) return;
AtkiCozguNo(e.X, e.Y);
if (!tusaBasildi) return;
if (atki == sonAtki & cozgu == sonCozgu) return;
sonAtki = atki;
sonCozgu = cozgu;
renkKontrol(e.X, e.Y);
}
private void renkKontrol(int x, int y)
{
if(bitmapPixel.GetPixel(this, x, y).ToArgb()==this.BackColor.ToArgb())
{
kutuDoldur(Color.Red);
}
if(bitmapPixel.GetPixel(this, x, y).ToArgb()==Color.Red.ToArgb())
{
kutuDoldur(this.BackColor);
}
}
private void kutuDoldur(Color renk)
{
using (Graphics myKutu = Graphics.FromImage(kutuResmi))
{
myKutu.FillRectangle(new SolidBrush(renk),new Rectangle(xKoordinat,yKoordinat,kutuEbadı,kutuEbadı));
}
Invalidate();
}
private void zemin_Paint(object sender, PaintEventArgs e)
{
e.Graphics.DrawImage(kutuResmi, 0, 0);
}
|
|
|
|
|
I do not see any problem with it. Nor do I know what kind of confusion it is, xKoordinat and yKoordinat properly calculated?. Also for screen shot, you could upload to www.photobucket.com and put here a link.
PS: Sorry for not answering your email. I was in a hurry
|
|
|
|
|
|
Now that picture says a lot.
shoudn't line be:
if (atki == sonAtki && cozgu == sonCozgu) return;
|
|
|
|
|
I have tried double "&&" but result was the same.
|
|
|
|
|
does this problem occur with fast moving or slow moving mouse?
|
|
|
|
|
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-
|
|
|
|