|
I am currently working on a digramming tool. I have used picture box as the container and have made a control called as the BoxControl...now i wish to make a control that can join teo box control by a line as we do it in Visio..I am drawing a diagram below to elucidate the problem
|||||||||| |||||||||
|BoxCtrl |==========|BoxCtrl| The link shown between the two blocks is what ia m looking 4
|||||||||| |||||||||
It would be great if someone could send a samplecode__otherwise the logic is fine.
Thanks in advance
RaHuL
|
|
|
|
|
I'm looking for a tutorial/primer that will explain the very basics of using Visual Studio, C#, and SQL Express to build applications. I've not worked with databases and c# before - so I'm new to this.
Anyone know of a good place to find this information?
I've been looking, but haven't found anything good. Thanks.
|
|
|
|
|
Let me rephrase that. I work constantly with C#, and I've worked with SQL databases, just not both together. I have a very simple understanding of ADO.NET. I'm most interested in finding out the correct way to use "data sources" via the VS IDE's interface as connections to databases.
I hope that makes sense. Thanks again.
|
|
|
|
|
Hi,
I was wondering.......why so many calls are made to OnPaint method of the Form when ClientRectangle of the button needs to be invalidated.
I was testing some of the vs2005 features and i run a simple test which involved label, button and a call to OnPaint method.
This was done on XP Pro system.
The result was that each time the buttons ClientRectangle needs to be invalidated the Forms OnPaint method gets called. - just moving the mouse, on and off the button would call the Forms OnPaint method.
This happened only when button's style was set to Standard or System, otherwise everything works as expected.
(I used "label.text" to display #of calls to OnPaint( ) )
I've tried other standard vs2005 controls and this intensive (strange) calling of Forms OnPaint( ) manifested itself only with the button.
What am i missing here? Should this be happening?
Seems like a waste of resources.......
-- modified at 16:51 Friday 25th November, 2005
|
|
|
|
|
is there a way i can 'create a new desktop and switch to it' like in the 'winlock' program at http://www.codeproject.com/win32/AntonioWinLock.asp - i dont want to use a dll. is there anything in c# that can do this?
thanks,
sam kline
|
|
|
|
|
C# is just a language. It, and others, like VB or C++, don't have anything that can do any of this. On the other hand, they all have the ability to call the Win32 Library functions needed to pull this off. All you have to do is call (P/Invoke in the .NET world) the necessary functions just like described in the article. If you want more detail, you'll have to dig into his .DLL code to see how it's done, then rewrite that code in C#.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello all.
When I developed apps in C# with Visual Studio 7, and if I wanted to create a connection to a table within a form, I simply used to drag such table from the "Server explorer" window into my form. It created then a SqlConnection and a SqlDataAdapter objects and life was easier.
Now I'm working with Visual Studio 8, and it won't let me drag a table from the "server explorer" window. Does this mean that I will have to code myself the SqlDataAdapters? Is there any possible way of doing what I used to do with VS7? Why Microsoft changed such a good feature?
Thanks a lot,
KK.
One day you'll find
that I have gone,
for tomorrow may rain, so
I'll follow the sun...
|
|
|
|
|
Hello:
Anyone knows how to encrypt a username and password in C#.Net ?
Thanks and appreciate it
|
|
|
|
|
Hello,
How can I encrypt a username and password in C#.net ?
Thanks
|
|
|
|
|
|
Hi Dears!
I need ur help to tackle the following scenario.
I have total two win forms. F1,F2
F1 contains control,Timer,DateTimePicker ,Some text lable
and A pictureBox, all are private.
F2 inherits F1 ( F2:F1) when i call show methed for F2 with its instance all the controls of form F1 are visible on F2 hat i want to keep some of the controls invisble(not inherted and not visble) in inherited form F2.
For Example i want the pictureBox control in F1 to be
(public/private)static and not inhertable ,non visble on form F2. How to do
this?
Thnx in Advance!
|
|
|
|
|
When you inherit a class all your base private members ar hidden. You can not inherit only certain memberber...
Here are some possible resolutions for your problem :
1) make a base constuctor that allows you to specify the hiding of certain controls. Let's say you have a form (F1) with a button. The form which inherits F1 can call a base constuctor to specify this :
public class F1 : ... {
...
System.Windows.Forms.Button button1 = new System.Windows.Form.Button();
...
public F1() {
...
...
}
public F1(bool hideButton) : this() {
button1.Visible = hideButton;
}
...
}
public class F2 : F1 {
...
public F2 : base(true) {
}
...
}
2) Build in the base class an accesor that let's you change the state of certain controls (ie. the visible property of a button as in the previous example)
public class F1 : ... {
...
System.Windows.Forms.Button button1 = new System.Windows.Form.Button();
...
public SetButtonVisibility {
get {
return button1.Visible;
}
set {
button1.Visile = value;
}
}
public F1() {
...
...
}
...
}
public class F2 : F1 {
...
public F2 : base(true) {
SetButtonVisibility = false;
}
...
}
I hope you understand...because is a rough world out there...
|
|
|
|
|
hi,
I am new to this stuff.
i have an abstract class which i should inherit from another class. it is not a problem if it a console based application but if the class, that i would like to inherit the abstract class, is gui based (that inherits System.Windows.Forms.Form) then i have a problem.
how should i resolve this problem
with best regards,
rnv
|
|
|
|
|
In theory you should be able to inherit from the abstract class, regardless of the new class gui, unless there's some methods that have to be overidden. How exactly is the problem expressed? Compile error or runtime error?
Stewart DIBBS
|
|
|
|
|
thanks,
here is what i did but got error that the class is not an interface
public class MyClass : System.Windows.Forms.Form, MyAbstractClass
{
....
}
what is the correct syntax?
regards,
rnv
|
|
|
|
|
.NET does not support multiple inheritance. You can only inherit from one base class. Although, you can inherit from multiple interfaces.
You might consider looking at refactoring MyAbstractClass so that can be used in something like the Strategy pattern.
public class MyClass : System.Windows.Forms.Form
{
protected MyFormerlyAbstractClass functionality = new MyFormerlyAbstractClass();
public void SomeMethod()
{
functionality.SomeMethodOnMyFormerlyAbstractClass();
}
}
You could also create an interface to expose the methods that MyAbstractClass would have exposed then implement them in MyClass like this:
public void SomeInterfaceMethod()
{
functionalty.SomeInterfaceMethod();
}
that way, external objects that interact with MyClass won't see any difference to how you would have wanted it anyway.
It isn't a perfect solution, but I think it would work for you.
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
I have to interface to an OEM unmanaged library that uses structs. My code mostly works but I'm stuck on one point. The library .H contains
<code>typedef struct
{ unsigned long size;
unsigned long _private_data[64];
} Settings;</code>
and
<code>ReadSettings (HANDLE h, Settings* pSettings);</code>
which I've coded in C# as
<code>[StructLayoutAttribute(LayoutKind.Explicit)]
public struct Settings
{
[FieldOffsetAttribute(0)]
public uint size;
[FieldOffsetAttribute(4)]
public uint[] _private_data; // 64
public void InitSettings() // because my constructor does not get called...
{
size = 260; // size in bytes
_private_data = new uint[64];
}
public QCam_Settings(int zero) // required but not called ...why?
{
size = 260; // size in bytes (is this correct? Its OK in C++.)
_private_data = new uint[64];
}
}</code>and
<code>ReadSettings(IntPtr myHandle, ref Settings mySettings);</code>
then later
<code> Settings mySettings = new Settings();
mySettings.InitSettings();</code>
This gets used in a call to
<code>ReadSettings(handle, ref mySettings);</code>
This compiles correctly but generates a "Object reference not set to an instance of an object." error at runtime. Also tried using an array so the ref might work
<code>Settings mySettings[] = new Settings[1];
mySettings[0].InitSettings();
ReadSettings(handle, ref mySettings[0]);</code>
but get the same runtime error.
The OEM library has another struct that I can call successfully using the above. I've been on this for three days: anyone got an idea what I'm doing wrong?
Stewart DIBBS
Ottawa, Canada
|
|
|
|
|
|
Thanks for the clue. After a few minutes of experimentation, actual code that works is now
[FieldOffsetAttribute(4), MarshalAs(UnmanagedType.ByValArray,SizeConst=64)]<br />
public uint[] _private_data;
So simple ... yet so hard to solve without third-party input...
Stewart DIBBS
|
|
|
|
|
1. How to create animation and store it in Drawing.Image object? Not from a file? but from an array of Bitmap for ex.
2. How to extract all frames from Image object for editing?
|
|
|
|
|
You could type "animated image" into the search box on the home page of CodeProject and find this article.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
So I can't create animation and store it in Image class?
Thx anyway
|
|
|
|
|
He didn't say that.
He said "You could type 'animated image' into the search box on the home page of CodeProject..." ! Then you can click on and read the appropriate articles returned by the search function.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
There are NO articles about 'animated image'
The most appropriate was "NGif" article about creating .gif using separate class.
But I need to store animation in Image class in some way.
And .gif has only 256 colors - I need 24bit color.
|
|
|
|
|
How to cancel a tabcontrol selectedindex event?
I can't find a proper event to do this.
in 2.0 framework, some events were added:
Deselected : Occurs when a tab is deselected.
Deselecting : Occurs before a tab is deselected, enabling a handler to cancel the tab change.
but how is it possible in .net < 2.0
thanks in advance,
Niko
|
|
|
|