|
Any suggestions on how make a simple user control function as if it were a container control?
This is what I'm doing:
1) Create a simple usercontrol and change its backcolor to something other than gray.
2) Build the usercontrol.
3) Open a windowsapplication project and add a form.
4) Right click on the toolbox and click on add/remove items and
add the usercontrol that was built from step 2.
5) Drag & drop the user control onto the form.
6) Drag & drop a checkbox onto the user control.
7) Select the user control and drag it to another location on the form.
This is where my problem shows itself...The checkbox doesn't move with the usercontrol.
Does anyone know how I can resolve this?
Thanks,
Dave
|
|
|
|
|
you have to apply a new "designer" to your control.
something like
[Designer(typeof(paneldesigner))]
public class mycontrol:usercontrol
{
...
//Roger
|
|
|
|
|
Roger-
Thanks for pointing me in the right direction...The following is what I was missing...I actually found it under an artical by Iridar on this website...
// give the control a designer category, to ensure design-time compatability
[DesignerCategoryAttribute("Component")]
// makse sure we can add child controls at runtime
// see Microsoft Knowledge Base Article - 813450
[Designer("System.Windows.Forms.Design.ParentControlDesigner, System.Design", typeof(IDesigner))]
Thanks,
Dave
|
|
|
|
|
Can anyone tell me how I would go about getting the Author, Name, Dimensions, Duration, Bit Rate, etc... attributes of a Windows Media Video file (I have encoded the files myself so I know they are there) I have looked at FileInfo but that does not give me video specific information. Any help is welcomed.
Thanks.
Matt Newman
|
|
|
|
|
FileInfo only gives information about the file as the file system knows it. Those values are stored in a separate stream within the file. To get that kind of information, you should take a look at the Windows Media SDK[^].
You can also use "COM way" where you get an IPropertySetStorage pointer to the file using StgOpenStorageEx . You then enum the IPropertyStorage items and get properties that way. This is what Windws 98 and higher, and Windows 2000 and higher do for every file. Some file types - like Office documents and many media file types - provide their own implementations that still use this mechanism. If you have COM experience, this shouldn't be too hard.
For more information, see the documentation for IPropertySetStorage , IPropertyStorage , and StgOpenStorageEx in the Platform SDK.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi All,
I am stuck at some point in implementing checkbox column in datagrid.
This is how I am adding checkbox column to the DataGridTableStyle.
DataGridColumnStyle boolCol = new DataGridBoolColumn();
boolCol.MappingName = "PrimaryFlag";
boolCol.HeaderText = "Primary";
((DataGridBoolColumn)boolCol).TrueValue = "true";
((DataGridBoolColumn)boolCol).FalseValue = "false";
((DataGridBoolColumn)boolCol).ReadOnly = false;
boolCol.Width = 40;
ts.GridColumnStyles.Add(boolCol);
And from database I am receiving "true" or "false" values in the PrimaryFlag column. When I set the datasource of datagrid with the dataset that I receive from database, it correctly sets the checkboxes as checked or unchecked based on "true" or "false" values in the PrimaryFlag column.
Now my question is how can I handle the event such that with one click on the checkbox column it should toggle the check value of column. Right now it requires 2-3 clicks to toggle.
Any comments are very appreciated.
Thanks
Ruchi
|
|
|
|
|
First, declare your variable as a DataGridBoolColumn instead of a DataGridColumnStyle . You can then avoid expensive cast operations and can still add it to the DataGridTableStyle.GridColumnStyles collection property because it's still a DataGridColumnStyle object (from which it inherits).
Set AllowNull to false (the default) and make sure that none of your rows contains a NULL value for that column. If they do, the DataGridBoolColumn will automatically draw a tri-state combo box. In most cases with boolean columns in a database it's best to define a default and not allow nulls anyway - it saves you from having to check for null values since - when converting to a bool - value types cannot be null .
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
hi, im new in c# is it posible to print colored lines or move cursor in console??
thanks!!
|
|
|
|
|
Not using the base class library (the .NET Framework assemblies), not until .NET 2.0 that is. There are ways to accomplish this by P/Invoking the write native APIs. See the article Console Enhancements[^] here on CodeProject for details.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
|
Hi everybody,
I've created one setup program on visual studio .net 2003 and the framework is ver 1.1, the problem is when i want to run my Setup.MSI file on the older version of framework (1.0) then it fails and alerts me to upgrade to 1.1 version. i have't any custom action programmed in that setup file as well.
i though this setup program (msi file) is something independent from .net and framework and msi file is windows standard,.....
anyways any clue?...
thanx in advance
|
|
|
|
|
When you create an MSI package using Visual Studio .NET and include assemblies in your package, VS.NET automatically adds a launch condition which you could delete by selecting the project and clicking the appropriate toolbar icon in the Solution Explorer.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I have created a project with several forms and a main menu form. On the forms, I have placed six different user controls. Then I converted the project to MDI. The main menu form has IsMDIContainer is set to true. On the child forms, the MdiParent has a reference to the parent form. When i run the program, the textcolor of the text in labels and buttons is the same as the backgound color (or the text appears to be missing). When i remove the reference to the parent form and run the program, the color of the foreground and backgound return to the colors set in the properties. What can i do to prevent this problem?
Thanks in advance
bob
|
|
|
|
|
Unless you're explicitly setting the BackColor and ForeColor properties to something other than the default, these controls use ambient properties of the parent. It would seem, then, that somewhere in one of the parent controls you're setting BackColor and ForeColor to the same Color value. Is this correct?
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
no. If i simple remove the line of code for the child form to refence the parent, then the color of the text returns to the correct colors. Also, if i actually set the backcolor property to something other than the default color, then the user control retains the new color.
bob
|
|
|
|
|
hi,
how i can resize and reposition a window?from my app
|
|
|
|
|
If you're in a method of your form:
this.Location = new Point(10, 10);
this.Size = new Size(100, 100);
|
|
|
|
|
I take it your talking about repositioning another app's window?
You must use the Win32 API's to reposition and resize the window. There is no .NET Framework classes that will do this for you. Looking GetWindowPlacement and SetWindowPlacement on MSDN.
RageInTheMachine9532
|
|
|
|
|
Hi!
I wonder if it is possible to animate the minimized application in the taskbar or at least blink. I'm working on an application that is required while active to stay minimized in the taskbar and to display some animation/blinking. I know how to do this in the systray but not in the taskbar. Any clues?
10x
|
|
|
|
|
You can P/Invoke the FlashWindow native API:
[DllImport("user32.dll")]
private static extern bool FlashWindow(IntPtr hWnd, bool bInvert); To call it the de facto 3 times, you can do something like this:
for (int i=0; i<3; i++)
{
FlashWindow(this.Handle, true);
Thread.Sleep(500);
FlashWindow(this.Handle, true);
Thread.Sleep(500);
} See the API documentation for FlashWindow in the Platform SDK for more details.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks a lot! This worked fine. But how about drawing in the taskbar while minimized? E.g. scrolling some text, or displaying a progress bar, etc.
|
|
|
|
|
Simple question really, does anybody know of a code driven way to get the installation path of the .NET framework without going to the registry?
post.mode = signature;
SELECT everything FROM everywhere WHERE something = something_else;
> 1 Row Returned
> 42
|
|
|
|
|
Assembly assem = Assembly.GetAssembly(typeof(System.Int32));
MessageBox.Show(assem.Location);
Charlie
if(!curlies){ return; }
|
|
|
|
|
RuntimeEnvironment.GetRuntimeDirectory();
Thank You
Bo Hunter
|
|
|
|
|
I generally don't like the Visual Studio style docking bars. I can't see any use for them in usual applications. What I would rather like to see is docking toolbars (seen first in Office 97/2000, I think) that change into floating toolbars if you drag them off the edge of screen. However, I haven't found a control like this yet (freeware I mean, there is a perfect commercial one - Xtreme Command Bars from CodeJock). Can you help me ?
|
|
|
|