|
Is there any equivalent to the GetTextMetrics function in the .NET framework? I'm trying to find the height of a font (I know I can use the Height property of a Font object) including the leading, which the height property doesn't give. If there is no equivalent could someone post an example of how to use GetTextMetrics in C#.
Thanks all!
- monrobot13
|
|
|
|
|
|
David Stone wrote:
System.Drawing.Graphics.MeasureString()
Thanks, but that doesn't work. It gives the exact same value as using the Height property of the font. I think I'm going to have to end up using GetTextMetrics, but I don't know how to create the TEXTMETRICS structure that it needs in C#.
Any help is much appreciated.
|
|
|
|
|
I have the class MyText devived from RichTextEdit and I have inside and an other structure (System.Collection.ArrayList).
In the main form I open a TabControl and like pages I use this class .
In the new class I draw ellipses .When the TabPage lose the focus the draw disapear . I override OnPaint , where I redraw everything , but this override is not doing what is meent to do .
Hwo I make the drawing to be seen on screen (ClientRectangle).
|
|
|
|
|
Save it as a picture in the richedit box?
jhaga
|
|
|
|
|
I cant do that because My project consist in a nomber unknown the ellipses
and the I whant to add others .
Thanks
|
|
|
|
|
tried using tapPage.Hide() but it has no effect, tab page still displays... I'm wanting to show a tabPage2 only when there are processing errors on tabPag1. Is there another way, or a way to dynamically add a tab page to a tab control...???
thanks,
vince
|
|
|
|
|
If the TabControl is named "tabControl" , the code for closing is :
// verify if the TabPages exist
// if we try to close a non-open tab will have error's
if (this.tabControl.TabPages.Count != 0)
this.tabControl.TabPages.Remove(this.tabControl.SelectedTab);
//SelectedTab is the selected tab tabControl.TabPages[<number>] is the
//<number> tab , if you whant other tab
|
|
|
|
|
thanks for the reply, but that's not quite what I'm looking for... I need to have either a hidden tab page that can be unhidden, or the ability to create a tab page with a listbox containing error strings...
Don't need to remove a tab page...
thanks for any further suggestions..
|
|
|
|
|
vlusardi wrote:
or a way to dynamically add a tab page to a tab control...???
Sure, try something like this, it works:
for(int i = 0; i < 5;i++)
{
TabPage tbpage = new TabPage("test" + i);
this.tabControl1.TabPages.Add(tbpage);
}
-Nick Parker
|
|
|
|
|
I'm building a set of custom controls. I would like the controls to act as parents for controls dropped on them in the forms editor. I could use .Panel as the parent type but that would preclude visual editing in the IDE ( why ? ).
Looking at UserControl in the object browser I see that it is indeed a container and implements the IContainer interface somewhere down in the inheritance diagram. However, if I drop a UserControl into a form then drop another UserControl on top of it the forms editor will make the form the parent of both. This is different than if I drop the second UserControl on a panel or groupbox.
How do I make my controls act like a panel/groupbox in this respect ?
Duncan Meech
dmeech@riverdeep.net
|
|
|
|
|
Answering myself.....add this class to your controls base class.
///
/// Provides Base class designer support.
///
public class YourBaseClassControlDesigner : System.Windows.Forms.Design.ParentControlDesigner
{
// add whatever filters you like to determine the types of controls you can parent
public override bool CanParent(Control c)
{
return true;
}
public override bool CanParent(ControlDesigner cd)
{
return true;
}
}
then add these attributes to your actual control...
[Designer(typeof (YourBaseClassControlDesigner))]
public class YourBaseClassControl : System.Windows.Forms.UserControl ...
Duncan Meech
dmeech@riverdeep.net
|
|
|
|
|
Hi everyone,
I would like to create a control able to reproduce the navigation bar of Windows XP. I do not want to simulate what the original control does, I would like to exploit what Windows XP does (as I can do with every common controls). What kind of control is the original navigation bar?
Thanks in advance for your attention
Marco Losavio
|
|
|
|
|
I'd heard that vs2003 was going to bring significant changes, but aside from compact framework i dont see anything.
wasnt there supposed to be new tools supporting events?
wasnt there supposed to be C# templates or new typesafe tools?
am i missing something?
thanks!
|
|
|
|
|
I haven't seen VS 2003. But it's largely a bug-fix release.
C# templates won't appear until at least .NET 2
Kevin
|
|
|
|
|
|
Well, hopefully they'll be rather more timely with service packs going forward, unlike for VS 2002!
Kevin
|
|
|
|
|
Kevin McFarlane wrote:
Well, hopefully they'll be rather more timely with service packs going forward, unlike for VS 2002!
Hmm... I don't think so. My impression is that starting with VS.NET 2002 they stopped "losing time" supporting the IDE by itself, and were working only on VS 2003. They did support the framework, but the IDE fixes were only be available if you upgrade (ok, it's cheap). I think that will be the case when Whidbey comes out: there will be one or two SP for .NET Fx 1.1, but not for the IDE.
Specially because it will be tightly integrated with Yukon, this would be a great push for the new SQL Server.
My latest article: GBVB - Converting VB.NET code to C#
|
|
|
|
|
Daniel Turini wrote:
but the IDE fixes were only be available if you upgrade (ok, it's cheap)
According to the original roadmap MS will release an SP for VS.NET 2002 for those who choose not to upgrade.
James
"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation
|
|
|
|
|
The beef is in the Visual C++.NET side of things. Windows Forms editor, 97% ISO Compliance, etc.
Hawaian shirts and shorts work too in Summer.
People assume you're either a complete nut (in which case not a worthy target) or so damn good you don't need to worry about camouflage...
-Anna-Jayne Metcalfe on Paintballing
|
|
|
|
|
I hope that you only paid the upgrade price of $29 for it.
You get .NET framework 1.1 and SDK, but of course you can get that for free online. As well as the compact frameworks SDK.
For C#, you get some extra intellisense, but little else.
For C++ users, this is a fairly significant upgrade such as language improvements and WinForms designer support.
Thanks, Wes
|
|
|
|
|
Back about a month ago, I was doing some searching and found a nice, easy way to write strings to the browser control. I vaguely remember it used HTMLDocument2(?) as the vehicle. Anyway, once I found it I put the code into my project and tested it to make sure it worked. And it did.
Now my problem is that Desktop Management -- in giving me my new laptop -- supposedly pulled off all of my current work and moved it to my new machine. But looking at the code it looks like they gave me a version after I had gotten that code snippet!!!!! Worse yet, I cannot recreate the search I did to get the code snippet found again!!! Arrrrggggghhhh.
Is anyone familiar with the code for doing a write to the browser control??? I have seen other examples of this but it requires hooks off events from the browser and other complex steps that make very ugly and unpredictalbe to deploy. I vaguely recall the code was something like this....but I can't make it work right:
string url = "about:blank";
object o = System.Reflection.Missing.Value;
this.showWebPage.Navigate(url, ref o, ref o, ref o, ref o);
ICustomDoc cDoc = (ICustomDoc)this.showWebPage.Document;
cDoc.SetUIHandler((IDocHostUIHandler)this);
HTMLDocument2 wDoc = (HTMLDocument2) this.showWebPage.Document;
wDoc.write("this string");
Is anyone familiar with how to do this???
Thanks for any help!
_____________________________________________
The world is a dangerous place. Not because of those that do evil, but because of those who look on and do nothing.
|
|
|
|
|
wDoc.body.innerHtml = "this string";
This should be simple enough.
|
|
|
|
|
This failed. I am not correctly instantiating the browser document object.
I am getting it defined, but body is set to null.
_____________________________________________
The world is a dangerous place. Not because of those that do evil, but because of those who look on and do nothing.
|
|
|
|
|
It's because the document object must be initialized first. This issue has been under scrutiny the last few days in this forum, and the answer is to call a method from an interface queried from the doc. It's IPersistStreamInit. And the method is InitNew(). Look up this forum with either of these keywords.
|
|
|
|