|
Jay Pal wrote:
Any Suggestions? Comments?
You may get more help with this on the ASP.NET[^] forum, however I have a feeling that because you are dynamically loading controls they can't identify the state of your page, they are just being loaded themselves so they wouldn't know what happened before (internally to the control that is). HTH
-Nick Parker
|
|
|
|
|
This is starting to get to me !
So, let me ask you all, just in case someone has a quick solution for my problem.
Here's what I would like to do.
Imageine a simple Win App, with a main form with a couple of buttons,
and a panel. The buttons are "Rectangle", "Ellipses", and "None".
If you click on the "Rectangle" button, you can draw a rectangle in
the panel (by clicking-dragging in the panel). Similarly,
if you click on the "Ellipses" button, you'll be able to draw an ellipses in the
panel. The "None" button is there simply to let you go back to
your standard mouse situation.
So far so good.
I got all of that working by using the GDI+ DrawRectangle and
DrawEllipses functions.
Now, my problem is that I can't make the panel pop-up the scrollbars
(both vertical and horizontal) as needed.
In other words, if I open up the application,
maximize it to full screen, and draw something in the lower-right corner of the
panel, when I resize the application to a smaller size,
the drawn object does not show up in the panel (duh! it's out there somewhere).
But, most importantly, the scrollbars of the panel do not appear either !
I've tried to set to true the AutoScroll property of the panel,
and set the minimum size and the actual size of the scrollbars to (5,5),
but that had no impact.
As far as I can tell, the problem is that the AutoScroll property comes
into play only if some "Control" is placed outside the viewable
area of the panel at some point, while the rectangles and circles are
(being drawn with GDI+) not considered controls !
Any suggestions ?
Thanks in advance for your 2 pennies
F.O.R.
|
|
|
|
|
Got it !
Just for future reference of anyone who stumbles upon this:
look at the following two articles here on CodeProject:
http://www.codeproject.net/books/1861004990.asp
and
http://www.codeproject.com/cs/miscctrl/tracker.asp
As a summary, I think my main mistake was to set the
AutoScrollMinSIze to a value that was too small (5,5).
Once I set this to the value of the highest X (and Y) coordinate
of the stuff I was drawing, it worked much better!
HTH,
F.O.R.
PS: funny thing is I *do* have the WROX book from the first link,
but I left it at the office !
|
|
|
|
|
I'm pretty new to C#. Could someone give me a short step-by-step description on how to embed an ActiveX control (made with ATL) into C#? Is it possible at all?
Thanks in advance,
Robert
|
|
|
|
|
Wright Click on your Refrences and then choose COM tab,choose your active x there.
Mazy
No sig. available now.
|
|
|
|
|
Is it possible to create an control that has for example a property which has a (self created) property building screen. In this screen you can set the contains of this property. After closing this screen, this screen will generate some code in te code-behind file.
I was hoping someone could tell me if this is possible. With add-ins it could but i want a sexier way. If this is not possible, than can someone tell me if i can make a add-in which will look like the property window in VS.Net?
|
|
|
|
|
Can you help me with a good, from ground up, with pictures and links tutorial - how I can edit HTML document from inside C# ? I readed MSDN articles about MSHTML editing but I'm still have some questions
"I have not failed.
I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)
|
|
|
|
|
|
10x man !! But I already found the answer.
Some sites to look for:
http://abstractvb.com/code.asp?P=1&F=51 [VB site]
Google.com [try to search for every interface name you found or question about - it's really helps]
"I have not failed.
I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)
|
|
|
|
|
This is probably a basic question to one who has the answer, but I can't seem to find the forest for the trees.
I put together the main form (frmMain) and I have several user controls that I put together. Silly me, I only tested the process on a single form before moving forward.
I created the main form with a panel (pnlMain) into which I paste my user control (UC). When the user clicks on a button, my intention was to call a public routine in frmMain that would 1) Hide the current UC and then load and paste an appropriate new UC into the panel.
The problem is hierarchy. No matter how I put the controls together, once the child form is open, I can't get back to the main form to tell it to do something different. I've tried a few different variations but I keep running into the hierarchy issue no matter the method of object creation.
I've done this type of thing in Delphi but can't seem to figure out the C# secret.
Thanks for the help.
DBetting
|
|
|
|
|
I not sure I understand your issue. Seems to me there should be many ways to get back to your main from.
Anyway, try this;
Form frmMainRef = (frmMain)this.Parent();
//frmMainRef is a reference to the parent. If you are nested deaply you may need to put this into a loop until ype of frmMainRef is form.
Something like this...
Form frmMainRef = (frmMain)this.Parent();
while(frmMainRef != null && frmMainRef.GetType() == typeof(Form)
{
frmMainRef = (frmMain)this.Parent();
}
good luck, let me know
|
|
|
|
|
For a simple test of visibility and the concept: Given a main form (frmMain) with a panel (pnlMain), using the following:
public class frmMain : System.Windows.Forms.Form<br />
{<br />
...<br />
public ucForm1 UCForm1 = new ucForm1();<br />
public ucForm2 UCForm2 = new ucForm2();<br />
... <br />
public frmMain()<br />
{<br />
InitializeComponent();<br />
UCForm1.Parent = this.pnlMain;<br />
UCForm1.Visible = true;<br />
}<br />
<br />
public void ShowUCForm2()<br />
{<br />
UCForm1.Visible = false;<br />
UCForm1.Parent = null;<br />
UCForm2.Parent = this.pnlMain;<br />
UCForm2.Visible = true;<br />
}<br />
}
then given a User Control with a single button (btnViewOtherForm) using the following:
public class ucForm1 : System.Windows.Forms.UserControl<br />
{<br />
...<br />
private void btnViewOtherForm_Click(object sender, System.EventArgs e)<br />
{ <br />
Form frmParent = (frmMain) this.Parent;<br />
frmParent.ShowUCForm1();<br />
}<br />
}
ucForm2 can be blank. I tried the suggestion, but the reference to ShowUCForm2 cannot be found. I cannot use the loop because the compiler wants to find the reference before it allows it to be used. I've tried several flavors of trying to access the parent, but obviously not the correct one yet.
In this case, the parent should be two levels up. ucForm1.Parent should be pnlMain whose parent should be frmMain.
Thanks
Dan
|
|
|
|
|
I am traveling today. If you wanted to send me the example project, I would work on it during my layover.
|
|
|
|
|
Is there a ClientToScreen() equivalent in c#?
Paul
|
|
|
|
|
|
Thanks,
It is amazing how something so obvious can be so elusive !!
|
|
|
|
|
|
I CAN YOU!
uh... email me.
/\ |_ E X E GG
|
|
|
|
|
Hi All,
I want to connect to Access Database. I am using Visual Studio.NET beta version. In that I want to use the class System.Data.ADO.ADODataSetCommand. But, when I use this in my code i am getting compile time error as
"the type or namespace name 'ADO' does not exists in the class or namespace 'System.Data' are you missing an Assembly reference.". In my 'References' 'System.Data' is present.
Can anybody tell me what specific assembly reference should I add to get 'ADO' namespace inside 'Data' namespace.
Thanks in advance.
regards,
Pranoti
|
|
|
|
|
I saw and used ADO in VB but most recently I was working with Access and C#. I used OleDb and it worked fine.
|
|
|
|
|
Hi,
Can you please tell me how can I use OleDB to connect with access.
Many Thanks,
Pranoti
|
|
|
|
|
In this area, I'm still very much an amateur. Your best bet would be to move your question to the SQL / ADO / ADO.Net section. You'll probably have half a dozen responses.
db
|
|
|
|
|
Hi all,
I am trying to use some custom resources. The following code works with images.
private void Form1_Load(object sender, System.EventArgs e)<br />
{ <br />
image1 = new Bitmap(GetType(),"icon1.png");<br />
image2 = new Bitmap(GetType(),"icon2.png");<br />
SelectionCursor = new Cursor(GetType(),"Cursor1.cur"); <br />
<br />
this.pictureBox1.BackgroundImage = image1; <br />
}
but when I try to change the current cursor as shown in the code below, I get the default IBeam.
private void AttachIcon(object sender, System.Windows.Forms.MouseEventArgs e)<br />
{<br />
if (e.Button.Equals(MouseButtons.Left)) Cursor.Current = SelectionCursor;<br />
}
There are no compiler errors or warnings. The Cursor1.cur build action property is set to embedded resource. SelectionCursor is declared in the form as private Cursor SelectionCursor; Oh, and it works if I use a different system cursor in the event handler.
Does anyone have a sugestion?
Thanks, Paul
|
|
|
|
|
Got it!
The cursor was 32x32 and needed to be 16x16.
Paul
|
|
|
|
|
Be careful with code like this:
Paul Silvernail wrote:
private void Form1_Load(object sender, System.EventArgs e)
{
image1 = new Bitmap(GetType(),"icon1.png");
image2 = new Bitmap(GetType(),"icon2.png");
SelectionCursor = new Cursor(GetType(),"Cursor1.cur");
this.pictureBox1.BackgroundImage = image1;
}
If you create a new form which inherits from Form1 , but doesn't exist in the same namespace or assembly; the constructors will throw an exception because the resource can't be found. GetType() will return a Type object for the new form, not for Form1 resulting in the exception.
A better way to do it is to use typeof(Form1) so that you will always be referencing the correct Type object.
James
"then when you go to bed...wait, you dont do that do you....ok....when you plug into the 'hive mind' to charge yourself, ill hack into your head"
Nnamdi Onyeyiri over MSN
|
|
|
|