Got it. The XmlnsDefinition must reside within the assembly that I am referencing, not the project that is performing the referencing......
PHDENG81
Posts
-
XAML XmlnsDefinition within the AssemblyInfo.cs File -
XAML XmlnsDefinition within the AssemblyInfo.cs FileI must be missing something here given the fact that this should be a trivial solution. Nevertheless, here it is: I have declared a URI within the AssemblyInfo.cs file using XmlnsDefinition. The namespace I am using is referenced by the project. I then reference the uri within my XAML file as such: xmlns:myBindings="http://sources.mycompany.com/datasource" Then I declare a objectdataprovider within the resources of my XAML file: When I compile, I receive the following error: "The type reference cannot find a public type named 'LocalTimes'. However, if I declare the namespace as such: xmlns:myBindings="clr-namespace:Bindings.Time;assembly=Bindings" Everything works fine. What gives? Any help would be much appreciated. Thanks!
-
Office AutomationI need to obtain all of the bookmarks within a Word document using late binding. I have easily done this using early binding. However, I am having some trouble with the former. I know how to open and write to a file. I have the framework developed. Any help on returning the collection of bookmarks using this method would be much appreciated. Thanks P
-
Centering Text on Custom ButtonThanks for the response ExpertComing. The posts prior to yours describes my methods and they do precisely what you illustrate. However, they still don't seem to align with the windows.forms.button text when it is centered. Any other suggestions? Thanks again. PHD
-
Center Text on Custom ButtonHey Ian, Once again, thanks for the response. I don't seem to have an issue aligning to the sides. I just can't calculate the proper "X" value while centering the desired text. This is completely beyond me. I really appreciate your help. If you have any other suggestions, I would like to hear them. Thanks again PHD
-
Centering Text on Custom ButtonAndre, Thanks for your help. With all do respect, just because it doesn't make sense to you, doesn't mean it "doesn't make sense." It is simple math. If written down on paper, the equations seem to be correct. However, it would appear as if I am not receiving the proper values or something else may be skewed. Nevertheless, you have two boxes. One being the button and the other being the bounding box around the text. You are correct in saying that DrawString needs the upper left X and Y coordinates. Therefore, we merely need to divide both boxes in half and subtract the larger half from the smaller. This will give us the X and Y coordinates we desire. Or in this case, the X coordinate. The Y coordinate is working pefectly.
PointF mTextpt = new Point(0);//floating points used for X and Y coordinates
wSize = graphics.MeasureString(this.Text, this.Font);this.Width//gives us the width of the client rectangle. Our "bigger" box
this.Height//gives us the height of the client rectangle.
wSize.Width//this SHOULD be the width of the bounding box encompassing the text
wSize.Height//gives us the height of the bounding box encompassing the textfloat wCenterX = (float)((this.Width - wSize.Width) /2f);
mTextpt.X = wCenterX;
mTextpt.Y = this.Height - 19;e.graphics.DrawString(this.Text, this.Font, new SolidBrush(this.ForeColor), mTextpt);
I don't claim to have all of the answers. Clearly if that was the case, this simple problem of mine wouldn't be an issue. I must be missing something or screwing something up. I greatly appreciate your help. PHD
-
Centering Text on Custom ButtonHey Bekjong. Thanks a lot for your help. However, I tried both of your suggestions and it continues to react in the same way. Any other ideas? It appears as if it doesn't always grab the proper size of the bounding area for the text. Regardless of which method I use. If I tweak it a little with a few values, some of the text looks perfect. Thanks again. PHD
-
Centering Text on Custom ButtonI am reposting to add more detail. I have a custom button that I have created which inherits from windows.forms.button. I simply override the mouseenter, mouseover, and mousedown events to paint a custom gradient over the button. In doing so, I must redraw the available image and text. I have been able to align the image with the base. However, I am unable to do the same with the text. Specifically, centering. It is close, just not perfect.
SizeF wSize = graphics.MeasureString(this.Text, this.Font);
float wCenterX = (Width - wSize.Width) / 2;mTextPt.X = wCenterX;//this does not work properly
mTextPt.Y = Height - 19;// this works finee.Graphics.DrawString(this.Text, this.Font, new SolidBrush(this.ForeColor), mTextpt);
For most of the buttons, the text shifts slightly to the left when I use any of the custom events. I have thoroughly tried using the StringFormatter to align the text accordingly. However, I have come up empty handed. When you set the LineAlignment to place the text at the bottom of the control, there doesn't seem to be the ability to "pad" the text from the bottom. Therefore, the text simply "sits" on the base or bottom of the control and fails to align with the base text. Any help would be greatly appreciated. Thanks. PHD
-
Center Text on Custom ButtonThanks for the suggestion Ian. I should have mentioned that I tried using the StringFormat parameter. There doesn't seem to be any way to "pad" the text when using the StringFormat. Therefore, when you place the text at the bottom of the control, it simply places the text about a pixel or so above the bottom. Therefore, it doesn't align with the base text. Any other suggestions? Thanks.
-
Center Text on Custom ButtonThanks Manoj. I checked the precision and it seems to be fine. Any other suggestions?
-
Center Text on Custom ButtonI have a custom button that I have created which inherits from windows.forms.button. I simply override the mouseenter, mouseover, and mousedown events to paint a custom gradient over the button. In doing so, I must redraw the available image and text. I have been able to align the image with the base. However, I am unable to do the same with the text. Specifically, centering. It is close, just not perfect. SizeF wSize = graphics.MeasureString(this.Text, this.Font); float wCenterX = (Width - wSize.Width) / 2; mTextPt.X = wCenterX;//this does not work properly mTextPt.Y = Height - 19;// this works fine e.Graphics.DrawString(this.Text, this.Font, new SolidBrush(this.ForeColor), mTextpt); For most of the buttons, the text shifts slightly to the left when I use any of the custom events. Any suggestions would be greatly appreciated. Thanks. PHD
-
Topmost FormThanks for the help guys. P
-
Topmost FormSo, is there a way to do this? Thanks
-
Topmost FormHow can I make a form ALWAYS topmost regardless if another form within the project has been set to topmost? Thanks in advance. P
-
XML TreeviewI know this one is going to be a hard one. I need to populate a treeview with an XML file. I also need to save the contents of that same treeview to an XML file. The contents inside of the treeview will be user driven. Therefore, the number of entries within the XML file will never be absolute. I need some kinda of dynamic loader and exporter. Any ideas? I have searched all over the web, but I have yet to find what I am looking for. Thanks in advance. P
-
PopUp formYeah, that is what I was going to do. I just didn't know if there was a better way of doing it. Thanks for your help.
-
PopUp formI need a form that will popup next to a button. For instance, say I have a volume button on a form but I dont want to put the controls for the volume on the form. Instead, I push the volume button and a little form pops up next to it that has all of the necessary volume controls. Furthermore, I dont want it to perform like a conventional form. I dont want it to show up in the task bar and I need its location to always be next to the button that instantiated it. I have seen this on several applications, including Fireworks and Photoshop. Any ideas? Thanks. P
-
Single instance of a formCurtis, I am trying to control the number of instances of each form as well. So, working off of the previous code, I added this: public static void LoadFormType(Type formType, Form parentForm, int instances) { lock( typeof( FormLoader ) ) { if( eh == null ) { eh = new EventHandler( FormClosed ); } } if( IsAlreadyLoaded( formType ) ) { Form f = GetForm( formType ); f.Focus(); f.BringToFront(); return; } Form frm = (Form)Activator.CreateInstance(formType); FlagAsLoaded( formType, frm, instances );// DictionaryEntry[] myArr = new DictionaryEntry[m_InitializedForms.Count];//added m_InitializedForms.CopyTo( myArr, 0 );//added if(myArr[m_InitializedForms[formType.FullName]].Value <= instances)//added, clearly the cast types are wrong, but you get the idea { frm.Closed += eh; frm.Show(); } } private static void FlagAsLoaded( Type formType, Form f, int instances )// { m_InitializedForms[formType.FullName] = f; m_InitializedForms.Add(f, instances);//added } Then I would load a form as such: FormLoader.LoadFormType(typeof(Form2), this, 1); "1" indicating how many instances of the form should be allowed. Thanks again for your help. -- modified at 8:31 Monday 19th December, 2005
-
Single instance of a formYou have a been a huge help. Thanks a lot. It is good to see that there are still people out there willing to help without makeing such a fuss if there is a loss of understanding.
-
Single instance of a formCurtis, Thanks for your help. One more thing. When I close the form, I am no longer able to bring it back up.