Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
D

devzav

@devzav
About
Posts
18
Topics
7
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Capture a link click to open a web page...
    D devzav

    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!

    C# csharp question

  • Watching...
    D devzav

    How does the "watch" link work? Is it a way to receive notifications when the watched site changes? Thanks

    The Lounge question

  • Printing an image in the middle of a page
    D devzav

    I still have this problem...

    C# graphics help question

  • Printing an image in the middle of a page
    D devzav

    Hi 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.

    C# graphics help question

  • Variable visibility in subclasses...
    D devzav

    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!

    C# question

  • Variable visibility in subclasses...
    D devzav

    Thank you for the answer! And how can I do to make B a "real" subclass?

    C# question

  • Variable visibility in subclasses...
    D devzav

    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!

    C# question

  • Variable visibility in subclasses...
    D devzav

    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

    C# question

  • Metafile problem...
    D devzav

    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!

    C# help graphics question

  • Metafile problem...
    D devzav

    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

    C# help graphics question

  • An introduction to bluetooth conection
    D devzav

    Pehraps this can help you: http://inthehand.com/content/32feet.aspx[^] Good work!

    C# csharp

  • Printing a rectangle with exact sizes...
    D devzav

    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!

    C# graphics help question

  • Inheriting Enums...
    D devzav

    Thank you for your answer :)

    C# question

  • Printing a rectangle with exact sizes...
    D devzav

    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

    C# graphics help question

  • Inheriting Enums...
    D devzav

    Thank you, Tom :)

    C# question

  • Inheriting Enums...
    D devzav

    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?

    C# question

  • Inheriting Enums...
    D devzav

    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.

    C# question

  • Inheriting Enums...
    D devzav

    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!

    C# question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups