It said GetSystemTime() is undeclared. Am i missing something?
shamsteady
Posts
-
Get system time -
Get system timeHow can i get the system time and display it?
-
get system timeThanks for the information
-
get system timeHow can i get the system time?
-
ReorderI had write this code to do drag and drop at window form panel. How can i do the reorder panel because this code only to do drag and drop? 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; } } } }
-
Create chartI'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(); ... }
-
OverrideI try to do that but get error while compiling. Am i missing something?
-
OverrideCan i do like this? Is this allowed in C#? protected override void OnPaint(PaintEventArgs e) { ... ... } private void GenerateChart() { ... OnPaint(PaintEventArgs e) ... }
-
Generate random numberThank you very much..
-
Generate random numberHow can i generate random number in C#?
-
Generate PanelI had write this code for (int i = 0; i < totalEquipment; i++) try { for (int j = 0; j < sEquip[index].index; j++) { try { ... bar[j].Size = new Size(length,20); bar[j].BackColor = System.Drawing.Color.Blue; bar[j].Location = new Point(xPosition,yPosition); this.Controls.Add(bar[j]); ... } catch (Exception ex) { throw new Exception(ex.Message + " " + ex.StackTrace); } finally { xPosition += length; } } } catch (Exception ex) { throw new Exception(ex.Message + " " + ex.StackTrace); } finally { yPosition -= range; } } } The problem is this part which it keep add panel to window form without stoping like non stop looping. How can i stop this error? try { ... bar[j].Size = new Size(length,20); bar[j].BackColor = System.Drawing.Color.Blue; bar[j].Location = new Point(xPosition,yPosition); this.Controls.Add(bar[j]); ... }
-
Add panelThanks...
-
Add panelIm trying to add panel in window form by using this method. public class Form1 : System.Windows.Forms.Form { private System.Windows.Forms.Panel mypanel; private void InitializeComponent() { ... this.mypanel = new System.Windows.Forms.Panel(); ... } ... ... this.Controls.Add(this.mypanel); Is there other way to display panel besides using "this.Controls.Add(this.mypanel);" method?
-
LoopThe code contain an array of panel that will be add to window form. It will be display according to the number of input. The problem is the panel will be display but it keep blinking during runtime meaning that it generate too many panel...
-
LoopI had write this code for (int i = 0; i < totalEquipment; i++) try { for (int j = 0; j < sEquip[index].index; j++) { try { ... bar[j].Size = new Size(length,20); bar[j].BackColor = System.Drawing.Color.Blue; bar[j].Location = new Point(xPosition,yPosition); this.Controls.Add(bar[j]); ... } catch (Exception ex) { throw new Exception(ex.Message + " " + ex.StackTrace); } finally { xPosition += length; } } } catch (Exception ex) { throw new Exception(ex.Message + " " + ex.StackTrace); } finally { yPosition -= range; } } } The problem is this part which it keep add panel to window form without stoping like non stop looping. How can i stop this error? try { ... bar[j].Size = new Size(length,20); bar[j].BackColor = System.Drawing.Color.Blue; bar[j].Location = new Point(xPosition,yPosition); this.Controls.Add(bar[j]); ... }
-
ArrayThanks for the useful information
-
ArrayI declare "private System.Windows.Forms.Panel mypanel;" in window form to get a panel name my panel. Can i declare "System.Windows.Forms.Panel [] mypanel;" to get an array of panel because i want to generate couple of mypanel during runtime...
-
ClassThanks. This really works...
-
ErrorHow to access the left and top property's through the sender object? Can you give example. i am new to c# and need guide..
-
ErrorActually it has that control but it need to be declared. But when i made it into class, but in class it can't be done.