|
Please don't cross post.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
i need good materials in oop with c# from begining to advanced
ma_refay
|
|
|
|
|
OOP isn't C# specific. Google "OOP" and there's a wealth of information.
|
|
|
|
|
The problem is that I cant paint a part of an image on the screen if its not rectangular. Instead the whole pic is painted which I don't need....
Secondly when I draw on the picture Box its not visible on it. Instead it appear beneath the picturebox.
ANd thirdly how can I save the edited image from the sceeen...... HEres a link 4 the demo project which is a sample 4 my project...
http://www.salonstyler.com/download.php
Any help making this type of software........... Wht will u recomment me should I use picturebox or simply paint the image on the screen??? Thanx in advance
|
|
|
|
|
I hope I understand your problem correctly,
You may find it easier to build your image up from a Bitmap object then set it to the PictureBox.Image property. Then you can easy save the image.
If only part of the image has been updated you can call the PictureBox.Invalidate Method. You can pass this a Region or Rectangle so only that part of the control is repainted.
|
|
|
|
|
samreengr8 wrote: Wht will u recomment me should I use picturebox or simply paint the image on the screen???
Always paint it yourself unless your needs are trivial
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
hi
i have three things
1. a client machine connected to internet
2. webserver where my data exits
3. a local server (my client is not connected to server)
now i need to pick a file from local server and put in my webserver
this should happen when a client machine requests.
i am able to copy a file from webserver to a local machine but network issues rises up if i put the same logic in web server how to over come
do i need to use remoting to avoid this situation
if it is how ?
|
|
|
|
|
Hi everyone
I'm having a problem where I want to retrieve data from a MS Access database using ADO.NET. I'm using a 1D dataset to get the data from the database and now I want to further copy the data from the dataset into a string array. I've tried several things but nothing seemes to work out. Plaese give me some suggestions on have this could be done, maybe I shouldn't use a dataset at all?...
Best wishes
Al
|
|
|
|
|
|
Hello all:
I have this code below to display whatever the Browse is selected. For example, if user select C:\cmd.exe. I would like to add the "*" after backward slash. So it would be C:\cmd.exe\*.
OpenFileDialog dlg = new OpenFileDialog();
if (dlg.ShowDialog() == DialogResult.OK)
{
tb_batchparams.Text = dlg.FileName;
}
System.Diagnostics.Process proc1;
System.Diagnostics.ProcessStartInfo procInfo = new System.Diagnostics.ProcessStartInfo();
procInfo.WorkingDirectory = "C:\\dcm\\bin";
procInfo.FileName = "scu.exe";
procInfo.Arguments = tb_batchparams.Text // how do I include "\*" so it would be C:\dcm\bin\scu.exe\* instead.
proc1 = System.Diagnostics.Process.Start(procInfo);
Thanks,
eyungwah
|
|
|
|
|
use @"\* " or "\\* "
SkyWalker
|
|
|
|
|
I am doing a project and I just created a user control(consist of text boxes, labels and combo boxes) that added in more than one tab pages. I am being able to add the user control in the tab pages. e.g. The same user control added in three tabpages. But I would like to save the value of the text boxes of the user controls added in the respective tab pages. how could i?
|
|
|
|
|
How do you mean - save to where ? To a file ? To each other ?
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
|
Expose the TextBox.Text property as a property of your UserControl . eg
public string TextBoxText
{
get { return textBox1.Text; }
set { textBox1.Text = value; }
}
|
|
|
|
|
I created a user control that contains labels, textboxes and comboboxes and added it in my tabpages(4 tabpages) dynamically through programming.
I created a class named clsProject and declared a read write property Name from where textboxes will get there values. e.g
"txtName.Text = clsProject.Name"
My Question is :
I would like to display it in all my tabpages. But how could I? I would like to do this in following manner.
tabcontrol1.tabpages1.textName.text = clsProject.Name
tabcontrol1.tabpages2.textName.text = clsProject.Name
So that I can save the corresponding tab pages text box control values
in a routine name Save(), if the user changes the Name of for each tabpages.
e.g.
Void Save()
{
clsProject.Name = tabcontrol1.tabpages1.textName.text
clsProject.Name = tabcontrol1.tabpages2.textName.text
}
Can you tell me how can I resolve this problem ?
|
|
|
|
|
I created a user control that contains labels, textboxes and comboboxes and added it in my tabpages(4 tabpages) dynamically through programming.
I created a class named clsProject and declared a read write property Name from where textboxes will get there values. e.g
"txtName.Text = clsProject.Name"
My Question is :
I would like to display it in all my tabpages. But how could I? I would like to do this in following manner.
tabcontrol1.tabpages1.textName.text = clsProject.Name
tabcontrol1.tabpages2.textName.text = clsProject.Name
So that I can save the corresponding tab pages text box control values
in a routine name Save(), if the user changes the Name of for each tabpages.
e.g.
Void Save()
{
clsProject.Name = tabcontrol1.tabpages1.textName.text
clsProject.Name = tabcontrol1.tabpages2.textName.text
}
Can you tell me how can I resolve this problem ?
|
|
|
|
|
If you want them to all be the same, then make a static property that stores the string, and a static array of textboxes, which each textbox adds itself to. Then, changing it in one instance, will change it in all.
The other option is to set up a delegate, so each control lets the parent form know when it's changed, and it sets them all, with the sort of code you have above.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
You mean in each tab the value of the textbox to be always the same?
|
|
|
|
|
I created a user control that contains labels, textboxes and comboboxes and added it in my tabpages(4 tabpages) dynamically through programming.
I created a class named clsProject and declared a read write property Name from where textboxes will get there values. e.g
"txtName.Text = clsProject.Name"
My Question is :
I would like to display it in all my tabpages. But how could I? I would like to do this in following manner.
tabcontrol1.tabpages1.textName.text = clsProject.Name
tabcontrol1.tabpages2.textName.text = clsProject.Name
So that I can save the corresponding tab pages text box control values
in a routine name Save(), if the user changes the Name of for each tabpages.
e.g.
Void Save()
{
clsProject.Name = tabcontrol1.tabpages1.textName.text
clsProject.Name = tabcontrol1.tabpages2.textName.text
}
Can you tell me how can I resolve this problem ?
|
|
|
|
|
I really can't understand what you are after!
Also in your code snipets you have two sequencial commands that practically ony the second has meaning.
By the way posting the same in two different persons trying to help and asking different questions is not the way.
|
|
|
|
|
I have 4 different cases for you:
If you need the same TextBox in each of your tab pages, you may consider adding one TextBox
to the TabControl (i.e. outside the tab pages) rather than to each individual page.
If you need the same TextBox on some of your tab pages, you may still put it on the tab control
(outside the tab pages) and you could alter its Visible state according to which tab page
is currently active.
If you need the same TextBox on some of your tab pages, and the instances have identical
properties (such as font, backcolor, location, size, etc), then I would use Visual Studio
Designer to add such TextBox to one of the pages, then programmatically add the same instance
of TextBox to the other relevant tab pages. Something like
tabpage.Controls.Add(myExistingTextBoxFromTabPage1);
Then there is no doubt whatever relevant tab page you select you would see the same TextBox
content, since there is actually only one instance.
This will save you a lot of code that would otherwise be needed to keep multiple TextBoxes
in sync.
If your TextBoxes have different attributes on different tab pages, more code will be
unavoidable.
Luc Pattyn
|
|
|
|
|
I created a user control that contains labels, textboxes and comboboxes and added it in my tabpages(4 tabpages) dynamically through programming.
I created a class named clsProject and declared a read write property Name from where textboxes will get there values. e.g
"txtName.Text = clsProject.Name"
My Question is :
I would like to display it in all my tabpages. But how could I? I would like to do this in following manner.
tabcontrol1.tabpages1.textName.text = clsProject.Name
tabcontrol1.tabpages2.textName.text = clsProject.Name
So that I can save the corresponding tab pages text box control values
in a routine name Save(), if the user changes the Name of for each tabpages.
e.g.
Void Save()
{
clsProject.Name = tabcontrol1.tabpages1.textName.text
clsProject.Name = tabcontrol1.tabpages2.textName.text
}
Can you tell me how can I resolve this problem ?
|
|
|
|
|
Since you want the TextBox visible on each of the tab pages, I would go for one of these
two possibilities:
1)
-with Designer (or programmatically) add the TextBox on the first tab page (say it is named
"textName1"), and leave the same place free on all other tab pages
- programmatically add the SAME TextBox to the other tab pages. Something like:
bool firstPage=true;
foreach (TabPage page in myTabControl) {
if (!firstPage) page.Controls.Add(textName1);
firstPage=false;
}
Of course you could also use the tab page names explicitly:
tabPage2.Control.Add(textName1);
tabPage3.Control.Add(textName1);
tabPage4.Control.Add(textName1);
or
2)
do not add the TextBox to one or more tab pages, but add it to the form that is holding
the tab control (not "to the tab control" as I had put in my previous post, that was
slightly wrong, really to the form holding the tab control).
In both cases, there is only one TextBox control, it is named textName1, so you have
to set its text only once, have to save its text only once, etc.
Luc Pattyn
|
|
|
|
|
for example:
//---------------------------------------------
// Sender
//---------------------------------------------
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Runtime.InteropServices;
namespace WinFormSendMsg
{
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button button1;
private System.ComponentModel.Container components = null;
const int WM_COPYDATA = 0x004A;
public Form1()
{
InitializeComponent();
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
private void InitializeComponent()
{
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(12, 24);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(100, 20);
this.textBox1.TabIndex = 1;
this.textBox1.Text = "textBox1";
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(12, 70);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(100, 20);
this.textBox2.TabIndex = 2;
this.textBox2.Text = "textBox2";
//
// button1
//
this.button1.Location = new System.Drawing.Point(205, 231);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(112, 32);
this.button1.TabIndex = 1;
this.button1.Text = "button1";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6F, 13F);
this.ClientSize = new System.Drawing.Size(292, 266);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.button1,
this.textBox1
this.textBox2});
this.Name = "Form1";
this.Text = "Sender";
this.ResumeLayout(false);
}
static void Main()
{
Application.Run(new Form1());
}
[DllImport("User32.dll",EntryPoint="SendMessage")]
private static extern int SendMessage(
int hWnd, // handle to destination window
int Msg, // message
int wParam, // first message parameter
ref COPYDATASTRUCT lParam // second message parameter
);
[DllImport("User32.dll",EntryPoint="FindWindow")]
private static extern int FindWindow(string lpClassName,string
lpWindowName);
private void button1_Click(object sender, System.EventArgs e)
{
int WINDOW_HANDLER = FindWindow(null,@"Accepter");
if(WINDOW_HANDLER == 0)
{
}
else
{
COPYDATASTRUCT cds;
cds.dwData = (IntPtr) 100;
WholeInfo wi = new WholeInfo();
wi.m_centralFilePath = this.textBox1.Text;
wi.m_localFilePath = this.textBox2.Text;
cds.cbData = Marshal.SizeOf(wi);
IntPtr p = Marshal.AllocHGlobal(Marshal.SizeOf(wi));
Marshal.StructureToPtr(wi, p, true);
cds.lpData = p;
SendMessage(WINDOW_HANDLER, WM_COPYDATA, 0, ref cds);
}
}
}
public struct COPYDATASTRUCT
{
public IntPtr dwData;
public int cbData;
public IntPtr lpData;
}
public struct WholeInfo
{
public String m_centralFilePath;
public String m_localFilePath;
};
}
//------------------------------------------------------------
//Accepter:
//------------------------------------------------------------
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Runtime.InteropServices;
namespace WindowsFormGetMsg
{
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.TextBox textBox1;
private System.ComponentModel.Container components = null;
const int WM_COPYDATA = 0x004A;
public Form1()
{
InitializeComponent();
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
private void InitializeComponent()
{
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(12, 24);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(100, 20);
this.textBox1.TabIndex = 1;
this.textBox1.Text = "textBox1";
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(12, 70);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(100, 20);
this.textBox2.TabIndex = 2;
this.textBox2.Text = "textBox2";
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(432, 266);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.textBox1
this.textBox2});
this.Name = "Form1";
this.Text = "Accepter";
this.ResumeLayout(false);
}
static void Main()
{
Application.Run(new Form1());
}
protected override void DefWndProc(ref System.Windows.Forms.Message m)
{
switch(m.Msg)
{
case WM_COPYDATA:
COPYDATASTRUCT mystr = new COPYDATASTRUCT();
Type mytype = mystr.GetType();
mystr = (COPYDATASTRUCT)m.GetLParam(mytype);
WholeInfo h;
h = (WholeInfo)Marshal.PtrToStructure(mystr.lpData, typeof(WholeInfo));
this.textBox1.Text = h.m_centralFilePath;
this.textBox2.Text = h.m_localFilePath;
break;
default:
base.DefWndProc(ref m);
break;
}
}
}
public struct COPYDATASTRUCT
{
public IntPtr dwData;
public int cbData;
public IntPtr lpData;
}
public struct WholeInfo
{
public String m_centralFilePath;
public String m_localFilePath;
};
}
-------------------------------------------------------------------------
above is my test code, but there are some problem,sometimes it will crash, sometimes the Accepter Form's textBox1 and textBox2.Text display null or other error letter,never correct!
If any boy know the method to solve those problem,please teach me, it is better to give out the right code,full of thanks!
JimmyHu
|
|
|
|