Hi all! Is there a way to capture in C# the user click on a link (in any window) in order to open a web page? I'd like to code a simply application that make you can choose the browser in which you want to open that page... Thank you in advantage!
devzav
Posts
-
Capture a link click to open a web page... -
Watching...How does the "watch" link work? Is it a way to receive notifications when the watched site changes? Thanks
-
Printing an image in the middle of a pageI still have this problem...
-
Printing an image in the middle of a pageHi all! I can't make an image is printed in the middle of a page. I use this code:
printDocument = new PrintDocument();
printDocument.OriginAtMargins = true;printDocument.DefaultPageSettings.Margins = new margins((int)printDocument.DefaultPageSettings.HardMarginX,
(int)printDocument.DefaultPageSettings.HardMarginX, (int)printDocument.DefaultPageSettings.HardMarginY,
(int)printDocument.DefaultPageSettings.HardMarginY);x = xCenter;
y = yCenter;x -= MeasureConverter.FromUnitToUnit(UnitOfMeasurement.Inches, UnitOfMeasurement.Millimeters,
printDocument.DefaultPageSettings.HardMarginX / 100);
y -= MeasureConverter.FromUnitToUnit(UnitOfMeasurement.Inches, UnitOfMeasurement.Millimeters,
printDocument.DefaultPageSettings.HardMarginY / 100);
...X and Y are given in millimeters, and in my printDocument_PrintPage method I have:
Graphics g = e.Graphics;
g.PageUnit = GraphicsUnit.Millimeter;
g.DrawImage(printableObj.GetMetafileImage(), x, y);
g.Dispose();
e.HasMorePages = false;Unfortunately my image is printed not exactly in the center... Can you help me, pls? Thnks in advantage.
-
Variable visibility in subclasses...I need the "like subclass" :) I used in the example. So I'll pass a reference to B. Thank you very much for your answer!
-
Variable visibility in subclasses...Thank you for the answer! And how can I do to make B a "real" subclass?
-
Variable visibility in subclasses...Thank you! I thought to do that too. It seems to be the simplest way to obtain that I asked :)
Hope that helps! Luca Do rate the reply, if it helps or even if it doesnot, because it helps the members to know, what solved the issue. Thanks!
-
Variable visibility in subclasses...Hi all! I have a class like this:
class A { private string strA; private B mySubclass = new B(); ... class B { public B() { string strB = strA // <--- this } } }
Is there a way to make strA visible only for class B and not for other classes? If not can you suggest a workaround to do that? Thank you. Luca -
Metafile problem...Great! I was wrong in considering it as the right x-coordinate of the rectangle! Thank you very much Jeff :-D
Hope that helps! Luca Do rate the reply, if it helps or even if it doesnot, because it helps the members to know, what solved the issue. Thanks!
-
Metafile problem...Hi all! I'm coding a class to print barcodes. One of my methods is this:
public Metafile GetMetafileImage() { PrinterSettings ps = new PrinterSettings(); Graphics g = ps.CreateMeasurementGraphics(); IntPtr pHdc = g.GetHdc(); Metafile mf = new Metafile(pHdc, EmfType.EmfOnly); g.ReleaseHdc(pHdc); g.Dispose(); g = Graphics.FromImage(mf); g.PageUnit = GraphicsUnit.Millimeter; g.PageScale = 1; Brush b = Brushes.White; g.FillRectangle(b, 0, 0, whiteMarginWidth, height); float x = whiteMarginWidth; foreach (char ch in encodedValueString) { if (ch == '1') b = Brushes.Black; else b = Brushes.White; g.FillRectangle(b, x, 0, x + barSize, height); x += barSize; } b = Brushes.White; g.FillRectangle(b, x, 0, x + whiteMarginWidth, height); // <-- this g.Dispose(); return mf; }
It works fine but the last FillRectangle operation. Its width isn't "whiteMarginWidth", but it's larger than "whiteMarginWidth". It seems to fill a rectangle whose wide reach the "end" of a region, perhaps a region set by the printer handle... I can't solve this problem :doh: Can you help me? Thank you! Luca -
An introduction to bluetooth conectionPehraps this can help you: http://inthehand.com/content/32feet.aspx[^] Good work!
-
Printing a rectangle with exact sizes...Hi, thanks for your answare. The problem is that I don't want to draw the bar on screen, but I have to print it on my printer. Pehraps I can solve the problem using the printer resolution (600 dpi in my case). Thanks again!
-
Inheriting Enums...Thank you for your answer :)
-
Printing a rectangle with exact sizes...Hi all! I have to print a bar with its exact sizes. I used this code to generate a bar:
PrinterSettings ps = new PrinterSettings(); Graphics g = ps.CreateMeasurementGraphics(); IntPtr pHdc = g.GetHdc(); mf = new Metafile(pHdc, EmfType.EmfOnly); g.ReleaseHdc(pHdc); g.Dispose(); g = Graphics.FromImage(mf); g.PageUnit = GraphicsUnit.Millimeter; g.PageScale = 1; Brush b = Brushes.Black; g.FillRectangle(b, 0, 0, 2, 30); float dpix = g.DpiX; float dpiy = g.DpiY; g.Dispose(); Bitmap bm = new Bitmap(mf, (int)(mf.Width / mf.HorizontalResolution * dpix), (int)(mf.Height / mf.VerticalResolution * dpiy)); mf.Dispose();
Well, when I print the bm Bitmap I obtain a big bar on my page: it isn't 2x30 mm wide, but 12x188 mm wide! Can you help me? Thanks in advantage -
Inheriting Enums...Thank you, Tom :)
-
Inheriting Enums...Thank you very much for your fast reply! So if B has the ClassB with a method like this:
public class ClassB { ... public void MethodB(A.EType myType) { ... } }
and I call it in projectC in this way:B.ClassB bClass = new B.ClassB(); bClass.MethodB(myNewType);
have I to define necessary myNewType as A.EType (and so I have to reference the projectA in my projectC), or is there a trick to avoid it? -
Inheriting Enums...Sure! I beg your perdon for my poor English... I'll try again :P I have a project A like this:
namespace A { public enum EType : int { a, b, c } public class Class1 { ... } }
Then I made a project B that references the project above, so that I can use A.EType as type in my project B. Now I need to use the EType type in another project, the C project that should have the project B as only reference. How can I catch EType from the B project? Thank you. -
Inheriting Enums...Hi all! I'm new in object programming and I have a question for you. I have a class (Class1) that uses an Enum type called EType. I created another class (Class2) that wrap the first class. So I can use that Enum in Class2 by referencing the first class. Now I made a windows application that references Class2 and should use that Enum EType. Is there a way to catch EType from the Class2, or have I to reference the Class1 too? Thank you very much in advantage!