|
What is so hard to comprehend? It's not a lot of code. You create a function to check coordinates. You call this function inside a for/foreach loop for each button in form controls property.
I can see this having no more than 10 lines of code.
|
|
|
|
|
that it was my solution before write to this forum .... and now is the same solution, but I think anyway it's to much for a simple check.
I'll do that and after that I'll check for another solution
thanks anyway
|
|
|
|
|
Rectangle r1 = new Rectangle(l1,t1,w1,h1);
Rectangle r2 = new Rectangle(l2,t2,w2,h2);
if (r2.IntersectsWith(r1))
return true;
else
return false;
where l1...h1,l2...h2 are the button x,y,width,height
|
|
|
|
|
public bool verificSuprapunere(int l,int t,int w,int h,Panel p)
{
Rectangle r1 = new Rectangle(l,t,w,h);
bool exista;
exista = false;
int i = 0;
for (i=0; i < p.Controls.Count; i++)
{
if (p.Controls[i].ClientRectangle.IntersectsWith(r1))
exista = true;
}
return exista;
}
|
|
|
|
|
Hi everyone
Can anyone help me out with this...
In a windows application, i have got 2 windows forms. And i wan to link the forms together with a link label in the first form. How do i go about writing the codes?
Thanks in advance
frossie
|
|
|
|
|
frossie wrote: ink the forms together with a link label
Please explain this in detail.
|
|
|
|
|
i created 2 forms in a project.
2 forms namely, form1 and form2.
form1 uses a linklabel control (System.Windows.Forms.LinkLabel) to open up form 2.
So when i click on this text "open form 2" which is the link label, it should open up the windows form2.
SOrry but i don't really know how to explain in much detail, hope the above helps abit...thanks!
frossie
|
|
|
|
|
I didn't know what you meant by "linked"
In the onclick event, just create an instance of the 2nd form and show it.
|
|
|
|
|
Simple...
just throw a link object on the form in the designer u know and double click on that, this will open the click event.
In taht click event just write your code as,
form2.ShowDialog(this);
Rocky
|
|
|
|
|
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
Form2 form2 = new Form2();
form2.Show();
form2.ShowDialog();
}
|
|
|
|
|
Oh ic..
it works! haha thanks!
Btw, what's the difference between form2.show and form2.showdialog?
I mean i tried with both but i can't spot any visible difference..can u explain in some simple terms? hehe.
frossie
|
|
|
|
|
With form2.ShowDialog() form2 must be closed before any other window will be active, with form2.Show() you will be able to work in any window.
|
|
|
|
|
hello
can anybody help me with a combo box.
I want, when I run my application to see first value of the collection in the combo box, and I want to select only the value from collection, I don't want to allow to write any other value.
10x
|
|
|
|
|
Plz try it.
dropDownStyle property to DropDownList
Parwej Back...............DON of Developer.......
Parwej Ahamad
g_parwez@rediffmail.com
|
|
|
|
|
Hi..
I dont know if i understood you correctly...
i´m from brazil..
well.. to see fist value of the collection, add this code on "Form_Load"
comboBox1.SelectedIndex = 0;
To don´t allow to write, change the proprieties "DropDownStyle" to DropDownList..
thats it...
|
|
|
|
|
set the dropDownStyle property to DropDownList
|
|
|
|
|
Go from SystemInformation.PrimaryMonitorSize to int x, int y
I have done this by evaluating the string one character at a time but I am sure there is some easy way of which I am not aware.
|
|
|
|
|
Hello,
electriac wrote: I am sure there is some easy way
Yes
use the members of this property.
SystemInformation.PrimaryMonitorSize.Height;
SystemInformation.PrimaryMonitorSize.Width;
All the best,
Martin
|
|
|
|
|
Thanks that should have been obvious but I'm getting to the point where I can plead senility.
|
|
|
|
|
electriac wrote: I'm getting to the point where I can plead senility.
humor is allways a good recipy
|
|
|
|
|
Hi..
I´m from Brazil...
I have an application (C#) that initializes on the "system tray"...
I´d like to show some form from this application when time gets 3:00PM, for example...
but, i´d like that the form "jump" into the screen... without click a button...
that´s it..
sorry about the bad english..
thanks!
Carlos A. Velloso Jr
|
|
|
|
|
make your application as service which check periadically for the specific time and show on system tray.
or your make an exe which shedule in windows shedulin job on 3 pm
Parwej Back...............DON of Developer.......
Parwej Ahamad
g_parwez@rediffmail.com
|
|
|
|
|
You can also create an application with a timer. This application will reside only in the tray and when the desired time or any other condition has been met it will show a new form on the dekstop.
|
|
|
|
|
This is one way of doing it:
private void Form1_Load(object sender, EventArgs e)
{
TimeSpan startTime = new TimeSpan(13, 40, 0);
TimeSpan currentTime = DateTime.Now.TimeOfDay;
TimeSpan diff = startTime - currentTime;
if (diff.Ticks > 0)
{
timer1.Interval = (int)diff.TotalMilliseconds;
timer1.Start();
}
}
private void timer1_Tick(object sender, EventArgs e)
{
timer1.Stop();
WindowState = FormWindowState.Normal;
ShowInTaskbar = true;
}
|
|
|
|
|
hi all
i try to save a 4bpp bitmap in an memorystream.
example:
// Clone the original 4bpp bitmap
Bitmap bmp = (Bitmap)image.Clone();
using(MemoryStream ms = new MemoryStream())
{
bmp.Save(ms, ImageFormat.Bmp);
}
bmp.Dispose();
this code give me the following error: Error in GDI+
this code works fine but it convert the bitmap to a 32bpp format:
using(Bitmap bmp = new Bitmap(image))
{
using(MemoryStream ms = new MemoryStream())
{
bmp.Save(ms, ImageFormat.Bmp);
}
}
it is possible to save a 4bpp bitmap to a stream?
regards
JoeSharp
|
|
|
|