|
Hi,
I provide my user controls in a separate "Lib" file, and controls over my user controls cannot be moved by the developer at the design time. How are u able to move the buttons on user controls?
Manoj
Never Give up
|
|
|
|
|
Hi,
I am adding buttons like this,the event is fired from onInsert of the CollectionBase derived class ButtonList
void _ButtonList_OnCustomButtonAdded(CustomButton newCustomButton)
{
int customButtonWidth = 0;
foreach (CustomButton customButton in _tabPagesList)
{
customButtonWidth = customButtonWidth +
customButton.Width;
}
newCustomButton.Left = customButtonWidth - newCustomButton.Width;
newCustomButton.LeftPos = customButtonWidth - newCustomButton.Width;
newCustomButton.Top = 0;
Graphics g = this.CreateGraphics();
float width = g.MeasureString(newCustomButton.Text, BoldTabFont).Width;
newCustomButton.Width = (int)width;
newCustomButton.Parent = this;
newCustomButton.Show();
newCustomButton.Click += new EventHandler(newCustomButton_Click);
newCustomButton.OnCustomButtonMouseDown += new CustomButton.CustomButtonMouseDown(newCustomButton_OnCustomButtonMouseDown);
this.Controls.Add(newCustomButton);
newCustomButton.BringToFront();
}
buttons added are movable at design time
Thanks,
Tushar
|
|
|
|
|
Hello,
How is newCustomButton instanciated?
Tried it in a Test Program, but I never made it like you discriped?
All the best,
Martin
|
|
|
|
|
Hi Martin,
I am having the list like shown below,list of custom buttons,user can add the buttons to my user control from property editor, i have exposed public property from user control.
public TabsPagesList TabPagesList
{
get
{
return _tabPagesList;
}
set
{
if (value != null)
{
_tabPagesList.Add(value);
}
}
}
[DesignTimeVisible(true)]
public class TabsPagesList : CollectionBase
{
public delegate void CustomButtonAdded(CustomButton newTextBox);
public delegate void CustomButtonRemoved(CustomButton newCustomButton);
public event CustomButtonAdded OnCustomButtonAdded;
public event CustomButtonRemoved OnCustomButtonRemoved;
public TabsPagesList()
{
}
public CustomButton this[int index]
{
get
{
return (CustomButton)List[index];
}
set
{
List[index] = (CustomButton)value;
}
}
public void AddCustomButton(CustomButton lb)
{
List.Add((CustomButton)lb);
//base.InnerList.Add(lb);
}
public void Add(TabsPagesList list)
{
base.InnerList.AddRange(list);
}
public bool Contains(CustomButton customButton)
{
return List.Contains(customButton);
}
protected override void OnInsert(int index, object value)
{
base.OnInsert(index, value);
}
protected override void OnInsertComplete(int index, object value)
{
base.OnInsertComplete(index, value);
if (OnCustomButtonAdded != null)
OnCustomButtonAdded((CustomButton)value);
}
protected override void OnRemove(int index, object value)
{
MessageBox.Show("OnRemoveComplete");
if (OnCustomButtonRemoved != null)
{
MessageBox.Show("calling OnCustomButtonRemoved");
OnCustomButtonRemoved((CustomButton)value);
}
base.OnRemove(index, value);
}
protected override void OnRemoveComplete(int index, object value)
{
base.OnRemoveComplete(index, value);
MessageBox.Show("OnRemoveComplete");
if (OnCustomButtonRemoved != null)
{
MessageBox.Show("calling OnCustomButtonRemoved");
OnCustomButtonRemoved((CustomButton)value);
}
}
}
public class CustomButton : Button
{
private ArrayList childControls;
private bool isSelected;
private int _leftPos;
public delegate void CustomButtonMouseDown(MouseEventArgs e);
public event CustomButtonMouseDown OnCustomButtonMouseDown;
public CustomButton()
{
childControls = new ArrayList();
//Load three images here
}
public int LeftPos
{
get
{
return _leftPos;
}
set
{
_leftPos = value;
}
}
protected override void OnMouseMove(MouseEventArgs e)
{
base.OnMouseMove(e);
}
protected override void OnMouseDown(MouseEventArgs e)
{
MessageBox.Show("Inside Button class MouseDown");
base.OnMouseDown(e);
if (OnCustomButtonMouseDown != null)
OnCustomButtonMouseDown(e);
}
public bool IsSelected
{
get
{
return isSelected;
}
set
{
isSelected = value;
}
}
public void AddControl(Control cntrl)
{
childControls.Add(cntrl);
}
public ArrayList InnerControls
{
get
{
return childControls;
}
}
}
Thanks,
Tushar
|
|
|
|
|
Hello,
Make the button a private member of your UserControl!
All the best,
Martin
|
|
|
|
|
UNDER WORDPAIR.CS
using System;
using System.Collections.Generic;
using System.Text;
namespace Assignment_No._2
{
class WordPair
{
string[] rightpair = new string[5]
{"below\tunter","blue\tgelb","cat\tdie katze","red\trot","the dog\tder Hund","to read\tlesen"
};
public string CheckMatch(string english, string german)
{
string combined = english + "\t" + german;
if (Array.IndexOf(rightpair, combined) != -1)
{
return String.Format("'{0}'was correctly matched with '{1}'", english,
german);
}
else
{
return String.Format("No match was found for '{0}'with '{1}'",
english, german);
}
}
}
}
________________________________________________________________________
UNDER FORM 1.CS
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Assignment_No._
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
WordPair wp = new WordPair();
string result1 = wp.CheckMatch("below","unter");
string result2 = Environment.NewLine + wp.CheckMatch("blue", "rot");
richTextBox1.Text = result1 + result2;
}
}
}
___________________________________________________________________________
UNDER PROGRAM C.S
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace Assignment_No._
{
static class Program
{
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
//WordPair wp = new WordPair();
//string result1 = wp.CheckMatch("below", "unter");
//string result2 = Environment.NewLine + wp.CheckMatch("blue", "rot");
//richTextBox1.Text = result1 + result2;
}
}
}
___________________________________________________________________________
BUILD ERRORS
Error 2 The type or namespace name 'WordPair' could not be found (are you missing a using directive or an assembly reference?) E:\Documents and Settings\Ntiko\My Documents\Visual Studio 2005\Projects\Assignment No.2\Assignment No.2\Form1.cs 20 13 Assignment No.2
------------------------------------------
Error 3 The type or namespace name 'WordPair' could not be found (are you missing a using directive or an assembly reference?) E:\Documents and Settings\Ntiko\My Documents\Visual Studio 2005\Projects\Assignment No.2\Assignment No.2\Form1.cs 20 31 Assignment No.2
---------------------------------------------
Error 4 The type or namespace name 'WordPair' could not be found (are you missing a using directive or an assembly reference?) E:\Documents and Settings\Ntiko\My Documents\Visual Studio 2005\Projects\Assignment No.2\Assignment No.2\Program.cs 18 15 Assignment No.2
----------------------------------------
Error 5 The type or namespace name 'WordPair' could not be found (are you missing a using directive or an assembly reference?) E:\Documents and Settings\Ntiko\My Documents\Visual Studio 2005\Projects\Assignment No.2\Assignment No.2\Program.cs 18 33 Assignment No.2
-------------------------------------------------
Error 6 The name 'richTextBox1' does not exist in the current context E:\Documents and Settings\Ntiko\My Documents\Visual Studio 2005\Projects\Assignment No.2\Assignment No.2\Program.cs 21 15 Assignment No.2
--------------------------------------------------
Error 7 Invalid rank specifier: expected ',' or ']' E:\Documents and Settings\Ntiko\My Documents\Visual Studio 2005\Projects\Assignment No.2\Assignment No.2\WordPair.cs 10 5 Assignment No.2
-----------------------------------------------------
Also pop up message saying that;
Visual studio cannot start debugging because the debug target E:\Documents and Settings\Ntiko\my Documents\visual studio 2005\projetcs\Assignment No.2\Assignment No.2\bin\Debug\Assignment No.2.exe' is missing. Please build the project and retry or set the outpath and Assembly Name properties appropriately to point at the correct location for the target assembly.
Any suggestions resolving this kind of staff?????
Ntoki
|
|
|
|
|
As the class and the code that uses it are in separate namespaces, you either need a using statement to locate the namespace of the class, or you have to specify the complete namespace everytime you use the name of the class.
---
single minded; short sighted; long gone;
|
|
|
|
|
Hi,
I need to send startDate to a Service like following format.But I need to send it as a DateTime Object NOT like string format.So How do I send following Date with DateTime Object?
<startdate>2007-07-29T00:00:00.0000000+05:30
Please kindly reply me.
Thanks in advance.
|
|
|
|
|
Hi,
DateTime is a serializable class, and there is no issue sending it to the Services like "Remoting" server as a parameter of a interface function call.
Also, if you are trying to send it to the other service which has been written using C#, you can serialize the DateTime object and send it as "byte" data, and get it deserialized at the sever end.
Manoj
Never Give up
|
|
|
|
|
Hi,
Thanks for reply. But in my XML Web Service,There is a DateTime Property called "StartDate".
So I need to send following format to there as a DateTime object.
2007-07-29T00:00:00.0000000+05:30
Problem is how can I send +05:30 with the DateTime object?.
Thanks in advance
|
|
|
|
|
why dont you use one more parameter for the Time Zone value.
Manoj
Never Give up
|
|
|
|
|
hi,
We are unable to change the xml webservice.We can send request to service and take response.
In the Request we need to send StartDate with Time Zone.
Thanks in advance.
|
|
|
|
|
Maybe this helps
string dateformat;
TimeZone localZone = TimeZone.CurrentTimeZone;
dateformat = DateTime.Now.ToString("yyyy-MM-dd") + "T" DateTime.Now.TimeOfDay.ToString() + localZone.GetUtcOffset(DateTime.Now);
dateformat gets somting like:
"2007-05-21T18:26:24.8906250-03:00:00"
you may need to cut the last ":00".
Replace de DateTime.Now for the DateTime Object you need to send.
|
|
|
|
|
hi
Iunderstand how to use :
public test: Interface
{
}
but,
what is the meaning of this statement:
Isomething x ;
I saw it in :
Icontainer component = null;
and
Excel.application app = new Excel.application();
how can I use the above?
|
|
|
|
|
An interface guarantees that a class will implement some methods. Suppose that you have an interface called IPlugin that contains one method called DoSomethingFunky. The interface is to be used as the basis for all plugins for your application. Now, in your code you don't know what the external classes are going to be and you certainly can't compile against them so you need some method for creating these unknown classes. Well, you can do this by using
IPlugin plugin = null;
plugin.DoSomethingFunky();
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
It is a variable declared with an inteface type instead of a class type and can hold any object that implements the interface.
To give the simplest example, if you have:
public interface IMyInterface{}
public class ClassWhichImplementsMyInterface:IMyInterface{}
You can use the following in your code:
IMyInterface MyVariable = new ClassWhichImplementsMyInterface();
A good example of the usefulness of this in the .net framework is the foreach statement which will accept any object that implements the IEnumerable interface. It uses objects that implement IEnumerable and knows how to handle them based on that interface.
-- modified at 11:11 Monday 21st May, 2007
topcoderjax
|
|
|
|
|
do you knows how it works
in Excel namespace?
the code goes:
Excel.application app = new excel.application();
Excel.application is an Interface!
but I don't need to implement any of the Excel.application interface, I just use it's methods
like a regular class.
p.s. It's shows in msdn also.
|
|
|
|
|
I am using Datagrid to show data.I am also using header template to show column headers.
Now I want to have one row above the header which contains the name of the datagrid and colspan="no of columns" which can be achieved in HTML table. How can i do in Datagrid ?? Any ideas??
Thanx in advance.
|
|
|
|
|
Hello,
Does anybody have SDK of Digital Persona Finger Reader 4000B? or any help material regarding this.
Thank and best regards,
waqasb4all@yahoo.com
|Muhamad Waqas Butt|
waqasb4all@yahoo.com
www.sktech.freewebspace.com
|
|
|
|
|
After reading this post, what do you think the first website would be that anyone is going to go to to find this?
What do you think they'll type into the little search box?
How much do you want to bet that what you seek will be the first item listed in the results?
|
|
|
|
|
Hi,
I'm assigning value to a DataSet ds (from SQL database) in button A Click event and I set this dataset as DataSource for my grid.
Next if I check the value of this DataSet ds in another button click event, I can't get its value. ds is a Class variable, but I still can't get its value.
The DataSet has one table, which I can see in button A Click event, but in another button event click if i Check the values of ds.Tables.Count, its zero. I'm not manipulating the DataSet anywhere. Could anyone tell me why this happens?
Regards,
Blumen
|
|
|
|
|
Your post contains some ambiguity.
blumenhause wrote: ds is a Class variable
What do you mean by class variable?
Do you mean:
* static field
* member instance field
blumenhause wrote: but I still can't get its value.
blumenhause wrote: The DataSet has one table, which I can see in button A Click event, but in another button event click if i Check the values of ds.Tables.Count, its zero.
So, which is it? Either you can see the dataset or you can't.
Is this an ASP.NET application? If so, remember that state is not maintained between postbacks.
|
|
|
|
|
Colin Angus Mackay wrote: Your post contains some ambiguity.
Yes, this is a private Class variable or a field (its declared inside the class outside all Methods)
This is an ASP.NET code-behind file. But there is no post back here. I click Button A and dataset gets filled with data. Now I put a break point in button B click event and inside that button I check if this dataset using Quick Watch in VS 2003. But although inside Button A click event handler the ds showed 1 Table, inside B's click handler its showing zero Tables.
|
|
|
|
|
Is this in ASP.NET pages?
You might have a postback problem...?
|
|
|
|
|
Hi,
This is an ASP.NET code-behind file. But there is no post back here. I click Button A and dataset gets filled with data. Now I put a break point in button B click event and inside that button I check if this dataset using Quick Watch in VS 2003. But although inside Button A click event handler the ds showed 1 Table, inside B's click handler its showing zero Tables.
|
|
|
|