Thursday, September 15, 2022

strong-named assembly

strong-named assembly

  1. Strong-Named Assemblies – Why and How
  2. In this short post, I will discuss strong-named assemblies in .NET and cover why and how you should use strong naming within your .NET projects.

  3. How to Find the Public Key Token for a Strongly-Named Assembly
  4. In another post, we discussed why you should strongly name assemblies and how to do it via the Strong Name Tool (sn.exe). In this quick post we will consider another scenario – how to get the public key token string value of a strongly named assembly (dll).

  5. How to: Create a public-private key pair
  6. To sign an assembly with a strong name, you must have a public/private key pair. This public and private cryptographic key pair is used during compilation to create a strong-named assembly. You can create a key pair using the Strong Name tool (Sn.exe). Key pair files usually have an .snk extension.

  7. How to: Sign an assembly with a strong name
  8. Although .NET Core supports strong-named assemblies, and all assemblies in the .NET Core library are signed, the majority of third-party assemblies do not need strong names. For more information, see Strong Name Signing on GitHub.

  9. Create and use strong-named assemblies
  10. A strong name consists of the assembly's identity—its simple text name, version number, and culture information (if provided)—plus a public key and a digital signature. It is generated from an assembly file using the corresponding private key. (The assembly file contains the assembly manifest, which contains the names and hashes of all the files that make up the assembly.)

  11. How to generate strong name key file or which command is used to generated strong name key file?
  12. How to generate strong name key file or which command is used to generated strong name key file?

  13. Signing
  14. Assigning an assembly a Strong Name ensures that an assembly is unique at the system level. This is essential if you are deploying shared assemblies in the GAC as two publishers might create an assembly with the same name. Therefore being able to distinguish between the different assemblies is essential. A strong name can be thought of as a combination of the name, version number and a unique public key. Private assemblies do not need to have Strong Names but including one is often a good idea.

  15. .NET - How to Sign an Assembly in Visual Studio 2019
  16. Signing an assembly ensures that the consumer knows its origin and uniquely identifies the component. It makes the physical DLL file tamper-proof. This tutorial will step you through signing an assembly with a strong name key (SNK) in .NET. It is straight forward in Visual Studio 2019, but there are some pitfalls to consider. This tutorial will target .NET Standard, but the concept is the same for other target platforms. This tutorial is is backward compatible with some Visual Studio versions.

Friday, September 9, 2022

datagridview clear up

tricks to clear up datagridview

  1. DataGridView.Clear()
  2. in debug i see that dataGridVIew1.Rows.Count=0, but on form, grid doesnt become clear. what a point? on each selection in tree, i want to see new rows in table.

Graph Engine / Graphic Engine/Custom Control

Graph Engine

graphic engine

