|
I'm doing this coding and its running properly. This coding is to create a chart that can be drag and drop. I create the Panel as the bar. The panel will be generated depend on input. But the problem is the Panel is generated too many as it like there is nonstop loop. Can anyone solve this problem...plz
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace CMSMS
{
public class mypanel:System.Windows.Forms.Panel
{
private bool isDragging=false;
public int x,y;
protected override void OnMouseDown(MouseEventArgs e)
{
base.OnMouseDown (e);
isDragging = true;
x = e.X;
y = e.Y;
}
protected override void OnMouseUp(MouseEventArgs e)
{
base.OnMouseUp (e);
isDragging = false;
}
protected override void OnMouseMove(MouseEventArgs e)
{
if (isDragging == true)
{
this.Left= e.X + this.Left - x;
this.Top = e.Y + this.Top - y;
}
}
}
}
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace CMSMS
{
///
/// Summary description for GranttChart.
///
public class GranttChart : System.Windows.Forms.Form
{
...
private mypanel [] bar = new mypanel[60];
...
public void GenerateGranttChart()
{
GenerateChart();
}
private void GenerateChart()
{
for (int i = 0; i < 10; i++)
{
int xPosition = 100;
for (index = 0; index < 10; index++)
{
for (int j = 0; j < 10; j++)
{
DrawPanel( xPosition, yPosition,j,brush, length);
xPosition += length;
}
yPosition -= range;
}
}
}
private void DrawPanel(int X,int Y,int j,SolidBrush brush, int l)
{
bar[j]=new mypanel();
this.bar[j].Size = new Size(l,20);
this.bar[j].BackColor = brush.Color;
this.bar[j].Location = new Point(X,Y);
}
rotected override void OnPaint(PaintEventArgs e)
{
...
GenerateChart();
...
}
|
|
|
|
|
First thing that I see is that you have 1000 iterations of DrawPanel. You have three nested loops, so you get the following logic:
for each iteration of the outermost loop
for each iteration of the next loop
for each iteration of the inner loop
DrawPanel
end for
end for
end for
BTW - you have declared an array with a fixed size of 60, so you will get an overflow. You would be much better off declaring this as List<mypanel> bar = new List<mypanel> and then using this instead.
-- modified at 8:00 Friday 16th March, 2007
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hello!
I've got a main dialog with two splitters. The problem is that after opening and closing a sub-dialog, one of the splitters gets the focus.
Before opening a sub-dialog: Screenshot[^]. After closing the dialog: Screenshot[^].
How can I avoid that the splitter gets the focus?
Best regards
Dominik
|
|
|
|
|
Hi
set the canFocus Property to false, the splitter shouldn't get the focus then
greets
m@u
|
|
|
|
|
Hehe, tried that already Unfortunately, the CanFocus property is read-only. You also cannot override it in a derived class
Another idea?
|
|
|
|
|
well what you could try in a derived class would be the setStyle method:
<br />
public class myFocusAvoidingSplitter:Splitter<br />
{<br />
public myFocusAvoidingSplitter()<br />
{<br />
SetStyle(ControlStyles.Selectable,false);<br />
}<br />
}<br />
hope that helps
greets
m@u
|
|
|
|
|
Thanks for the tip! The splitter doesn't get the focus any more after the sub-dialog is closed.
One problem remains, though. When clicking the splitter with the left mouse, it appears like this: Screenshot[^].
But I guess this can be solved somehow by handling the mouse events. Thanks a lot again!
|
|
|
|
|
Hi ,
Please give me some guidance.How can we extract characters from image(which is in JPEG format) using image processing algorithms and how to remove noise from image. Could u please tell us how to proceed to reach our requirement.
|
|
|
|
|
i smell something fishy...
I am a SysAdmin, I battle my own daemons.
|
|
|
|
|
|
JanapatiBalu wrote: Please give me some guidance.How can we extract characters from image
Using OCR.
JanapatiBalu wrote: which is in JPEG format
You can't do anything with the compressed file. You have to open the file so that you get the uncompressed data.
JanapatiBalu wrote: and how to remove noise from image
That can be done using the same technique as programs like Raw image converters and Neat Image uses. I doubt that it will remove the kind of noise that you are trying to remove, though.
JanapatiBalu wrote: Could u please tell us how to proceed to reach our requirement.
Build a program that noone in the world has managed to build so far.
I guess it would be much easier to build a clone of the system that you are trying to hack into, than it is to build the program that would hack into it.
---
single minded; short sighted; long gone;
|
|
|
|
|
Guffa wrote: Build a program that noone in the world has managed to build so far.
"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
coolestCoder
|
|
|
|
|
I have one Dropdownlist and one listbox. Dropdownlist contains all doctor names and listbox contains specializations.
I have 3 tables (Doctor,DSpecialization and DSpecializationDetails)
DSpecializationDetails-(DoctorId(PK) and DSpecializationId(PK))
Doctor - (DoctorId(PK),DoctorName)
DSpecialization-(DSpecializationId(PK), specializations)
One Doctor could have many Specializations
I want the user to be able to choose 1 or many specializations,
and insert the selections into a table called DSpecializationDetails.
I’m working with Asp.net and C#
Thanks for any help.
|
|
|
|
|
Hi
How to fill a picture box by using RGB colors
thanx in advance
KK
|
|
|
|
|
Hi,
U can fill the picturebox by setting the BackGround Color property. Use this ode
pictureBox1.BackColor = Color.FromArgb(30, 100, 120);
If u don't want to use the background property You can also create a new bitmap, draw a rectangle, fill the rectangle with a color and set the bitamp as image of the picture box.
HTH
|
|
|
|
|
|
What?
If you want us to help you you'll have to learn to describe the problem in a way understandable for others...
How about some code?
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Hi
I developed a Windows Application. Now I want to run it as a windows Service . Is there any facility or statements(code) to run the application as a service.
Please tell me.
Thanks in Advance.
Ramu Medida
|
|
|
|
|
Hi,
Windows service dosent have a GUI. So if you want to run Windows application as windows service there are 2 ways of doing it ( atleast, i know this much only )
1) Create a new windows service. copy all code from windows application to the newly create service (without any GUI related code, but satisfying the business logic). Install the service. Run it.
2) Just hide the windows application to a tray icon. In this way, you dont need to copy code. But then the application itself should be bbuilt in such a way that it dosent get stuck for user interaction for its process to continue, but when interrupted, should respond to the user.
I dont know why you want to shift from windows application to windows service. if you could specify some details, then it would be easier to give some specific advice.
"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
coolestCoder
|
|
|
|
|
help me by suggesting a good/moderate Encryption method for XML file,
please suggest me a methodology, where in which i can secure my data
of xml file.
please help me how to encrypt and decrypt too, i am using C#,WindowsApplication(VS2005)
Here i need to store the data in ENCRYPTED way to the XML FILE, and then have to decrypt later when using...
please help me with a sample,
thnx in advance,
prashanth,
s/w Engineer,
Syfnosys.
|
|
|
|
|
Hi,
You want the complete XML File to be encrypted or you want some data in the XML file be stored in encrypted format ?
This link[^] might be of your interest.
"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
coolestCoder
|
|
|
|
|
sir i want to encrypt both the XML structure and the data that i'll pass in to it.
please give me a sample application, so that i can understand the encryption and decryption,
i've gone throwgh the msdn link, even then i request u for a better sample.
i new to this xml encryption and decryption method, Please help me...
thnx in advance,
prashanth
prashanth,
s/w Engineer,
Syfnosys.
|
|
|
|
|
|
Why do you need the data encrypted? Unless you are storing sensitive data, you shouldn't need to encrypt the file.
If you are trying to make sure that no one has changed anything in the file, you can use Signed XML instead. Take a look at http://msdn2.microsoft.com/en-us/library/system.security.cryptography.xml.signedxml(VS.80).aspx[^] for more information.
The big disadvantage to encryption is that it becomes a real pain to debug.
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
Hi, Mr.
thnx first,
i'll explain u why i need to Encrypt.
its just becoz in my widows application , where the backend db is XML..(which is tourchering me alot),
i've to Encrypt the XML File,(i've to ENCRYPT THE FILE AS SUCH) and decrypt at recieving end..
so, please help me with a C#, sample how to ENCRYPT AND DECRYPT A XMLFILE.
thnx and regards,
prashanth,
s/w Engineer,
Syfnosys.
|
|
|
|