|
|
I have a main form that my all tables filled in a dataset on that form.(i creat this DataSet visually , by drag and droping)
I create sum child forms that each one have a DataGrid object.
I want to set each DataGrid`s DataSource property to MainForm`s DataSet.
i want to do this action visually.(in other word, i want to set DataGrid`s DataSource property in PropertyGrid in each form.)
please guide to me.
|
|
|
|
|
You need to implement a custom designer. Read Enhancing Design Time Support[^] and also read the links to class documentation throughout those articles.
If you have specific question, then please ask; but you must understand the basic concepts. If you're having troubles, there's lots of articles here on CodeProject decribing the ComponentModel (as I've mentioned before). This forum is not for large, article-length replies, nor is it intended to do your job for you (like just asking for such support in your app, although you probably didn't know so I'll give you the benefit of doubt).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
|
Hello !
I have written a small CAD program. My problem is drawing a text vertical left beside a dimensioning line wich you can read down upward.
Example code :
==============================================
string tmp = tFigure.Length.ToString();
//Measure the string length
sizeText = g.MeasureString(temp,Font);
//Drawing string centered left beside the dimensioning line
//but the text is up downward
strfmt = new StringFormat(StringFormatFlags.DirectionVertical |
StringFormatFlags.DirectionRightToLeft );
g.DrawString(temp,Font,brush,xof+rasteranfang.length+rlxof ... usw.)
==============================================
I tried to omit the DirectionRightToLeft-Flag, but it´s the same problem.
Another try was to use g.RotateTransform(90) before the DrawString method, but the rest of the other grafic elements are wrong after that.
Perhaps someone has a simple solution for me.
Thanks for the efforts.
|
|
|
|
|
Here is a quick example to draw text vertically:
string text = "This will work";
Graphics g = Graphics.FromHwnd(this.Handle);
Font f = new Font("Verdana", 14f);
SizeF size = g.MeasureString(text, f, new PointF(0, 0), new
StringFormat(StringFormatFlags.DirectionVertical));
RectangleF rect = new RectangleF(0, 0,
size.Width, size.Height);
GraphicsContainer container = g.BeginContainer();
g.SetClip(rect, CombineMode.Replace);
g.TranslateTransform(rect.Width, rect.Height);
g.RotateTransform(180);
g.DrawString(text, f, new SolidBrush(Color.Black), rect.X,
rect.Y, new StringFormat(StringFormatFlags.DirectionVertical));
g.EndContainer(container);
- Nick Parker My Blog | My Articles
|
|
|
|
|
Hi.
I'm new to C# and WS in general and i'm trying to write a simple windows application that get's the latest article briefs from codeproject's webService, but i keep getting an exception. maybe you can help me out here ?
com.codeproject.www.LatestBrief ws = new com.codeproject.www.LatestBrief();
int maxNum = ws.GetMaxArticleListLength();
com.codeproject.www.ArticleBrief[] ar = ws.GetLatestArticleBrief(maxNum);
foreach (com.codeproject.www.LatestBrief lb in ar )
{
articles.Items.Add(lb.ToString());
}
Thanks.
|
|
|
|
|
Why don't you tell us what the exception is? It's hard to help you with a problem when we don't know what the problem is.
Besides, lb.ToString (defined by LatestBrief.ToString ) probably won't give you want you want. By default, ToString returns the type (so "com.codeproject.www.LatestBrief"). You have to output the data yourself, or if articles is an ArrayList or something just add lb , since you can't reconstitute a LatestBrief just from the type name.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks for the reply.
The exception information is:
An unhandled exception of type 'System.NullReferenceException' occurred in codeProjectWs.exe
Additional information: Object reference not set to an instance of an object.
When i use the same code to the the messageBoards brief, it works just fine. it seems as if the web service isn't functioning properly.
as for the .ToString, i get you.
Thanks again.
|
|
|
|
|
Our school project is this, it detects incoming messages from bluetooth or infrared and disperse the corresponding softdrinks in our vendo machine, to minimize cost, we handle it via infrared or bluetooth instead of SMS. You create a phonebook entry in your cellphone with the name COKE, SPRITE, or ROYAL. If you want to order either of the following, just send the phonebook entry via bluetooth or infrared, and the program handles it automatically (without user interaction). When an incoming message is detected, windows will display a message like "Incoming file, do you want to receive it?", with a YES/NO option. I want my program to automatically click the YES option to create the file and my program will handle the order. The handling part is already finished, if I clicked the YES button. I just want it to be automatically handled. Please help, thanks in advance.
|
|
|
|
|
|
Hi,
I am trying to write a GINA stub that uses a .NET assembly.
The GINA stub delegates all its functions to the original msgina.dll
When I am trying to acces a .NET assembly from the GINA, I get the HRESULT 0x800401E4 (Invalid Syntax).
When I put the same code of the GINA that access the assembly in a regular application (Unmanaged C++ WIN32 Console) it works.
When I run the same code from the GINA I get the HRESULT 0x800401E4 (Invalid Syntax). I also tried to work with the CorBindToRuntimeEx() functions, but when I get to load the assembly or create the object instance it gives the same error.
Does anyone encountered this problem?
Maybe it something with secutity that I don't know about?
Here is a snippet of my code
GINA.cpp
-------------
...
#pragma warning (disable: 4278)<br />
#import <mscorlib.tlb> raw_interfaces_only<br />
#import "Checker.tlb" no_namespace named_guids<br />
<br />
int Check(long param)<br />
{<br />
ICheck *check = NULL;<br />
<br />
HRESULT hr = CoCreateInstance(<br />
CLSID_Check,<br />
NULL, <br />
CLSCTX_INPROC_SERVER,<br />
IID_ICheck, <br />
reinterpret_cast<void**>(&check));<br />
<br />
<br />
if (FAILED(hr)) <br />
return false;<br />
<br />
int result = check->Check(param);<br />
<br />
check->Release();<br />
<br />
return result;<br />
} ...
Check.cs
--------
...
[Guid("E726B4A3-5536-4f06-9554-A57526B27D92")]<br />
public interface ICheck<br />
{<br />
int Check(int param);<br />
}<br />
<br />
[Guid("47339B99-97BB-4148-BAA4-A793295ABA38")]<br />
public class Check : ICheck<br />
{<br />
int Check(int param)<br />
{<br />
int result = 0;<br />
<br />
return result;<br />
<br />
}<br />
} ...
|
|
|
|
|
I already put a lock on ports...But, he is still getting through because I still see TIME_WAIT message underports and Remote IP addresses that vary...
|
|
|
|
|
And this has what to do with the C# language?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have a Resize method that I want called only when the user changes the size of the form. But when I Load that form for the first time I notice that the resize event gets called. Is there some way to prevent this?
|
|
|
|
|
|
I think you're thinking about repainting automatically when the form resizes. There's nothing in CreateParams property (it's actually the protected property Control.ResizeRedraw you're thinking about in this case) or ControlStyles enumeration that controls that.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
public enum ControlStyles
{
AllPaintingInWmPaint = 8192,
CacheText = 16384,
ContainerControl = 1,
DoubleBuffer = 65536,
EnableNotifyMessage = 32768,
<big>FixedHeight = 64,
FixedWidth = 32</big>,Opaque = 4,
ResizeRedraw = 16,
Selectable = 512,
StandardClick = 256,
StandardDoubleClick = 4096,
SupportsTransparentBackColor = 2048,
UserMouse = 1024,
UserPaint = 2
}
top secret xacc-ide 0.0.1
|
|
|
|
|
He doesn't want a fixed-width form, merely to not be notified initially of the resize when the form is loading. You did, however, remind me that it was ControlStyles.ResizeRedraw and the Control.ResizeRedraw property that did match-up, though. I knew there was a pairing there somewhere, just didn't remember off the top of my head.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
It is being resized when the form loads. It starts out as a zero-width and zero-height window and then is drawn in the appropriate dimensions, hence the resize.
The solution is simple: use a state variable (recommend private accessibility). It's initially unset (false, for example) and the OnLoad override will set it (true, for example). The OnResize handler (btw - don't handle events from a base class in a derivative class: it's inefficient and gives you less control) will check this state variable. If it's unset, don't call base.OnResize (which will fire the Resize event) and don't call your code that you would normally when a form resizes.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi!
yes... and once more...
I now I go: Could somebody please, please, please compile WeifenLuo's DockManager Library in Debug and Release Mode for me? I'm not using visual Studio and I'm having massive problems getting it compiled. Just want to check whether I'm being stupid or my IDE (SD) is...
Source can be found here[^]
Here is my email.
And the last one to go...
Thanks a ton. Seriously.
Matthias
If eell I ,nust draw to your atenttion to het fakt that I can splel perfrectly well - i;ts my typeying that sukcs.
(Lounge/David Wulff)
www.emvoid.de
|
|
|
|
|
I just downloaded it and it compiles without any errors for me (VS.NET 2003) in both debug and release.
|
|
|
|
|
|
Sorry, chief. I reread it and I still don't see where I went wrong; I did what the guy asked. I hope your solution below is what he needs.
|
|
|
|
|
He said he's not using Visual Studio.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|