|
I was seeing the UI of Virtools Dev(www.virtools.com). I was wondering how they did it. How did they built it? They used photoshop to make the various components and then import them in Visual Studio? How can you make a custom UI with WinForms but use your own graphics and of course attach functionallity to them?
|
|
|
|
|
Hi,
Nowadays many number of third party image, Photo ediiting softwares are available. Phontoshop is only is for image Editing only. Right?.
many web sites will use flash Script, animation tools etc.
regards
GV Ramana
|
|
|
|
|
Hello can anyone help me with this peculiar problem.
How can i read f.ex text from a textbox belonging to another form(object)
|
|
|
|
|
This article[^] details the techniques that for which you will likely be looking.
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
|
|
|
|
|
hi,
you can create a propety and set the property to the textbox's text value when the text is entered and then you can access the data from that property
hope u get it
Regards,
Pramod
|
|
|
|
|
Hope this helps. I think this is the least confusing method. This is the class of the main form that calls the child form:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace PassingDataBetweenForms2
{
public partial class Form1 : Form
{
//Declare an object of Form2 class - the form to be
//called from this form (Form1)
public Form2 ChildForm;
public Form1()
{
InitializeComponent();
}
private void Form1_DoubleClick(object sender, EventArgs e)
{
//Initialize the Form2 class object
ChildForm = new Form2();
//Assign the main form (parent form - of class Form1)
//to the object of class Form1 that is defined in class Form2
//This is the part which creates the link between the two forms
ChildForm.ParentFormObject = this;
//Open/Show the child dialog of class Form2
ChildForm.Show();
}
private void textBox1_Click(object sender, EventArgs e)
{
//When you click in the text box in parent form (Form1 class)
//this assigns a value to a label on the child form (Form2 class)
ChildForm.label1.Text = "This came from the parent form (Form1)";
}
}
}
//*******************************************
//This is the class of the child form
//*******************************************
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace PassingDataBetweenForms2
{
public partial class Form2 : Form
{
//Declare an object of the parent form class (Form1)
//Make sure the controls which neet to be assecced from
//the parent form are public, internal,
//or internal protected otherwise you won't be able to
//access them.
public Form1 ParentFormObject;//Same goes for the Form1, Form2 objects
public Form2()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
//This function is executed when the button on
//this form - child form (of class Form2) is pressed.
//This action assigns a value to the textbox of the parent form (Form1 class)
//from this form - child form (Form2 class)
ParentFormObject.textBox1.Text = "Text sent from ChildForm (Form2)";
}
}
}
-- modified at 12:38 Tuesday 27th December, 2005
|
|
|
|
|
is there a way to deploy a windows service app.. so tht its becomes a sevices at the start up
sathy
|
|
|
|
|
go to
Design view of your Service.cs file, right click add Installer, you will get ServiceInstaller, ServiceProcessInstaller. Select ServiceInstaller, go to properties set StartType to Automatic.
Make a setup project and deploy.
regards
GV Ramana
|
|
|
|
|
thanks GV, but this is how i made the setup but this is installing and i can c my service at the windows service list but i cant start it ... its showing a "JIT error "
sathy
|
|
|
|
|
hi to all,
does any body knows how can i find if a word document is already open with c# win form application
best regards and thanks in advance
fady
|
|
|
|
|
I posted this function before but modified it for your case. Not sure if this will help the finction checks if Microsoft Word program is running and if it is, the function returns true if not, it returns false. You can put this function in a function of a Timer class
//***************************************
//This is just an example of
//executing the function
if (MicrosoftWordIsRunning ()== true)
{
label1.Text = "Microsoft Word is RUNNING!";
}
else label1.Text = "Word is NOT running.";
//*****************************************
that executes the MicrosoftWordIsRunning function at a specified interval - therefore checking every let's say 1000 milliseconds (1 second).
Let me know if you have any questions.
Make sure you include System.Diagnostics:
using System.Diagnostics;//put at the beginning
//put function in class
private bool MicrosoftWordIsRunning()
{
Process[] myProcess = Process.GetProcesses();
int i = 0;
try
{
while (myProcess[i] != null)
{
if (myProcess[i].ProcessName.ToUpper() == "WINWORD")
{
int i2 = 0;
try
{
while (myProcess[i2] != null)
{
myProcess[i2].Close();
i2 += 1;
}
}
catch { }
return true;
}
i += 1;
}
}
catch { }
int i3 = 0;
try
{
while (myProcess[i3] != null)
{
myProcess[i3].Close();
i3 += 1;
}
}
catch { }
return false;
}
-- Don't worry about the world coming to an end today. It's already tomorrow in Australia --
|
|
|
|
|
thanks for your reply,
but i need to iterate through the document that are open.
for exp :
suppose we have 5 document opened with winword. I need to loop through theese 5 documents to see if one of them match the one i search. And if yes, i want to close it (close the document and not winword)
best regards and thanks in advance
fady
|
|
|
|
|
I have a dictionary array with 7 elements: Dictionary<int, string> catDict
and from this array I create linklabels private LinkLabel[] categoriesLinks = new LinkLabel[15]
I do it so:
foreach (KeyValuePair<int, string> kvp in catDict)<br />
{<br />
<br />
this.categoriesLinks[kvp.Key] = new LinkLabel();<br />
this.categoriesLinks[kvp.Key].Location = new System.Drawing.Point(42, 39 + i * 17);<br />
this.categoriesLinks[kvp.Key].Name = kvp.Value;<br />
this.categoriesLinks[kvp.Key].Size = new System.Drawing.Size(115, 13);<br />
this.categoriesLinks[kvp.Key].TabIndex = 1;<br />
this.categoriesLinks[kvp.Key].TabStop = true;<br />
this.categoriesLinks[kvp.Key].Text = kvp.Value;<br />
this.categoriesLinks[kvp.Key].Click += new EventHandler(catClick);<br />
<br />
this.Controls.Add(this.categoriesLinks[kvp.Key]);<br />
i++;<br />
}
And also i have a event for click:
private void catClick(object obj, EventArgs ea)<br />
{<br />
}
How can I in catClick event detect which linkLabel was clicked? Actually I want to know what kvp.Key has this linkLabel.
|
|
|
|
|
you can use the obj to find out the linklabel name. just cast the obj to a linklabel.
<br />
LinkLabel l = (LinkLabel)obj;<br />
MessageBox.Show(l.name);<br />
<br />
|
|
|
|
|
thank you very much. It helped.
|
|
|
|
|
Hi all,
i have created an app which displays a non-rectangular window (i.e the FormBorderStyle is set to none)
I added a button to minimize the window using:
this.WindowState = FormWindowState.Minimized;
This minimizes the window properly to the taskbar (i dont mean the system tray)
When i again click on the window in the task bar, the window pops us and is back as normal. But when i take the mouse over the window it disappears and doesnt come back.
Can anyone tell me where i am going wrong ?????
*** Who said nothing is impossible? I have been doing it for a long time ***
|
|
|
|
|
It seems right make sure the form properties in the InitializeComponent() function are all correct. These are mine and they work fine:
private void InitializeComponent()
{
//Code for Button, etc. initialization here
//
// Form1
//
this.AcceptButton = this.button1;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(433, 260);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.button1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.KeyPreview = true;
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
this.PerformLayout();
}
// Here is the code in the form class
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Minimized;
}
}
//Let me know if it doesn't work still
|
|
|
|
|
Hi Peshkunta,
Thanks for the reply.
I tried adding your code to mine..
But the problem is that there are no properties of the form named as either AutoScaleDimensions or AutoScaleMode:
....<br />
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);<br />
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;<br />
....
I searched the MSDN too, but no such property is listed there. At the most, i was able to find AutoScaleBaseSize and ClientSize.
Here's my code. Can you please see, if there is anything which i need to add.
private void InitializeComponent()
{
this.textBox1 = new System.Windows.Forms.TextBox();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.SuspendLayout();
this.textBox1.BackColor = System.Drawing.Color.White;
this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.textBox1.ForeColor = System.Drawing.Color.Black;
this.textBox1.Location = new System.Drawing.Point(16, 168);
this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(269, 16);
this.textBox1.TabIndex = 1;
this.textBox1.Text = "";
this.richTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.richTextBox1.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(102)), ((System.Byte)(102)), ((System.Byte)(153)));
this.richTextBox1.Location = new System.Drawing.Point(16, 32);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.ReadOnly = true;
this.richTextBox1.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.ForcedHorizontal;
this.richTextBox1.Size = new System.Drawing.Size(269, 128);
this.richTextBox1.TabIndex = 2;
this.richTextBox1.Text = "";
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(433, 260);
this.BackColor = System.Drawing.Color.Lime;
this.ClientSize = new System.Drawing.Size(312, 208);
this.Controls.Add(this.richTextBox1);
this.Controls.Add(this.textBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "Form1";
this.Text = "Form1";
this.TransparencyKey = System.Drawing.Color.Lime;
this.KeyPreview = true;
this.Resize += new System.EventHandler(this.Form1_Resize);
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseDown);
this.Load += new System.EventHandler(this.Form1_Load);
this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseUp);
this.Paint += new System.Windows.Forms.PaintEventHandler(this.Form1_Paint);
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseMove);
this.ResumeLayout(false);
}
Please see, if i am missing anything !!!!
Thanks.
*** Who said nothing is impossible? I have been doing it for a long time ***
|
|
|
|
|
I think the problem is in the event handler functions Form1_Resize, and the others:
this.Resize += new System.EventHandler(this.Form1_Resize);
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseDown);
this.Load += new System.EventHandler(this.Form1_Load);
this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseUp);
this.Paint += new System.Windows.Forms.PaintEventHandler(this.Form1_Paint);this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseMove);
If you can, I would like to see the code in those. I was wondering what method/way you use to minimize the form/dialog since your dialog has no border. Are you using a button, or just a hit-test location on the form to click? If you want to have your own custom minimize button, one easy way to do it is to create a normal button and set it to Flat style, with no text and your image in the button that can change when you press for button being pressed, etc. Make sure the Flat button BorderSize is set to 0 otherwise there will be a border there. And make sure the MouseDownBackColor and MouseOverBackColor are set to Transperent.
-- modified at 1:05 Wednesday 28th December, 2005
|
|
|
|
|
Hi Peshkunta...
Thanks...
That was a real help.
There is some problem with my code.
I had actually used an image which would minimze the window when clicked.
i had always wanted to create a custom button.
Hey, but i am not able to find any property of the button called as BorderSize, MouseDownBackColor and MouseOverBackColor.. Are you talking about VC or C#..??
Maybe i am missing something.. can you please figure it out.
Thanks in advance.
Amrit.
*** Who said nothing is impossible? I have been doing it for a long time ***
|
|
|
|
|
I'm using C# - Visual Studio 8 (2005).
In the button Properties window look for FlatStyle property. Just above it is a propery called FlatAppearence and in front of the text is a + if you click on it it will expand and show you BorderSize, etc.
|
|
|
|
|
Oh great..
No wonder i am not able to find it.
I am using Visual Studio 7.1
I'll check it out... thanks for the help.
Sorry for disturbing you for so long.
I realy appreciate your help.
Thanks a lot.
*** Who said nothing is impossible? I have been doing it for a long time ***
|
|
|
|
|
Not a problem at all - glad to help.
If you don't have the option to do the transparent color in the flat button, alternatively you can use PictureBox or Panel control (I would go with PictureBox) for the same effect. I use PNG files for transparency - if it's transparent in the PNG file it comes out transparent in the button, imagebox, panel etc. Let me know if you find the flat style button transparency property and if you have any other question. You can also make a custom form/dialogbox. So it doesn't have to have the sharp edges - you can have a circle dialog box. If you don't know how to do it and need that, let me know.
PS.
Look and see if you have these properties:
this.button1.FlatAppearance.BorderSize = 0;
this.button1.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Transparent;
this.button1.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Transparent;
this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
|
|
|
|
Yes..
thats exactly what i am doing.. i have made up the window using some images (using GDI+).
That minimize problem was occuring because of the code that i had written for detecting the click on that image used for closing the window. I havent worked down to the root of the problem yet.. i'll do it once i get out of my office.
I was actually inspired to make such a custom window when i used Google Talk.
Its cool... i have made seperate images for the titlebar, the body and the buttons. I had some problem while customizing the button, so i left it for the meanwhile. So, i use GraphicsPath to bring them all together and compose the window.
But i have a problem in store for me... how do i go about writing code to help the user in expanding the window. I mean how to detect when the mouse has been placed on the border of the window and how to expand the window.... because if i do so, the images will be distorted.
Can you tell me, how to go about doing it. Or simply put, what approach do you use... (something which i can implement in Visual Studio 7)
Thanks !!!!
*** Who said nothing is impossible? I have been doing it for a long time ***
|
|
|
|
|
That would be more challenging. Normally the skins in a custom app don't change - the app doesn't visually resize. What you could do in that case is have 4 pictureboxes and dock them in each corner. When the app resizes so will the pictureboxes automatically. What you would have to do in that case is make sure the picture of the border/frame is very high resolution/large picture - large enough so that when it explands it won't get pixelated.
-- modified at 3:37 Wednesday 28th December, 2005
|
|
|
|