Must Test

  • Complete Sudoku Game for Windows using VB.NET 2013
  • This article is a tutorial on how to code your own Sudoku game using VB.NET

  • Anatomy of a UserControl (SliderControl)
  • This article presents a step-by-step guide for the implementation of a UserControl named SliderControl.

  • RoundedButton Control - Demystifying DrawArc
  • This article presents the RoundedButton control and describes the .Net DrawArc method, the subject of a number of questions on programming forums.

      Custom Controls

    1. Customized Text - Orientated Controls in C# - Part I (Label Control)
    2. Label which can display text in any orientation and shape.

    3. Advanced Shape Control
    4. Advanced Shape Control

    5. Ruler Control
    6. Ruler control in C#

    7. Adding designable borders to user controls
    8. A tutorial on adding design-time enabled borders to user controls. Covers topics including atributes, interop, and custom overrides

    9. Dartboard User Control in C#
    10. Shows a dartboard on which you can click and which returns the score thrown

    11. A Simple User Control
    12. A simple User Control for selecting a shape and entering dimensions.

    13. Writing Your Custom Control: Step by Step
    14. Making a cute button of two semi-transparent user-changeable colors

    15. C# Custom User Controls and Events - Part 1
    16. A demonstration of how to create a custom user control in C# and implement it within a host application. Check out Part 2 (https://www.youtube.com/watch?v=ZHW_P...) for an explanation of how to create custom events to enable the user control to communicate with the host application.

    17. C# User Controls and Events - Part 2
    18. A demonstration of how to create, raise and listen for custom events in C#. This is done to enable your class to communicate conditions and data to other classes. In this demo, I use the custom user control designed in Part 1

    19. C# Tutorial - Create a Custom control | FoxLearn
    20. Create a custom picture box with scrollbars in c# .net windows forms using custom control. The C# Basics beginner course is a free C# Tutorial Series that helps beginning programmers learn the basics of the C# Programming Language. This is the best way to Learn C# for beginners

    21. Creating Custom Controls In C#
    22. Well Custom Controls are nothing but just graphics. It is used to improve performance of your created application. Look Visual Studio, you can see MenuStrip different from basic controls in system. It looks better than just simple controls in .NET or any language.

    23. Canvas implementation for C#
    24. Design and implementation of canvas in C#

      Graphic Engine

    25. Age: The Scripted Graphic Item
    26. An introduction to ScriptedItem and ScriptAge for the AGE engine

    27. AGE: write your custom Graphic library
    28. How to write a custom GraphicItem library for the AGE engine

    29. AGE, Another Graphic Engine in .NET
    30. A library that allows some GDI+ manipulation at runtime in an easy way

      Graph Engine

    31. High Speed, Feature Rich, and Easy-To-Use Graphs and Charts
    32. High speed graphs and charts that are also very easy to configure and use. As easy as inserting a simple chart in MS Excel!

    33. Building a Graph control in 7 easy steps.
    34. This article shows you how to build a simple user control by creating a graph control in 7 easy steps.

    35. Graph Library
    36. This article addresses the construction of a simple graph library using C#.

    37. WPF: A graph control
    38. A WPF graph control with autoscaling and historical data support.

    39. A simple C# library for graph plotting
    40. An easy to use C# library for quick and simple graph plotting.

    41. Plotter Control (a-la Task Manager Performance History Graphs)
    42. Plotter Control with Scrolling (.NET 2.0)

    43. A Simple Graph Control
    44. A simple control to draw graphs of points as a function of time

    45. Graph of Function
    46. The program builds graphs of mathematical functions

    47. Autoscaling Graph Control
    48. Learn how to create a graph that can automatically scale itself!

    Tuesday, September 6, 2022

    MouseEventArgs and Mouse Wheel

    MouseEventArgs

    1. Draw with Mouse
    2. An article showing how to draw on screen

    3. Detecting Mouse Wheel Movement
    4. The mouse wheel can often provide a handy alternative to slower mouse operations, such as scrolling areas without positioning the cursor within a scroll bar. Many Windows Forms controls have built-in wheel support but custom wheel actions are possible.

    5. MouseEventArgs.Delta Property
    6. Gets a signed count of the number of detents the mouse wheel has rotated, multiplied by the WHEEL_DELTA constant. A detent is one notch of the mouse wheel.

    7. MouseEventArgs Class
    8. Provides data for the MouseUp, MouseDown, and MouseMove events.

    9. MouseEventHandler Delegate
    10. Represents the method that will handle the MouseDown, MouseUp, or MouseMove event of a form, control, or other component.

    11. Control.MouseWheel Event
    12. Occurs when the mouse wheel moves while the control has focus.

      When handling the MouseWheel event it is important to follow the user interface (UI) standards associated with the mouse wheel. The MouseEventArgs.Delta property value indicates the amount the mouse wheel has been moved. The UI should scroll when the accumulated delta is plus or minus 120. The UI should scroll the number of logical lines returned by the SystemInformation.MouseWheelScrollLines property for every delta value reached. You can also scroll more smoothly in smaller that 120 unit increments, however the ratio should remain constant, that is SystemInformation.MouseWheelScrollLines lines scrolled per 120 delta units of wheel movement.

    13. Demonstration of e.Delta Property of MouseWheel
    14. This is a simple demonstration of e.Delta property of MouseWheel event , On scroll Up and Down of Mouse wheel. (MouseEventHandler).

    15. How to code these rules for mousewheel up/down to control timed value decrease/increase?
    16. have a value int -can be retrieved as intopacitylevel- that controls opacity of an element on a Form. When I run my application, the value is set to a number of the random range 1 - 255. How could I put the following together as a mousewheel solution in c#?: What I want is, moving the mwheel up or down will constantly change the opacity value to the minimum or maximum value depending on mwheel movement direction by adding/subtracting 1 to the current value every 1ms. This behaviour precisely:

      For up direction, stop value increase only when the mwheel was moved to the next spot upwards or when the value is at the maximum 255. For down direction, stop value decrease only when the mwheel was moved to the next spot downwards or when the value is at the minimum 1. This .gif shows the result I want: at this place was a picture in the past

    17. #677 – Why the Standard Mouse Wheel Delta is 120
    18. For a standard Microsoft mouse, you’ll notice that the value of the MouseWheelEventArgs.Delta parameter is always either 120 when you turn the mouse wheel forward one click or -120 when you turn the mouse wheel backwards one click. You might wonder why the value of 120 is used, rather than just 1 and -1 values.

    19. UIElement.PreviewMouseWheel Event
    20. Occurs when the user rotates the mouse wheel while the mouse pointer is over this element.

    21. Mousewheel Delta value always 120
    22. The problem is that the Delta value is always 120, as explained in MSDN. So, even if I turn the wheel 1 notch or 5 notches it will always be 120. Do you know a way around this?

    23. C# Mouse Events
    24. Bear in mind that the mouse is hardware and not software. Windows will detect what happens with the mouse and generate events as appropriate. It sends an object of type MouseEventArgs (or in some cases EventArgs, the base class) to each handler as its second argument.

    25. Zooming and panning in Windows Forms with fixed focus
    26. How to do zooming and panning in Windows Forms with fixed focus.

    27. Improve Zooming with Enhanced Mouse Wheels
    28. How to give your users a better zooming experience with High Resolution Mouse Wheels.

    Monday, September 5, 2022

    region class

    region class

    1. Region Constructors
    2. Initializes a new Region.

    3. Region Class
    4. Describes the interior of a graphics shape composed of rectangles and paths. This class cannot be inherited.

    5. RegionData Class
    6. Encapsulates the data that makes up a Region object. This class cannot be inherited.

    7. VB .Net to C# Conversion – RadioButton.CheckedChanged Event Not Firing
    8. In your Winforms application you have a radio button. If the user changes the value, you want to get notified. You will use RadioButton.CheckedChanged event. Your code works fine but here is a problem.

    Windows Styles

    Windows Styles

    very good tricks

      Create Graphics from handle

    1. Graphics.FromHwnd(IntPtr) Method
    2. Creates a new Graphics from the specified handle to a window.

      CreateParams

    3. What are the possible values for CreateParams.Style?
    4. So, I've been playing with trying to create an AppBar program I'm making. Now, the program itself is actually quite simple but I had to borrow some code from a CodeProject project to make it an AppBar.

    5. Use parameter passed to form constructor in CreateParams in WinForms.NET
    6. How to get rid of flicker on Windows Forms applications
    7. Flickering in a Windows Forms app
    8. How to set minimum Size of Custom Control with "CreateParams"
    9. I am trying to make a draggable, resizable panel with a minimum size. I have used CreateParams for the Resize and now the Minimum size property doesn't work.

    10. CreateParams occurs - Window handle exception
    11. I am using CreateParams on my own Tabcontrol to get rid of its flickering meanwhile resizing and loading. It's just an empty class where I implemented CreateParams.

    12. Painting the borders of a custom control using WM_NCPAINT
    13. Over the years I've created a number of controls that require borders. Sometimes, I'll draw the borders manually as part of the normal user paint sequence. Other times I'll apply the WS_EX_CLIENTEDGE or WS_BORDER styles and let Windows handle it for me.

    Sunday, September 4, 2022

    Friday, September 2, 2022

    rectangle examples and DrawReversibleFrame method

    rectangle examples

    rectangle

    1. A Resizable Graphical Rectangle
    2. An object associated with a pictureBox managing callback to manipulate the rectangle area.

    3. Plot Graphic Library
    4. In this article, you will see a library called PGL that encapsulates plot capabilities in a MFC project for VC6 and VC7. It can easily plot data generated in a project without the need of any external software.

    5. Drawing Lines And Rectangles Using the Mouse
    6. Simple program utilizing the mouse to draw lines and rectangles.

    7. Extended Graphics - An implementation of Rounded Rectangle in C
    8. An implementation of Rounded Rectangle in C# which could be used to create XP-like buttons and rounded border.

    9. Extended Graphics - Rounded rectangles, Font metrics and more for C# 3.0
    10. Adding missing functionality to the Graphics class with the use of Extension Methods in C# 3.0.

    11. Using Trigonometry and Pythagoras to WaterMark an Image
    12. An article on a class to watermark images

    13. Office 2003 Line Control
    14. A GroupBox-like single line similar to that found in Office 2003.

    15. Drawing Round-Edged Rectangle Using VB.NET
    16. This code can be used to draw Round Edged Rectangles using VB.NET

    17. A thermometer control
    18. Creating an analog-style thermometer

    19. Pulse Button
    20. How to create a button that radiates pulses

    21. Design WinForms Controls using Photoshop
    22. Use your skills as a designer to create gorgeous control

    23. A simple Compass
    24. How to draw a compass and feed it with NMEA device data (i.e. a GPS Compass)

    25. CircleControl - A Circular Motion Control
    26. A circular motion control

    27. Perspective Projection of a Rectangle (Homography)
    28. Short study of the perspective projection of a rectangle in space; homography opposed to bilinear transform

    29. Running this C# project - `Resource file "Properties\Resources.resx" cannot be found`
    30. I just downloaded this project and I get the following error 1>------ Rebuild All started: Project: ChromeSample, Configuration: Debug x86 ------ 1>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(2318,5): error MSB3552: Resource file "Properties\Resources.resx" cannot be found. ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ========== I am using VS2012 - Windows 7 for building it. Any suggestions on how I could fix it. I havent used C# in a long time and need to see if this works immediately.

      DrawReversibleDrame function

    31. How to highlight a given color in C#
    32. How could I highlight a given color in C#. The user selects an arbitrary color for the objects I'm displaying. When I select the objects I would like to highlight them.

    33. System Colors in GDI+
    34. The SystemColors class represents the Windows system colors; it provides 26 read-only properties, each of which returns a Color object. Table 5.1 lists the properties of the SystemColors class.

    35. ControlPaint.DrawReversibleFrame(Rectangle, Color, FrameStyle) Method
    36. Draws a reversible frame on the screen within the specified bounds, with the specified background color, and in the specified state.

      Good Demos

    37. Draw with Mouse
    38. An article showing how to draw on screen

    39. A scrollable, zoomable, and scalable picture box
    40. A scrollable, zoomable, and scalable picture box with context menu.

    41. Resizable, Moveable & Customizable Borderless Form
    42. An article on customizable user forms

    43. Resizable, Moveable & Customizable Borderless Form
    44. An article on customizable user forms

    45. Working With Absolute Positions in .NET Graphics
    46. An absolute set of coordinates to simplify graphics in .NET.

    47. OpenS-CAD, a simple 2D CAD application
    48. A simple 2D CAD application.

    49. Equation Calculator with Graphing
    50. Equation Calculator with Graphing

    bitfield

    bitfield

      Microsoft Site

    1. C Bit Fields
    2. In addition to declarators for members of a structure or union, a structure declarator can also be a specified number of bits, called a "bit field." Its length is set off from the declarator for the field name by a colon. A bit field is interpreted as an integral type.

    3. Bit-field
    4. Declares a class data member with explicit size, in bits. Adjacent bit-field members may (or may not) be packed to share and straddle the individual bytes.

      Example

    5. C - Bit Fields
    6. Suppose your C program contains a number of TRUE/FALSE variables grouped in a structure called status, as follows −

    7. Bit Fields in C
    8. In C, we can specify size (in bits) of structure and union members. The idea is to use memory efficiently when we know that the value of a field or group of fields will never exceed a limit or is within a small range.

    9. What direction does the compiler define bitfields? Is it LSB to MSB or the reverse.
    10. What direction does the compiler define bitfields? Is it LSB to MSB or the reverse.

    11. Bit field
    12. A bit field is a data structure that consists of one or more adjacent bits which have been allocated for specific purposes, so that any single bit or group of bits within the structure can be set or inspected.[1][2] A bit field is most commonly used to represent integral types of known, fixed bit-width, such as single-bit Booleans.

    13. Storage and Alignment of Structures
    14. Structure members are stored sequentially in the order in which they are declared: the first member has the lowest memory address and the last member the highest.

    15. How Endianness Effects Bitfield Packing
    16. Hints for porting drivers. Big endian machines pack bitfields from most significant byte to least. Little endian machines pack bitfields from least significant byte to most.

    17. 6.4. Bitfields
    18. While we're on the subject of structures, we might as well look at bitfields. They can only be declared inside a structure or a union, and allow you to specify some very small objects of a given number of bits in length. Their usefulness is limited and they aren't seen in many programs, but we'll deal with them anyway. This example should help to make things clear:

    19. Don'ts for bit-fields
    20. Don'ts for bit-fields

    21. Bitfield storage in memory
    22. Bit field are structures in c that hold bit fields. A typical definition is:

    23. Can I safely assume that Windows installations will always be little-endian?
    24. I'm writing a userspace filesystem driver on Windows and endianness conversions are something I've been dealing with, as this particular filesystem always stores values in little-endian format and the driver is expected to convert them (if necessary) for the CPU it's running on. However, I find myself wondering if I even need to worry about endianness conversions, since as far as I can tell, desktop Windows only supports little-endian architectures (IA32, x86-84, etc.), and therefore, the on-disk little-endian values are perfectly fine sans conversion. Is this observation accurate, and if so, is it generally acceptable to make the assumption that Windows will always be running on little-endian hardware? Additionally, is it even possible (in 2011) to run Windows on a big-endian emulator or something, such that one could even test for endianness issues?

    25. Endianness
    26. "Big-endian" and "Little-endian" redirect here. For the conflicting ideologies in Gulliver’s Travels, see Lilliput and Blefuscu § History and politics.